/* Enhanced Product Folder Navigator Frontend Styles - Dark Mode with Video Preview and Modal */

/* Base Styles */
.product-folder-navigator {
    width: 100%;                
    max-width: none;            
    margin: 0;                  
    padding: 0;                 
    box-sizing: border-box;     
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background-color: #121212;  
    color: #e0e0e0;             
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1); 
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale;
}

.folder-explorer {
    display: flex;
    width: 100%;                
    border: 1px solid #333;     
    border-radius: 4px;
    overflow: hidden;
    min-height: 400px;
    box-sizing: border-box;
    background-color: #1e1e1e;  
}

.folder-navigation {
    width: 30%;
    min-width: 200px;
    border-right: 1px solid #333;  
    background-color: #252525;     
    overflow-y: auto;
    box-sizing: border-box;
}

.folder-contents {
    flex-grow: 1;
    padding: 15px;
    background-color: #1e1e1e;  
    overflow-y: auto;
    box-sizing: border-box;
}

/* Product List */
.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.product-item {
    border: 1px solid #333;  
    border-radius: 4px;
    padding: 15px;
    text-align: center;
    transition: all 0.2s ease;
    background-color: #252525;  
    position: relative;        
    overflow: hidden;          
    display: flex;
    flex-direction: column;
}

.product-item:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);  
}

.product-image {
    margin-bottom: 0px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 150px;
    position: relative;       
    cursor: pointer;
}

.product-image img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.product-title {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.3;
    color: #e0e0e0;  
    flex-grow: 1;
}

/* View Details Button (requirement #1) */
.product-actions {
    margin-top: 10px;
    text-align: center;
}

.view-product-btn {
    background-color: #2c3e50;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

.view-product-btn:hover {
    background-color: #34495e;
}

.view-product-btn:active {
    background-color: #1a2533;
    transform: scale(0.98);
}

/* Video indicator */
.video-indicator {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 12px;
    z-index: 1;
}

.video-indicator .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Product Modal (requirement #3) */
.product-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    overflow: auto;
    opacity: 0;
    transition: opacity 0.3s;
}

.product-modal.open {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.modal-content {
    background-color: #1e1e1e;
    margin: 20px;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    z-index: 1;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 10px 0;
}

.modal-product h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #fff;
    padding-right: 30px;
}

.modal-product-media {
    margin-bottom: 20px;
    max-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-color: #0a0a0a;
    border-radius: 4px;
}

.modal-product-video,
.modal-product-image {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.modal-product-price {
    font-size: 18px;
    font-weight: 600;
    color: #58a6ff;
    margin-bottom: 15px;
}

/* Buy Now Button */
.buy-now-btn {
    display: inline-block;
    background-color: #58a6ff;
    color: #000;
    font-weight: 600;
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.buy-now-btn:hover {
    background-color: #75b6ff;
}

.buy-now-btn:active {
    background-color: #4a8fd9;
    transform: scale(0.98);
}

/* Modal Navigation (requirement #4) */
.modal-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 0px;
    margin-left: 30px;
    margin-right: 30px;
}

.modal-prev,
.modal-next {
    background-color: #4e4e4e;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
}

.modal-product-info {
    display: flex;
    justify-content: center;
}

.modal-prev:hover,
.modal-next:hover {
    background-color: #444;
}

.modal-prev:active,
.modal-next:active {
    background-color: #222;
}

.modal-prev.hidden,
.modal-next.hidden {
    visibility: hidden;
}

/* Fixed modal on scroll */
body.modal-open {
    overflow: hidden;
}

/* Breadcrumbs */
.folder-breadcrumbs {
    padding: 10px;
    margin-bottom: 15px;
    background-color: #252525;  
    border-radius: 4px;
    font-size: 14px;
}

.breadcrumb-home {
    color: #58a6ff;  
    cursor: pointer;
    font-weight: 600;
}

.breadcrumb-path span {
    margin: 0 5px;
}

.breadcrumb-part {
    color: #58a6ff;  
    cursor: pointer;
}

.breadcrumb-part:hover,
.breadcrumb-home:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #888;
    margin: 0 5px;
}

/* Folder Tree */
.folder-tree {
    padding: 10px;
}

.folder-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.folder-tree li {
    margin: 4px 0;
    padding-left: 16px;
}

.folder-item {
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
    margin: 2px 0;              
}

.folder-item:hover {
    background-color: #333;     
}

.folder-item:active {
    background-color: #1a1a1a;  
}

.folder-item.active {
    background-color: #2c3e50;  
    font-weight: 600;
}

.folder-icon {
    margin-right: 6px;
    color: #f0b400;  
}

.folder-name {
    flex-grow: 1;
}

.folder-count {
    font-size: 12px;
    color: #aaa;  
    margin-left: 5px;
}

/* Empty states */
.empty-folder {
    padding: 30px;
    text-align: center;
    color: #888;  
    font-style: italic;
}

/* Loading states */
.folder-loading, 
.product-loading {
    padding: 20px;
    text-align: center;
    color: #888;  
}

/* Error states */
.folder-error,
.product-error {
    padding: 20px;
    text-align: center;
    color: #ff6b6b;  
}

/* Mobile Optimization (requirement #4) */
@media (max-width: 1024px) {
    .folder-navigation {
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    .product-folder-navigator {
        width: 100%;            
        margin: 0;
        padding: 0;
    }
    
    .folder-explorer {
        flex-direction: column;
        width: 100%;
        min-height: unset;
        border-radius: 0;        
    }
    
    .folder-navigation {
        width: 100%;
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid #333;  
        max-height: 250px;      
    }
    
    .folder-contents {
        max-height: unset;
        width: 100%;
        padding: 10px;
    }
    
    .product-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
        gap: 10px;              
    }
    
    .product-item {
        padding: 3px;       
    }
    
    .product-image {
        height: 120px;          
    }
    
    .folder-breadcrumbs {
        padding: 8px;
        margin-bottom: 8px;
        font-size: 12px;        
    }
    
    /* Modal optimizations for mobile */
    .modal-content {
        width: 95%;
        margin: 10px;
        padding: 15px;
    }
    
    .modal-product h2 {
        font-size: 18px;
        margin-bottom: 10px;
    }
    
    .modal-product-media {
        max-height: 300px;
    }
    
    .modal-product-video,
    .modal-product-image {
        max-height: 300px;
    }
    
    .modal-navigation {
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        transform: translateY(-50%);
        padding: 0 10px;
        pointer-events: none;
    }
    
    .modal-prev,
    .modal-next {
        width: 36px;
        height: 36px;
        background-color: rgba(51, 51, 51, 0.7);
        pointer-events: auto;
    }
    
    /* Better touch targets for mobile */
    .view-product-btn {
        padding: 10px 16px;
        font-size: 16px;
    }
    
    .buy-now-btn {
        padding: 12px 24px;
        font-size: 16px;
        display: block;
        text-align: center;
    }
}

/* Additional small screen optimizations */
@media (max-width: 480px) {
    .product-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); 
    }
    
    .folder-item {
        padding: 5px 6px;       
    }
    
    .product-title {
        font-size: 12px;        
        margin-bottom: 0px;
    }
    
    .product-image {
        height: 100px;          
        margin-bottom: 0px;
    }
    
    .folder-item, .breadcrumb-home, .breadcrumb-part {
        font-size: 13px;        
    }
    
    .modal-product-media {
        max-height: 250px;
    }
    
    .modal-product-video,
    .modal-product-image {
        max-height: 250px;
    }
}

/* Mobile touch enhancements */
@media (hover: none) {
    .folder-item:hover {
        background-color: transparent; 
    }
    
    .breadcrumb-part:hover,
    .breadcrumb-home:hover {
        text-decoration: none;   
    }
    
    /* Increase touch target sizes */
    .breadcrumb-home,
    .breadcrumb-part {
        padding: 6px 4px;
        display: inline-block;
    }
    
    /* Improved scrolling */
    .folder-navigation,
    .folder-contents {
        -webkit-overflow-scrolling: touch;  
        scrollbar-width: thin;              
    }

    .modal-product-info {
        display: block;
    }
}