/* theme_modern.css - BeMusic Flat UI & Theme System */

:root {
    /* Dark Theme (Default) */
    --bg-color: #121212;
    --text-primary: #ffffff;
    --text-secondary: #a7a7a7;
    --accent-color: #E50914; 
    --card-bg: #181818;
    --card-hover: #282828;
    --header-bg: rgba(18, 18, 18, 0.95);
    --sidebar-bg: #000000;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.4);
}

body.light-theme {
    /* Light Theme */
    --bg-color: #f8f9fa;
    --text-primary: #121212;
    --text-secondary: #6c757d;
    --accent-color: #E50914;
    --card-bg: #ffffff;
    --card-hover: #f1f3f5;
    --header-bg: rgba(255, 255, 255, 0.95);
    --sidebar-bg: #f8f9fa;
    --border-color: rgba(0, 0, 0, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.05);
}

/* Force Light Theme Backgrounds and Text Colors */
body.light-theme,
body.light-theme .app-container,
body.light-theme .main-content-wrapper {
    background-color: var(--bg-color) !important;
}
body.light-theme h1, body.light-theme h2, body.light-theme h3, body.light-theme h4,
body.light-theme .section-title, body.light-theme .file-card-title {
    color: var(--text-primary) !important;
}

/* Force White Footer Text in Light Mode */
body.light-theme footer, 
body.light-theme footer p, 
body.light-theme footer a, 
body.light-theme footer h3, 
body.light-theme footer h4, 
body.light-theme footer .widget-title {
    color: #ffffff !important;
}
body.light-theme footer a:hover {
    color: var(--accent-color) !important;
}

body {
    background-color: var(--bg-color) !important;
    color: var(--text-primary) !important;
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* -------------------------------------------
   Layout - Fixed Sidebar System
------------------------------------------- */
.app-container {
    display: flex;
    min-height: 100vh;
    padding-top: 70px; /* Header space */
}

.fixed-sidebar-wrapper {
    width: 250px;
    position: fixed;
    top: 70px;
    bottom: 0;
    left: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 1040;
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}
.fixed-sidebar-wrapper::-webkit-scrollbar { width: 5px; }
.fixed-sidebar-wrapper::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }

.main-content-wrapper {
    flex: 1;
    margin-left: 250px;
    padding: 20px 40px;
    max-width: calc(100% - 250px);
}

@media (max-width: 991px) {
    .fixed-sidebar-wrapper {
        display: block;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 15px rgba(0,0,0,0.5);
    }
    .fixed-sidebar-wrapper.show-sidebar {
        transform: translateX(0);
    }
    .main-content-wrapper {
        margin-left: 0;
        max-width: 100%;
        padding: 15px;
    }
}

/* -------------------------------------------
   Header & Navbar 
------------------------------------------- */
.navbar-modern {
    background: var(--header-bg) !important; 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color); 
    padding: 10px 0;
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    z-index: 1050;
    height: 70px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.navbar-brand img { height: 35px; }

.search-form-modern {
    background-color: var(--card-bg);
    border-radius: 50px;
    display: flex;
    align-items: center;
    padding: 5px 8px 5px 24px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    height: 44px;
    width: 450px;
    max-width: 100%;
}
.search-form-modern input { background: transparent; border: none; color: var(--text-primary); width: 100%; outline: none; font-size: 14px; }
.search-form-modern input::placeholder { color: var(--text-secondary); }
.search-form-modern select { display: none; } /* Hide select for cleaner look */
.search-btn { background: transparent; color: var(--text-secondary); border: none; transition: 0.3s; cursor: pointer; display: flex; align-items: center; justify-content: center;}
.search-btn:hover { color: var(--text-primary); }

.theme-toggle-btn {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: 0.3s;
    margin-left: 15px;
}
.theme-toggle-btn:hover { background: var(--card-hover); }

/* -------------------------------------------
   Typography & Utilities 
------------------------------------------- */
.text-primary-theme { color: var(--text-primary) !important; }
.text-secondary-theme { color: var(--text-secondary) !important; }
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
}
.section-title i { font-size: 0.9rem; margin-left: 8px; color: var(--accent-color); }
.show-all-btn {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: 0.3s;
}
.show-all-btn:hover { color: var(--text-primary); }
.section-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; }

/* -------------------------------------------
   Sidebar Navigation
------------------------------------------- */
.sidebar-nav-list {
    list-style: none;
    padding: 10px 15px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar-nav-item { margin-bottom: 2px; }
.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: 0.3s;
}
.sidebar-nav-link:hover {
    background: var(--card-hover);
    color: var(--text-primary);
}
.sidebar-nav-link.active {
    background: rgba(229, 9, 20, 0.1) !important;
    color: var(--accent-color) !important;
    border-left: 4px solid var(--accent-color);
    padding-left: 11px; /* 15px - 4px border */
    font-weight: 600;
}
.sidebar-nav-link.active i {
    color: var(--accent-color) !important;
}
.sidebar-nav-link i { width: 30px; font-size: 1.1rem; }
.sidebar-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 1px;
    margin: 25px 0 10px 30px;
}

/* Scrollable Genres List (Sidebar Legacy - Keeping for fallback) */
.scrollable-genres {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}
.scrollable-genres::-webkit-scrollbar { width: 4px; }
.scrollable-genres::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
.scrollable-genres:hover::-webkit-scrollbar-thumb { background: var(--text-secondary); }

/* Horizontal Category Slider (Pill Style) */
.category-swiper {
    padding: 0 35px !important; /* space for arrows */
}
.horizontal-category-slider {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 12px;
    padding-bottom: 8px;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}
.horizontal-category-slider::-webkit-scrollbar { 
    display: none; /* Chrome, Safari, Opera */
}
.category-pill {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    padding: 8px 24px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}
.category-pill:hover, .category-pill.active {
    background: var(--accent-color);
    color: #ffffff !important;
    border-color: var(--accent-color);
}
body.light-theme .category-pill {
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

/* Custom Navigation Arrows for Category Slider */
.swiper-button-next-category, .swiper-button-prev-category {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
}
.swiper-button-next-category:hover, .swiper-button-prev-category:hover {
    background: var(--accent-color);
    box-shadow: 0 0 10px rgba(229, 9, 20, 0.6);
    border-color: var(--accent-color);
}
.swiper-button-next-category.swiper-button-disabled, .swiper-button-prev-category.swiper-button-disabled {
    opacity: 0.2;
    cursor: not-allowed;
    background: rgba(0,0,0,0.3);
}
.swiper-button-next-category { right: 0; }
.swiper-button-prev-category { left: 0; }
body.light-theme .swiper-button-next-category, body.light-theme .swiper-button-prev-category {
    background: rgba(255, 255, 255, 0.9);
    color: #121212;
    border-color: rgba(0,0,0,0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
body.light-theme .swiper-button-next-category:hover, body.light-theme .swiper-button-prev-category:hover {
    background: var(--accent-color);
    color: #fff;
}

/* -------------------------------------------
   Music Cards (Flat Aesthetic with Glow)
------------------------------------------- */
.file-card {
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 12px;
    background: transparent;
}
.file-card:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 30px rgba(229, 9, 20, 0.4); /* Glow matching accent color */
    border-radius: 12px;
    z-index: 10;
    position: relative;
}
body.light-theme .file-card:hover {
    box-shadow: 0 12px 30px rgba(229, 9, 20, 0.25);
}
.file-card {
    background: transparent !important;
    border: none !important;
    padding: 0;
    transition: 0.3s;
    cursor: pointer;
    color: var(--text-primary) !important;
}
.file-card img {
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow-color);
    transition: 0.3s;
}
.file-card:hover img {
    box-shadow: 0 8px 25px var(--shadow-color);
    transform: translateY(-4px);
}
.file-card-details { padding-top: 10px; }
.file-card-title { color: var(--text-primary); font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.file-card-artist { color: var(--text-secondary); font-size: 0.8rem; font-weight: 500; }

.play-overlay {
    position: absolute; right: 10px; bottom: 10px; 
    width: 45px; height: 45px;
    background: var(--text-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transform: translateY(10px);
    transition: all 0.3s; 
    z-index: 2;
    box-shadow: 0 5px 15px var(--shadow-color);
}
.file-card:hover .play-overlay { opacity: 1; transform: translateY(0); }
.play-overlay i { font-size: 1.1rem; color: var(--bg-color); margin-left: 3px; }

/* -------------------------------------------
   Colorful Category Cards
------------------------------------------- */
.genre-card {
    border-radius: 12px;
    padding: 25px 20px;
    color: #ffffff !important; 
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    height: 120px;
    transition: 0.3s;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 15px var(--shadow-color);
}
.genre-card:hover { transform: scale(1.03); color: #ffffff !important;}
/* Add pseudo element for a subtle gradient overlay to make text pop */
.genre-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 60%;
    background: linear-gradient(to top, rgba(0,0,0,0.4), transparent);
}
.genre-title { position: relative; z-index: 2; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }

/* Category Colors */
.genre-color-0 { background-color: #E91E63; }
.genre-color-1 { background-color: #9C27B0; }
.genre-color-2 { background-color: #F44336; }
.genre-color-3 { background-color: #673AB7; }
.genre-color-4 { background-color: #3F51B5; }
.genre-color-5 { background-color: #2196F3; }
.genre-color-6 { background-color: #009688; }
.genre-color-7 { background-color: #4CAF50; }
.genre-color-8 { background-color: #FF9800; }
.genre-color-9 { background-color: #FF5722; }
.genre-color-10 { background-color: #795548; }
.genre-color-11 { background-color: #607D8B; }

/* Utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================
   🎵 SINGLE SONG PREMIUM UI UPDATES
   ========================================== */

/* Sidebar 'You May Also Like' List Background Fix */
.sb-list .list-group-item {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
    transition: 0.3s;
}
.sb-list .list-group-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}
body.light-theme .sb-list .list-group-item {
    background: #ffffff !important;
}
body.light-theme .sb-list .list-group-item:hover {
    background: #f1f3f5 !important;
}

/* Single Song Mini Play Button */
.btn-play-mini {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--accent-color);
    color: #fff; border: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; cursor: pointer; transition: 0.3s;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
    flex-shrink: 0;
}
.btn-play-mini:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(229, 9, 20, 0.6); }

/* Spotify-Style Sticky Bottom Audio Player */
.sticky-audio-player {
    position: fixed !important; bottom: -120px !important; left: 0 !important; width: 100% !important;
    background: rgba(18, 18, 18, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 99999 !important;
    transition: bottom 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
}
.sticky-audio-player.active {
    bottom: 0 !important;
}
body.light-theme .sticky-audio-player {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0,0,0,0.08);
}
.sticky-player-inner {
    display: flex; align-items: center; gap: 20px;
    padding: 10px 45px 10px 20px; max-width: 1600px; margin: 0 auto;
    position: relative;
}
.sp-close-btn {
    position: absolute; right: 15px; top: 15px; z-index: 999;
    background: none; border: none; color: var(--text-primary); font-size: 1.5rem; cursor: pointer; transition: 0.2s;
}
.sp-close-btn:hover { color: var(--accent-color); transform: scale(1.1); }
.sp-info { flex: 0 0 220px; }
.sp-title { font-weight: 700; color: var(--text-primary); font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.sp-artist { color: var(--text-secondary); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-artist a { color: #b3b3b3 !important; text-decoration: none; transition: color 0.2s; }
.sp-artist a:hover { color: var(--accent-color) !important; }
.sp-controls { margin-right: 15px; }
.sp-btn { background: none; border: none; color: var(--text-primary); font-size: 1.5rem; cursor: pointer; transition: 0.2s; padding: 0 10px; }
.sp-btn:hover { color: var(--accent-color); transform: scale(1.1); }

.sp-progress-container {
    flex-grow: 1; display: flex; align-items: center; gap: 15px;
    color: var(--text-secondary); font-size: 0.8rem; font-family: 'Montserrat', sans-serif; font-weight: 600;
}
#seek-slider {
    flex-grow: 1; cursor: pointer; height: 5px; border-radius: 3px;
    appearance: none; background: rgba(255,255,255,0.2);
    background-image: linear-gradient(var(--accent-color), var(--accent-color));
    background-size: var(--seek-before-width, 0%) 100%;
    background-repeat: no-repeat;
    transition: background-size 0.1s linear;
    touch-action: manipulation;
    pointer-events: auto;
}
#seek-slider:hover { background: rgba(255,255,255,0.3); }
body.light-theme #seek-slider { background: rgba(0,0,0,0.15); }
body.light-theme #seek-slider:hover { background: rgba(0,0,0,0.25); }
#seek-slider::-webkit-slider-thumb {
    appearance: none; width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent-color); cursor: pointer;
    box-shadow: 0 0 10px rgba(229, 9, 20, 0.5);
}
.sp-right-controls {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    flex-direction: row !important;
    margin-left: auto;
}
.sp-volume-container {
    display: flex; align-items: center; gap: 10px; width: 130px;
}
#spVolumeBar {
    flex-grow: 1; cursor: pointer; height: 5px; border-radius: 3px;
    appearance: none; background: rgba(255,255,255,0.2);
    background-image: linear-gradient(var(--text-primary), var(--text-primary));
    background-size: var(--volume-before-width, 100%) 100%;
    background-repeat: no-repeat;
    touch-action: manipulation;
    pointer-events: auto;
}
body.light-theme #spVolumeBar { background: rgba(0,0,0,0.15); }
#spVolumeBar::-webkit-slider-thumb {
    appearance: none; width: 12px; height: 12px; border-radius: 50%;
    background: var(--text-primary); cursor: pointer;
}
#spVolumeBar:hover::-webkit-slider-thumb {
    background: var(--accent-color);
}
#spVolumeBar:hover {
    background-image: linear-gradient(var(--accent-color), var(--accent-color));
}

@media (min-width: 769px) {
    /* Desktop alignment for Related Albums/Genres */
    .related-albums-container {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
        align-items: start !important; /* Force items to align at the top */
        gap: 20px !important;
    }
    .related-albums-container .col {
        width: 100% !important; /* Override bootstrap col */
    }
    .related-albums-container .file-card {
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: center !important;
        text-align: center !important;
        height: 100% !important;
    }
    .related-albums-container .file-card img,
    .related-albums-container .file-card .lazy {
        margin-top: 0 !important;
        margin-bottom: 12px !important;
        max-width: 100px !important; /* Ensure uniform icon size */
        height: auto !important;
    }
}

@media (max-width: 768px) {
    .sticky-player-inner { 
        padding: 10px 15px; 
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: center !important; /* Center everything as requested */
        gap: 8px 15px !important; 
    }
    
    /* Top Row: Progress Bar spans 100% */
    .sp-progress-container { 
        width: 100% !important; 
        order: 1; 
        margin: 0; 
    }
    
    /* Bottom Row Controls Setup */
    .sp-info { 
        order: 2; 
        flex: 0 0 auto; 
        min-width: 0; 
        width: 100%;
        max-width: 120px !important; /* Keep it small for mobile as requested */
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: block !important;
    }
    .sp-title, .sp-artist {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: block !important;
    }
    .sp-artist a, .sp-artist span {
        display: inline !important;
        white-space: nowrap !important;
    }

    .sp-controls { 
        order: 3; 
        flex-shrink: 0;
    }

    .sp-right-controls { 
        order: 4; 
        display: flex !important; 
        align-items: center;
        flex-shrink: 0;
        gap: 20px !important;
        padding-right: 20px !important; /* Ensure the volume icon doesn't touch the right edge */
    }
    
    .sp-volume-container { 
        width: auto !important; 
        gap: 0 !important; 
        position: relative; /* Anchor for popup */
    }

    /* Popup Volume Slider on Mobile */
    #spVolumeBar { 
        display: none !important; /* Default hidden */
        position: absolute;
        bottom: 120%; /* Pop up just above the icon */
        right: 0;
        width: 120px !important;
        background: rgba(18, 18, 18, 0.98);
        border: 1px solid rgba(255,255,255,0.15);
        padding: 12px 10px !important;
        border-radius: 8px;
        z-index: 1000;
        box-shadow: 0 5px 20px rgba(0,0,0,0.6);
    }
    #spVolumeBar.active {
        display: block !important;
    }

    /* Floating Close Button for Mobile to completely prevent overlap */
    .sp-close-btn { 
        position: absolute !important;
        top: -10px !important; 
        bottom: auto !important; 
        right: 10px !important; 
        z-index: 9999 !important;
        background: rgba(0, 0, 0, 0.7) !important;
        border-radius: 50% !important;
        width: 25px !important;
        height: 25px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 0.9rem !important;
    }

    /* Fix Mobile Folder Grid Layout */
    .related-albums-container {
        display: grid !important;
        grid-template-columns: 1fr !important; /* 1 item per row for wider space */
        gap: 12px !important;
    }
    .related-albums-container .col {
        width: 100% !important; /* Override bootstrap constraints */
    }
    .related-albums-container .file-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        padding: 12px !important;
        height: auto !important;
    }
    .related-albums-container .file-card img, 
    .related-albums-container .file-card .lazy {
        width: 55px !important;
        height: 55px !important;
        margin-right: 15px !important;
        margin-bottom: 0 !important;
        border-radius: 8px;
    }
    .related-albums-container .file-card-details {
        margin-top: 0 !important;
        flex: 1;
    }
    .related-albums-container .play-overlay {
        display: none !important; /* Hide play overlay on mobile list view */
    }
    .related-albums-container .file-card-title {
        font-size: 1rem !important;
        margin-bottom: 4px !important;
    }
}
