/* assets/css/style.css */
/* --- TACTICAL HUD TYPOGRAPHY --- */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;700&family=Share+Tech+Mono&display=swap');

:root {
    /* Base Layers: Matte Equipment Finishes */
    --black: #0F1210;            /* Armor/Hardware Finish */
    --blue: #1E231E;             /* Soft-shell Ranger Green */
    
    /* Accents: Safety and Navigation */
    --yellow: #A38C5E;           /* Coyote Brown (Tactical webbing) */
    
    /* Text & Readability (Standardized Stencil Stamping) */
    --Green-1: #5D6858;          /* Foliage Green (Active states) */
    --Green-2: #8E968B;          /* Sage Grey (Primary UI Text) */
    --Green-3: #BCC5B8;          /* Light Ghost Green (High-contrast) */
    
    /* Hardware Components */
    --player-bg: #454b4d;        /* Steel Gray (Anodized Console) */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Share Tech Mono', monospace; /* Default Data Font */
}

/* ==========================================
   GLOBAL TERMINAL HUD OVERLAY
   ========================================== */
body {
    background-color: var(--black);
    color: var(--Green-2);
    height: 100vh; 
    overflow: hidden;
    position: relative;
}

/* CRT Scanline Effect */
body::after {
    content: ""; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 3px 100%;
    pointer-events: none; z-index: 9999; opacity: 0.3;
}

/* Tactical Headers */
h1, h2, h3, h4, .section-title, .logo h2 {
    font-family: 'Rajdhani', sans-serif !important;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--Green-3);
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh; 
}

/* ==========================================
   SIDEBAR (COMMAND MENU)
   ========================================== */
.sidebar {
    width: 260px;
    background-color: var(--black);
    padding: 24px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--Green-1);
}

.logo h2 {
    margin-bottom: 30px;
    font-size: 26px;
    color: white;
}
.logo h2 span {
    color: var(--yellow); /* Tactical accent for "Music" */
}

.menu ul, .playlists-menu ul {
    list-style: none;
}

.menu li, .playlists-menu li {
    padding: 12px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
    color: var(--Green-2);
    transition: 0.2s;
    border-left: 2px solid transparent; /* Ready for active state */
}

.menu li:hover, .menu li.active {
    color: var(--yellow);
    background: rgba(163, 140, 94, 0.05);
    border-left: 2px solid var(--yellow);
}

.menu i, .playlists-menu i {
    font-size: 20px;
}

.playlists-menu {
    margin-top: 30px;
}

.playlists-menu h4 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--Green-1);
    margin-bottom: 10px;
    border-bottom: 1px dashed var(--Green-1);
    padding-bottom: 5px;
}

/* ==========================================
   MAIN CONTENT & TOPBAR
   ========================================== */
.main-content {
    flex: 1;
    background: var(--blue);
    overflow-y: auto; 
    position: relative; 
    padding: 0 24px 24px 24px; 
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky; 
    top: 0;
    height: 70px;
    padding: 10px 24px;
    margin: 0 -24px 20px -24px; 
    background: var(--black);   
    border-bottom: 1px solid var(--Green-1);
    z-index: 1000;
}

/* Chamfered Search Input */
.search-bar {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--Green-1);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 300px;
    transition: 0.3s;
}

.search-bar:focus-within {
    border-color: var(--yellow);
    box-shadow: inset 0 0 10px rgba(163, 140, 94, 0.1);
}

.search-bar input {
    border: none;
    outline: none;
    width: 100%;
    color: white;
    background: transparent;
    font-size: 14px;
}
.search-bar i { color: var(--yellow); }

/* ==========================================
   CARDS & GRIDS (Hardware Style)
   ========================================== */
.music-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); 
    gap: 15px;
}

.music-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--Green-1);
    /* Chamfered Corners */
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    padding: 10px;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
}

.music-card:hover {
    border-color: var(--yellow);
    background: rgba(163, 140, 94, 0.05);
}

.music-card img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.1);
    filter: grayscale(20%) contrast(110%); /* Gritty image filter */
}

.music-card h4 {
    color: white;
    margin-top: 8px;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-card p {
    font-size: 11px;
    color: var(--Green-2);
    margin-top: 2px;
}

/* Angular Play Overlay */
.play-btn-overlay {
    position: absolute;
    right: 20px;
    bottom: 80px;
    background: var(--yellow);
    width: 40px;
    height: 40px;
    clip-path: polygon(25% 0%, 75% 0%, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0% 75%, 0% 25%); /* Octagon */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(10px);
    transition: 0.3s ease;
}

.play-btn-overlay i {
    color: var(--black);
    font-size: 24px;
    margin-left: 2px;
}

.music-card:hover .play-btn-overlay {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   LIST LAYOUT (Data Logs)
   ========================================== */
.music-list {
    display: flex;
    flex-direction: column;
    gap: 4px; 
    width: 100%;
}

.music-list .music-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 6px 12px; 
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
    text-align: left;
}

.music-list .music-card img {
    width: 36px; height: 36px;
    margin-bottom: 0;
}

.music-list .music-card .play-btn-overlay { display: none; }
.music-list .music-card h4 { margin: 0; flex: 1; font-size: 14px; }
.music-list .music-card p { margin: 0; min-width: 120px; text-align: right; font-size: 12px; }

/* Action Icons */
.card-info-header { display: flex; justify-content: space-between; align-items: flex-start; width: 100%; margin-top: 8px; }
.card-text { flex: 1; min-width: 0; }
.card-actions { display: flex; align-items: center; gap: 8px; font-size: 20px; z-index: 10; }
.card-actions i { cursor: pointer; transition: 0.2s; color: var(--Green-2); }
.card-actions i:hover { color: var(--yellow); transform: scale(1.1); }
.music-list .card-info-header { align-items: center; margin-top: 0; }
.music-list .card-actions { font-size: 22px; margin-right: 15px; }

/* ==========================================
   VIEW TOGGLES & FILTERS
   ========================================== */
.filter-control-bar {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--Green-1);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%);
    padding: 20px;
    margin-bottom: 30px;
}

.filter-control-bar form { display: flex; gap: 20px; flex-wrap: wrap; justify-content: flex-start; }

.filter-group {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--Green-1);
    padding: 0 15px;
    transition: 0.2s;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
}

.filter-group:hover, .filter-group:focus-within { border-color: var(--yellow); }
.filter-group i { color: var(--yellow); font-size: 20px; margin-right: 10px; }
.filter-group select {
    background: transparent; color: white; border: none; padding: 10px 0; font-size: 14px;
    outline: none; cursor: pointer; min-width: 150px;
}
.filter-group select option { background: var(--black); color: white; }

.view-toggle-group { display: flex; gap: 8px; margin-left: auto; }
.view-btn {
    background: rgba(0, 0, 0, 0.3); color: var(--Green-2);
    border: 1px solid var(--Green-1); padding: 8px; cursor: pointer; transition: 0.2s; font-size: 20px;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%);
}
.view-btn:hover { color: white; border-color: var(--yellow); }
.view-btn.active { background: rgba(163, 140, 94, 0.2); color: var(--yellow); border-color: var(--yellow); }

/* ==========================================
   USER PROFILE DROPDOWN (Tactical Style)
   ========================================== */
.user-profile {
    display: flex; align-items: center; gap: 10px;
    background: rgba(0,0,0,0.4); padding: 4px 12px 4px 4px; cursor: pointer;
    border: 1px solid var(--Green-1); transition: 0.2s;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
}
.user-profile:hover { border-color: var(--yellow); }
.user-profile img { width: 32px; height: 32px; object-fit: cover; border: 1px solid var(--Green-1); }
.username-display { color: white; font-size: 14px; font-weight: 600; font-family: 'Rajdhani', sans-serif; letter-spacing: 1px;}
.profile-chevron { color: var(--Green-2); font-size: 18px; transition: transform 0.2s; }
.profile-dropdown-container:hover .profile-chevron { transform: rotate(180deg); }

.profile-dropdown-container { position: relative; }
.profile-dropdown {
    position: absolute; top: 55px; right: 0;
    background: var(--black); border: 1px solid var(--Green-1); width: 220px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8); display: flex; flex-direction: column;
    padding: 8px; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: 0.2s; z-index: 3000;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.profile-dropdown-container:hover .profile-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-header { padding: 12px; display: flex; flex-direction: column; }
.dropdown-name { color: white; font-weight: 700; font-size: 15px; font-family: 'Rajdhani', sans-serif; letter-spacing: 1px;}
.dropdown-role { color: var(--Green-2); font-size: 12px; margin-top: 2px; }
.dropdown-divider { height: 1px; background: var(--Green-1); margin: 4px 0; }
.profile-dropdown a {
    color: var(--Green-3); text-decoration: none; padding: 10px 12px; font-size: 14px; display: flex; align-items: center; gap: 12px; transition: 0.2s;
}
.profile-dropdown a i { font-size: 18px; color: var(--yellow); }
.profile-dropdown a:hover { background: rgba(163, 140, 94, 0.1); color: var(--yellow); }
.profile-dropdown a.logout-link:hover { background: rgba(255, 51, 51, 0.1); color: #ff3333; }
.profile-dropdown a.logout-link:hover i { color: #ff3333; }

/* ==========================================
   POPUP MODALS (Playlists, etc)
   ========================================== */
.crop-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; opacity: 0; visibility: hidden; transition: 0.3s;
}
.crop-modal-overlay.active { opacity: 1; visibility: visible; }

.playlist-modal-content {
    background: var(--black); padding: 30px 20px; width: 90%; max-width: 380px;
    border: 1px solid var(--Green-1);
    box-shadow: 0 0 30px rgba(93, 104, 88, 0.2), inset 0 0 20px rgba(0,0,0,0.8);
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
}

.playlist-select-btn {
    background: rgba(0,0,0,0.5); color: var(--Green-3);
    border: 1px solid var(--Green-1); padding: 14px 20px; width: 100%; text-align: left;
    display: flex; align-items: center; gap: 15px; font-size: 14px; cursor: pointer; transition: 0.2s;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
}
.playlist-select-btn:hover { background: rgba(163, 140, 94, 0.1); border-color: var(--yellow); color: var(--yellow); }
.playlist-select-btn i { font-size: 20px; color: var(--yellow); }

.playlist-close-btn {
    background: transparent; color: var(--Green-2); border: 1px dashed var(--Green-1);
    padding: 12px; width: 100%; font-size: 14px; font-weight: bold; margin-top: 15px; cursor: pointer; transition: 0.2s;
}
.playlist-close-btn:hover { color: white; border-style: solid; }

/* ==========================================
   MINIMALIST BOTTOM PLAYER (Steel Gray Console)
   ========================================== */
.bottom-player {
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; width: 100% !important; height: 75px; 
    background: var(--player-bg) !important;
    border-top: 2px solid rgba(255, 255, 255, 0.1); 
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.8);
    padding: 0 20px !important; z-index: 7000 !important;
    display: flex; align-items: center; justify-content: space-between;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); box-sizing: border-box;
}

.bottom-player .close-player-btn { display: none; }

.bottom-player:not(.expanded) .now-playing { width: 30%; cursor: pointer; transition: 0.2s; }
.bottom-player:not(.expanded) .now-playing:hover { filter: brightness(1.2); }
.bottom-player:not(.expanded) .player-controls { width: 40%; justify-content: center; }
.bottom-player:not(.expanded) .volume-controls { width: 30%; justify-content: flex-end; }

.now-playing { display: flex; align-items: center; gap: 15px; }
.now-playing img { width: 56px; height: 56px; border: 1px solid var(--black); object-fit: cover; }
.track-info h4 { color: white; font-size: 14px; font-family: 'Share Tech Mono', monospace !important; text-transform: none; letter-spacing: 0; }
.track-info p { font-size: 12px; color: var(--Green-3); }
.favorite-btn { font-size: 20px; cursor: pointer; color: var(--black); transition: 0.2s; }
.favorite-btn:hover { color: var(--yellow); }

.player-controls { display: flex; flex-direction: column; align-items: center; }
.control-buttons { display: flex; align-items: center; gap: 20px; }
.control-buttons i { font-size: 24px; color: var(--black); cursor: pointer; transition: 0.2s;}
.control-buttons i:hover { color: var(--yellow); }

.play-pause-btn {
    width: 40px; height: 40px; background: var(--black);
    clip-path: polygon(25% 0%, 75% 0%, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0% 75%, 0% 25%);
    display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s;
    border: 1px solid var(--Green-1);
}
.play-pause-btn:hover { border-color: var(--yellow); }
.play-pause-btn i { color: var(--yellow); font-size: 24px; }

.progress-container { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; }
.progress-container span { font-size: 12px; color: var(--black); font-weight: bold;}

input[type=range] {
    -webkit-appearance: none; width: 100%; height: 4px;
    background: rgba(0,0,0,0.5); cursor: pointer; border-radius: 0;
}
input[type=range]::-webkit-slider-runnable-track { background: var(--yellow); height: 4px; }
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 8px; height: 16px;
    background: var(--black); border: 1px solid var(--yellow); display: none; margin-top: -6px;
}
input[type=range]:hover::-webkit-slider-thumb { display: block; }

.volume-controls { display: flex; align-items: center; gap: 10px; }
.volume-controls i { font-size: 24px; color: var(--black); }
.volume-controls input { width: 100px; }

/* Expanded Player Mode */
.bottom-player.expanded {
    height: 100vh !important; height: 100dvh !important; flex-direction: column; justify-content: center;
    padding: 40px 5% 80px 5% !important;
    background: linear-gradient(180deg, var(--player-bg) 0%, var(--black) 100%) !important;
}
.bottom-player.expanded .close-player-btn { display: block !important; position: absolute; top: 30px; right: 40px; font-size: 48px; color: var(--Green-2); cursor: pointer; }
.bottom-player.expanded .close-player-btn:hover { color: var(--yellow); }
.bottom-player.expanded .now-playing { flex-direction: column; width: 100%; text-align: center; margin-bottom: 50px; cursor: default; }
.bottom-player.expanded .now-playing img { width: 100%; max-width: 400px; height: auto; aspect-ratio: 1/1; border: 2px solid var(--black); margin-bottom: 40px; box-shadow: 0 25px 50px rgba(0,0,0,0.8); }
.bottom-player.expanded .now-playing .track-info h4 { font-size: 32px; margin-bottom: 10px; }
.bottom-player.expanded .now-playing .track-info p { font-size: 18px; color: var(--Green-3); }
.bottom-player.expanded .action-icons-group { display: flex; justify-content: center; gap: 30px; margin-top: 25px; font-size: 30px; }
.bottom-player.expanded .player-controls { width: 100%; max-width: 600px; flex-direction: column; gap: 30px; }
.bottom-player.expanded .progress-container span { color: var(--Green-3); }
.bottom-player.expanded .control-buttons i { font-size: 32px; color: var(--Green-3); }
.bottom-player.expanded .control-buttons i:hover { color: var(--yellow); }
.bottom-player.expanded .play-pause-btn { width: 75px; height: 75px; }
.bottom-player.expanded .play-pause-btn i { font-size: 40px; }
.bottom-player.expanded .volume-controls { position: absolute; bottom: 50px; right: 50px; width: 200px; }
.bottom-player.expanded .volume-controls i { color: var(--Green-3); }

/* ==========================================
   SCROLLBARS (Industrial Look)
   ========================================== */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--black); border-left: 1px solid var(--Green-1); }
::-webkit-scrollbar-thumb { background: var(--Green-1); border: 2px solid var(--black); }
::-webkit-scrollbar-thumb:hover { background: var(--yellow); }

.mobile-bottom-nav {
    display: none;
}

.mobile-menu-toggle {
    display: none;
}

/* ==========================================
   MOBILE RESPONSIVENESS
   ========================================== */
@media (max-width: 768px) {
    .view-toggle-group { margin-left: 0; width: auto; }
    .music-list .music-card p { display: none; }
    .filter-control-bar form { flex-direction: column; gap: 15px; }
    .filter-group { width: 100%; box-sizing: border-box; }
    .filter-group select { width: 100%; }

    body, html { overflow-x: hidden; }

    .app-container { width: 97%; margin: 0 auto; position: relative; }

    .sidebar {
        position: fixed; left: -260px; top: 0; height: 100vh; width: 250px; z-index: 6000;
        transition: left 0.3s ease-in-out; display: flex !important; box-shadow: 5px 0 25px rgba(0,0,0,0.9);
    }
    .sidebar.active { left: 0; }

    .topbar {
        width: 100% !important; box-sizing: border-box; height: 60px;
        padding: 0 15px; margin: 0 -15px 20px -15px; 
        position: sticky !important;
        top: 0 !important;
        margin: 0 -10px 20px -10px !important; /* Ensures it pulls tight to the edges */
    }
    .topbar .search-bar { max-width: 250px; }
    
    .main-content {
        margin-left: 0 !important; width: 100% !important; max-width: 100vw; box-sizing: border-box;
        padding-left: 10px !important; padding-right: 10px !important; padding-bottom: 90px !important; 
        padding-top: 0 !important; /* This removes the black gap above the topbar */
    }
    
    .shortcut-grid, .dashboard-grid { grid-template-columns: 1fr; }

    /* Mobile Player adjustments */
    .bottom-player {
        height: 75px; padding: 0 15px !important;
        background: var(--player-bg) !important;
    }
    .bottom-player:not(.expanded) .now-playing { width: 65%; }
    .bottom-player:not(.expanded) .player-controls { width: auto; justify-content: flex-end; }
    .bottom-player:not(.expanded) .volume-controls, .bottom-player:not(.expanded) .progress-container { display: none !important; }
    .bottom-player.expanded .volume-controls { display: none !important; }
    .bottom-player.expanded .close-player-btn { top: 20px; right: 20px; font-size: 42px; }
    .bottom-player.expanded .now-playing img { max-width: 300px; }
    .bottom-player.expanded .now-playing .track-info h4 { font-size: 26px; }
    
    /* Hide specific controls on mobile */
    .mobile-menu-toggle { display: block !important; position: relative; z-index: 5000; color: var(--yellow); }
    .mobile-bottom-nav {
        display: flex; position: fixed; bottom: 0; left: 0; width: 100%; height: 65px;
        background: var(--black); border-top: 1px solid var(--Green-1); justify-content: space-around;
        align-items: center; z-index: 4500; padding-bottom: env(safe-area-inset-bottom);
    }
}

/* 2. FIX THE BOTTOM NAVIGATION LINKS */
    .mobile-bottom-nav .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--Green-2);
        text-decoration: none;
        font-size: 11px;
        font-weight: 600;
        font-family: 'Rajdhani', sans-serif;
        text-transform: uppercase;
        letter-spacing: 1px;
        gap: 4px;
        width: 20%;
        transition: color 0.2s;
    }

    .mobile-bottom-nav .nav-item i {
        font-size: 20px;
    }

    .mobile-bottom-nav .nav-item:hover,
    .mobile-bottom-nav .nav-item.active {
        color: var(--yellow); /* Tactical Coyote Brown hover state */
    }
/* 3. ENSURE PLAYER SITS ABOVE NAV BAR */
    .bottom-player {
        bottom: 65px !important; 
    }
    .bottom-player.expanded {
        bottom: 0 !important; /* Allows full screen when opened */
    }
@media (max-width: 480px) {
    .username-display { display: none; }
    .topbar .search-bar { max-width: 220px; }
}

/* Guest Layout */
.app-container.guest-mode { display: block; }
.app-container.guest-mode .main-content {
    margin-left: 0 !important; width: 100% !important; max-width: 100%;
    margin: 0 auto; padding-top: 50px; padding-bottom: 20px !important; 
}