/* Twitter-like Left Sidebar Navigation */

/* Main Layout Adjustments */
body {
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

body.sidebar-open {
    margin-left: 280px;
}

/* Sidebar Container */
.sidebar-nav {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: rgba(16, 16, 16, 0.98);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 107, 53, 0.2);
    z-index: 9999;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding: 0;
}

.sidebar-nav.open {
    left: 0;
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 80px; /* Reserve space even when empty */
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-user-greeting {
    text-align: center;
}

.sidebar-user-greeting .welcome-text {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.sidebar-user-greeting .username-text {
    display: block;
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Old sidebar logo/brand styles removed - now using user greeting */

/* Navigation Menu */
.sidebar-menu {
    padding: 1rem 0;
    list-style: none;
    margin: 0;
}

.sidebar-menu-item {
    margin: 0;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    position: relative;
}

.sidebar-menu-link:hover {
    background: rgba(255, 107, 53, 0.1);
    color: var(--primary);
    transform: translateX(5px);
}

.sidebar-menu-link.active {
    background: rgba(255, 107, 53, 0.2);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.sidebar-menu-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
}

.sidebar-menu-icon {
    width: 24px;
    height: 24px;
    margin-right: 1rem;
    fill: currentColor;
    flex-shrink: 0;
}

.sidebar-menu-text {
    font-family: 'Exo 2', sans-serif;
    letter-spacing: 0.5px;
}

/* Authentication Section */
.sidebar-auth {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 107, 53, 0.1);
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--light);
    font-size: 1.1rem;
}

.sidebar-user-details {
    flex: 1;
}

.sidebar-username {
    font-weight: 600;
    color: var(--light);
    font-size: 0.9rem;
    margin: 0;
}

.sidebar-user-level {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.sidebar-auth-buttons {
    display: flex;
    gap: 0.5rem;
}

.sidebar-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: calc(var(--border-radius) - 2px);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-btn-primary {
    background: var(--gradient-primary);
    color: var(--light);
}

.sidebar-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
    color: var(--light);
    text-decoration: none;
}

.sidebar-btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.sidebar-btn-outline:hover {
    background: rgba(255, 107, 53, 0.1);
    color: var(--primary);
    text-decoration: none;
}

.sidebar-btn-logout {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.sidebar-btn-logout:hover {
    background: rgba(220, 53, 69, 0.3);
    color: #dc3545;
    text-decoration: none;
}

/* Server Status */
.sidebar-server-status {
    margin: 0.75rem 1rem;
    padding: 0.75rem;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: calc(var(--border-radius) - 2px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-status-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    animation: pulse 2s infinite;
}

.sidebar-status-text {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* REMOVED: Old standalone toggle button - now handled in header */

/* Hidden Menu Items */
.sidebar-menu-item.auth-required {
    display: none;
}

.sidebar-nav.authenticated .sidebar-menu-item.auth-required {
    display: block;
}

.sidebar-nav.authenticated .sidebar-menu-item.guest-only {
    display: none;
}

/* Hidden Auth Section Items */
.sidebar-auth .auth-required {
    display: none;
}

.sidebar-nav.authenticated .sidebar-auth .auth-required {
    display: block;
}

.sidebar-nav.authenticated .sidebar-auth .guest-only {
    display: none;
}

/* Header Styles - High Specificity to Override Bootstrap */
.navbar.fixed-top {
    z-index: 1040 !important;
    backdrop-filter: blur(20px) !important;
    background: rgba(26, 26, 26, 0.95) !important;
    border-bottom: 1px solid rgba(255, 107, 53, 0.3) !important;
    padding: 0 !important; /* Override Bootstrap padding */
}

.navbar.fixed-top .container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: 60px !important;
    position: relative !important;
    padding: 0 !important; /* Override Bootstrap container padding */
    max-width: none !important; /* Override Bootstrap max-width */
}

.navbar.fixed-top .container .header-left {
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    align-items: center !important;
    z-index: 10000 !important; /* Above sidebar (9999) */
    padding-left: 1rem !important;
    transition: all 0.3s ease !important; /* Add transition for smooth movement */
}

.navbar.fixed-top .container .header-center {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    display: flex !important;
    align-items: center !important;
    z-index: 5 !important;
}

.navbar.fixed-top .container .header-right {
    position: absolute !important;
    right: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    z-index: 10 !important;
    padding-right: 1rem !important;
}

/* Hide Bootstrap's default navbar-toggler */
.navbar-toggler {
    display: none !important;
}

.navbar.fixed-top .container .header-left .sidebar-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    background: none !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    margin: 0 !important;
    position: relative !important;
    cursor: pointer !important;
    color: var(--primary) !important;
    font-family: 'Orbitron', monospace !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    transition: all 0.3s ease !important;
    height: auto !important;
}

/* Move hamburger button to the right when sidebar is open */
body.sidebar-open .navbar.fixed-top .container .header-left {
    transform: translateX(280px) translateY(-50%) !important;
}

.sidebar-toggle:hover {
    color: var(--secondary);
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
}

.hamburger-icon span {
    display: block;
    background: currentColor;
    height: 3px;
    width: 100%;
    transition: 0.3s;
    border-radius: 2px;
}

.menu-text {
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    font-size: 0.875rem;
    color: currentColor;
}

/* REMOVED: Duplicate header-right definition - using absolute positioning above */

/* Main Content Adjustment */
.main-content {
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    padding-top: 60px; /* Space for fixed header */
}

.sidebar-nav.open ~ .main-content {
    margin-left: 280px;
}

/* Responsive Design */
@media (max-width: 768px) {
    body.sidebar-open {
        margin-left: 0;
    }
    
    .sidebar-nav {
        width: 100vw;
        left: -100vw;
    }
    
    .sidebar-nav.open {
        left: 0;
    }
    
    .sidebar-toggle.active {
        left: 1rem;
    }
    
    .sidebar-nav.open ~ .main-content {
        margin-left: 0;
    }
    
    /* Overlay for mobile */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* MOBILE HEADER FIXES - CRITICAL */
    .navbar.fixed-top {
        height: 60px !important;
        min-height: 60px !important;
    }
    
    .navbar.fixed-top .container {
        padding: 0 1rem !important;
        height: 60px !important;
        min-height: 60px !important;
        overflow: visible !important;
    }
    
    /* Mobile Header Layout - Stack elements properly */
    .navbar.fixed-top .container .header-left {
        position: static !important;
        transform: none !important;
        order: 1;
        flex: 0 0 auto;
        padding-left: 0 !important;
        z-index: 10000 !important;
    }
    
    .navbar.fixed-top .container .header-center {
        position: static !important;
        transform: none !important;
        order: 2;
        flex: 1 1 auto;
        text-align: center;
        padding: 0 1rem;
        z-index: 5 !important;
    }
    
    .navbar.fixed-top .container .header-right {
        position: static !important;
        transform: none !important;
        order: 3;
        flex: 0 0 auto;
        padding-right: 0 !important;
        z-index: 10 !important;
    }
    
    /* Flexbox layout for mobile header */
    .navbar.fixed-top .container {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
    }
    
    /* Mobile hamburger adjustments */
    .sidebar-toggle {
        padding: 0.5rem !important;
        min-height: 44px !important;
        min-width: 44px !important;
        gap: 0.25rem !important;
        font-size: 0.8rem !important;
    }
    
    .hamburger-icon {
        width: 20px !important;
        height: 16px !important;
    }
    
    .menu-text {
        font-size: 0.75rem !important;
        display: none; /* Hide text on mobile to save space */
    }
    
    /* Mobile brand adjustments */
    .navbar-brand {
        font-size: 1.2rem !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Mobile server status adjustments */
    .header-right {
        gap: 0.5rem !important;
        font-size: 0.85rem !important;
    }
    
    .header-right .btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
        min-height: 36px !important;
    }
    
    /* Override absolute positioning on mobile */
    body.sidebar-open .navbar.fixed-top .container .header-left {
        transform: none !important; /* Don't slide on mobile */
    }
}

@media (max-width: 480px) {
    .sidebar-header {
        padding: 1rem;
    }
    
    .sidebar-menu-link {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
    
    .sidebar-auth {
        padding: 0.75rem;
    }
    
    /* Ultra-mobile optimizations */
    .sidebar-nav .nav-link {
        padding: 1.25rem 1.5rem !important;
        font-size: 1.1rem;
        min-height: 52px;
    }
    
    .sidebar-nav .nav-icon {
        width: 26px !important;
        height: 26px !important;
        margin-right: 1.25rem !important;
    }
    
    .sidebar-toggle {
        padding: 1rem 1.25rem !important;
        min-height: 52px !important;
        min-width: 52px !important;
    }
    
    .hamburger-icon {
        font-size: 1.4rem !important;
    }
    
    .menu-text {
        font-size: 1rem !important;
        font-weight: 600 !important;
    }
    
    /* ULTRA-MOBILE HEADER FIXES */
    .navbar.fixed-top .container {
        padding: 0 0.5rem !important;
    }
    
    .navbar-brand {
        font-size: 1rem !important;
    }
    
    .sidebar-toggle {
        padding: 0.25rem !important;
        min-height: 40px !important;
        min-width: 40px !important;
    }
    
    .hamburger-icon {
        width: 18px !important;
        height: 14px !important;
    }
    
    .header-right {
        gap: 0.25rem !important;
        font-size: 0.75rem !important;
    }
    
    .header-right .btn {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.7rem !important;
        min-height: 32px !important;
    }
    
    /* Stack header elements vertically on very small screens if needed */
    .navbar.fixed-top .container .header-center {
        padding: 0 0.5rem !important;
    }
}

/* Animations */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.sidebar-menu-item {
    animation: slideInLeft 0.3s ease forwards;
}

.sidebar-menu-item:nth-child(1) { animation-delay: 0.1s; }
.sidebar-menu-item:nth-child(2) { animation-delay: 0.15s; }
.sidebar-menu-item:nth-child(3) { animation-delay: 0.2s; }
.sidebar-menu-item:nth-child(4) { animation-delay: 0.25s; }
.sidebar-menu-item:nth-child(5) { animation-delay: 0.3s; }
.sidebar-menu-item:nth-child(6) { animation-delay: 0.35s; }
.sidebar-menu-item:nth-child(7) { animation-delay: 0.4s; }
.sidebar-menu-item:nth-child(8) { animation-delay: 0.45s; }

/* Scrollbar Styling */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.3);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.5);
}
