/* ============================================
   DIPCATCHER - SIDEBAR NAVIGATION (WHITE THEME)
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

body.sidebar-collapsed .sidebar {
    width: 80px;
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-blue);
    white-space: nowrap;
}

body.sidebar-collapsed .sidebar-logo {
    font-size: 1.2rem;
}

.sidebar-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

/* Nav Item */
.nav-item {
    margin: 0.25rem 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
    font-size: 12px;
}

.nav-link:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-blue);
    color: white;
}

.nav-link i {
    width: 20px;
    margin-right: 0.75rem;
    text-align: center;
}

body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem;
}

body.sidebar-collapsed .nav-link i {
    margin-right: 0;
}

body.sidebar-collapsed .nav-text {
    display: none;
}

body.sidebar-collapsed .nav-arrow {
    display: none;
}

/* Collapsible Sections */
.nav-section {
    margin: 0.25rem 0.75rem;
}

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 12px;
}

.nav-section-header:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-section-title {
    display: flex;
    align-items: center;
}

.nav-section-title i {
    width: 20px;
    margin-right: 0.75rem;
    text-align: center;
}

.nav-arrow {
    transition: transform 0.2s ease;
    font-size: 0.8rem;
}

.nav-section.expanded .nav-arrow {
    transform: rotate(90deg);
}

.nav-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-section.expanded .nav-section-content {
    max-height: 500px;
}

.nav-section-content .nav-link {
    padding-left: 3rem;
    font-size: 12px;
}

body.sidebar-collapsed .nav-section-content .nav-link {
    padding-left: 0.75rem;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid var(--border-light);
    padding: 1rem 0.75rem;
}

.tier-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tier-badge.BRONZE {
    background: linear-gradient(135deg, #cd7f32 0%, #b8722c 100%);
    color: white;
}

.tier-badge.SILVER {
    background: linear-gradient(135deg, #c0c0c0 0%, #a8a8a8 100%);
    color: white;
}

.tier-badge.GOLD {
    background: linear-gradient(135deg, #ffd700 0%, #f0c800 100%);
    color: #1e293b;
}

.tier-badge.PLATINUM {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

body.sidebar-collapsed .tier-badge {
    padding: 0.75rem 0.5rem;
    font-size: 0.7rem;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: var(--accent-red);
    color: white;
    border-color: var(--accent-red);
}

.logout-btn i {
    margin-right: 0.5rem;
}

body.sidebar-collapsed .logout-btn i {
    margin-right: 0;
}

body.sidebar-collapsed .logout-text {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }

    .mobile-menu-btn {
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 999;
        background: var(--accent-blue);
        color: white;
        border: none;
        border-radius: 8px;
        padding: 0.75rem 1rem;
        cursor: pointer;
    }
}

/* Scrollbar Styles */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}


/* ============================================
   MOBILE SIDEBAR ENHANCEMENTS
   ============================================ */

/* Mobile overlay when sidebar is open */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

body.sidebar-open .sidebar-overlay {
    display: block;
}

/* Mobile hamburger for sidebar pages */
.sidebar-mobile-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 998;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.sidebar-mobile-toggle:active {
    transform: scale(0.95);
}

/* Mobile Responsive - Enhanced */
@media (max-width: 992px) {
    .sidebar-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 1001;
        transition: transform 0.3s ease;
    }
    
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    
    /* Main content adjustment */
    .main-content,
    .content-area,
    .page-content {
        margin-left: 0 !important;
        padding-left: 15px !important;
        padding-top: 70px !important;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        max-width: 300px;
    }
    
    .sidebar-header {
        padding: 1rem;
    }
    
    .nav-link,
    .nav-section-header {
        padding: 1rem;
        font-size: 14px;
    }
    
    .nav-section-content .nav-link {
        padding-left: 2.5rem;
    }
    
    /* Larger touch targets */
    .tier-badge,
    .logout-btn {
        padding: 1rem;
        min-height: 50px;
    }
}

/* Touch-friendly enhancements */
@media (pointer: coarse) {
    .nav-link,
    .nav-section-header,
    .logout-btn {
        min-height: 48px;
        display: flex;
        align-items: center;
    }
}


/* Logo colors - dark on white background */
.sidebar-logo-text {
    color: #1e293b !important;
}

.sidebar-logo-text span {
    color: #1e293b !important;
}

.sidebar-header .sidebar-logo span {
    color: #1e293b !important;
}


/* ============================================
   MOBILE LAYOUT FIXES FOR SIDEBAR PAGES
   ============================================ */

/* Mobile header bar for sidebar pages */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    z-index: 100;
    padding: 0 15px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.mobile-header-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 900;
    color: #1e293b;
    letter-spacing: 2px;
}

.mobile-header-toggle {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 1.2rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile Responsive for Sidebar Pages */
@media (max-width: 992px) {
    /* Show mobile header */
    .mobile-header {
        display: flex !important;
    }
    
    /* Hide desktop sidebar by default */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
        background: #fff;
    }
    
    /* Show sidebar when open */
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    
    /* Sidebar overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }
    
    body.sidebar-open .sidebar-overlay {
        display: block;
    }
    
    /* Main content adjustments */
    .main-content {
        margin-left: 0 !important;
        padding-top: 75px !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    /* Hide the sidebar toggle inside sidebar on mobile */
    .sidebar-toggle {
        display: none !important;
    }
    
    /* Add close button inside sidebar for mobile */
    .sidebar-close-mobile {
        display: block !important;
        position: absolute;
        top: 15px;
        right: 15px;
        background: transparent;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: 8px 12px;
        cursor: pointer;
        color: #64748b;
        z-index: 10;
    }
    
    .sidebar-close-mobile:hover {
        background: #f1f5f9;
        color: #ef4444;
    }
}

@media (min-width: 993px) {
    .mobile-header {
        display: none !important;
    }
    
    .sidebar-close-mobile {
        display: none !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}


/* ============================================
   CLEAN MOBILE LAYOUT - NO DUPLICATES
   ============================================ */

@media (max-width: 992px) {
    /* Hide the sidebar completely on mobile by default */
    .sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease !important;
        z-index: 1001 !important;
        background: #fff !important;
    }
    
    body.sidebar-open .sidebar {
        transform: translateX(0) !important;
    }
    
    /* Hide sidebar header text on mobile (logo/tagline already in mobile header) */
    .sidebar-header .sidebar-logo {
        display: none !important;
    }
    
    /* Keep sidebar toggle visible as close button */
    .sidebar-header {
        justify-content: flex-end !important;
        padding: 15px !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }
    
    .sidebar-header .sidebar-toggle {
        display: flex !important;
    }
    
    /* Mobile header - clean single header */
    .mobile-header {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 60px !important;
        background: #fff !important;
        border-bottom: 1px solid #e2e8f0 !important;
        z-index: 100 !important;
        padding: 0 15px !important;
        align-items: center !important;
        justify-content: space-between !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important;
    }
    
    /* Main content - proper spacing */
    .main-content {
        margin-left: 0 !important;
        padding-top: 75px !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        min-height: 100vh;
    }
    
    /* Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }
    
    body.sidebar-open .sidebar-overlay {
        display: block !important;
    }
    
    /* Hide any duplicate mobile menu elements from index styling */
    .mobile-menu-toggle,
    .mobile-menu,
    .mobile-menu-overlay {
        display: none !important;
    }
}

/* Desktop - hide mobile header */
@media (min-width: 993px) {
    .mobile-header {
        display: none !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}


/* ============================================
   ENHANCED MOBILE STYLING
   ============================================ */

/* Sidebar full overlay on mobile */
@media (max-width: 992px) {
    .sidebar {
        width: 85vw !important;
        max-width: 320px !important;
        box-shadow: 5px 0 30px rgba(0,0,0,0.3) !important;
    }
    
    /* Darker overlay to hide content */
    .sidebar-overlay {
        background: rgba(0, 0, 0, 0.7) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        backdrop-filter: blur(4px) !important;
    }
}

/* Enhanced color scheme - better contrast */
:root {
    --primary-blue: #667eea;
    --primary-purple: #764ba2;
    --accent-green: #00d4aa;
    --text-dark: #1e293b;
    --text-medium: #475569;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --border-accent: rgba(102, 126, 234, 0.3);
    --bg-card: #ffffff;
    --bg-page: #f8fafc;
    --shadow-card: 0 4px 20px rgba(0,0,0,0.08);
}

/* Card styling with accent borders */
.card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-left: 4px solid var(--primary-blue) !important;
    border-radius: 12px !important;
    box-shadow: var(--shadow-card) !important;
}

/* Page titles */
.page-title,
.card-title {
    color: var(--text-dark) !important;
    font-weight: 700 !important;
}

/* Active nav item */
.nav-link.active {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple)) !important;
    color: white !important;
    border-radius: 10px !important;
}

/* Nav section headers */
.nav-section-header {
    color: var(--text-medium) !important;
    font-weight: 600 !important;
}

/* Tier badges with gradients */
.tier-badge {
    border-radius: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 1px !important;
}

/* Mobile header styling */
.mobile-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    border-bottom: 2px solid var(--border-accent) !important;
}

/* Main content background */
.main-content {
    background: var(--bg-page) !important;
}

/* Better button styling */
.btn-primary,
button[style*="background:#667eea"] {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple)) !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
}

.btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}
