/* ================================================
   SIDEBAR.CSS
   Sidebar navigation component (themeable)
   ================================================ */

/* Sidebar Container */
.sidebar {
    position: fixed;
    left: 20px;
    top: 20px;
    width: 240px;
    height: calc(100vh - 40px);
    padding: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    font-family: Paragraph, 'Segoe UI', sans-serif;
    overflow: visible;
}

.sidebar-content {
    flex: 1;
    overflow: visible;
    padding-top: 1.5rem;
}

/* Custom scrollbar for sidebar */
.sidebar-content::-webkit-scrollbar {
    width: 4px;
}

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

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(var(--theme-primary-rgb), 0.4);
    border-radius: 2px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--theme-primary-rgb), 0.6);
}

/* Firefox scrollbar */
.sidebar-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--theme-primary-rgb), 0.4) transparent;
}

/* Navigation List */
.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav > li {
    margin-bottom: 0;
}

/* Navigation Links */
.sidebar-nav a, .sidebar-nav .nav-item {
    display: block;
    color: var(--theme-text);
    text-decoration: none;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    font-size: 14px;
    border: 1px solid rgba(var(--theme-primary-rgb), 0.3);
    background: rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    transition: color 0.3s ease, border-color 0.3s ease, text-shadow 0.3s ease;
    text-transform: uppercase;
    width: 100%;
    box-sizing: border-box;
    margin-top: -1px;
    text-shadow: 2px 2px 4px rgba(var(--theme-primary-rgb), 0.5);
}

/* Expanding hover effect from center */
.sidebar-nav a::before, .sidebar-nav .nav-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 100%;
    background: rgba(var(--theme-primary-rgb), 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease;
    z-index: -1;
}

.sidebar-nav a:hover, .sidebar-nav .nav-item:hover {
    color: var(--theme-primary);
    border-color: rgba(var(--theme-primary-rgb), 0.8);
    text-shadow: 0 0 8px rgba(var(--theme-primary-rgb), 0.8);
}

.sidebar-nav a:hover::before, .sidebar-nav .nav-item:hover::before {
    width: 100%;
}

.sidebar-nav a.active {
    color: var(--theme-primary);
    border-color: rgba(var(--theme-primary-rgb), 0.6);
    background: rgba(var(--theme-primary-rgb), 0.15);
}

/* Root Directory */
.nav-root {
    color: var(--theme-primary);
    font-weight: bold;
    margin-bottom: 0;
    font-size: 15px;
    padding: 0.35rem 0.6rem;
    border: 1px solid rgba(var(--theme-primary-rgb), 0.5);
    background: rgba(var(--theme-primary-rgb), 0.15);
    text-shadow: 0 0 8px rgba(var(--theme-primary-rgb), 0.6);
    text-transform: uppercase;
    width: 100%;
    box-sizing: border-box;
}

/* Parent Items with Submenus - Flyout Style */
.has-submenu {
    position: relative;
    margin-bottom: 0;
}

/* Submenu parents keep their borders with flyout style */

/* Arrow indicator for items with submenus */
.has-submenu > a::after,
.has-submenu > .nav-item::after {
    content: '›';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--theme-secondary);
    transition: transform 0.2s ease, color 0.2s ease;
}

.has-submenu:hover > a::after,
.has-submenu:hover > .nav-item::after {
    color: var(--theme-primary);
    transform: translateY(-50%) translateX(3px);
}

/* Submenu Styles - Flyout */
.nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    position: absolute;
    left: calc(100% + 5px);
    top: 0;
    min-width: 180px;
    background: transparent;
    border: none;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 1000;
}

/* Hover bridge - invisible area to maintain hover when moving to submenu */
.nav-submenu::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 0;
    width: 10px;
    height: 100%;
}

.has-submenu:hover > .nav-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nav-submenu li {
    margin-bottom: 0;
}

/* Submenu links match main nav style */
.nav-submenu a {
    font-size: 13px;
    padding: 0.35rem 0.6rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.3);
    margin-top: -1px;
}

.nav-submenu li:first-child a {
    margin-top: 0;
}

/* No prefix icons on submenu items */
.nav-submenu a::before {
    content: none;
}

/* Locked Section Indicators - uses a separate span since ::after is used for arrow */
.nav-lock-indicator {
    font-size: 10px;
    opacity: 0.8;
    color: var(--theme-accent);
    margin-left: 0.3rem;
}

/* Sidebar Footer - scales down when zoomed in using clamp() */
.sidebar-footer {
    padding: clamp(0.4rem, 0.8vw, 1rem) clamp(0.5rem, 0.9vw, 1rem);
    border-top: 1px solid rgba(var(--theme-primary-rgb), 0.3);
    background: rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.sidebar-footer-title {
    font-size: clamp(9px, 1.1vw, 14px);
    color: var(--theme-primary);
    font-weight: bold;
    margin-bottom: clamp(0.3rem, 0.5vw, 0.75rem);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(var(--theme-primary-rgb), 0.6);
}

.sidebar-footer-links {
    display: flex;
    flex-direction: column;
    gap: clamp(0.15rem, 0.3vw, 0.4rem);
    margin-bottom: clamp(0.4rem, 0.7vw, 1rem);
}

.sidebar-footer-links p {
    margin: 0;
    font-size: clamp(9px, 1vw, 13px);
    color: var(--theme-text);
}

.sidebar-footer-links a {
    color: var(--theme-secondary);
    text-decoration: none;
    font-size: clamp(8px, 0.9vw, 12px);
    transition: all 0.3s ease;
    padding: clamp(0.1rem, 0.15vw, 0.2rem) 0;
}

.sidebar-footer-links a:hover {
    color: var(--theme-primary);
    text-shadow: 0 0 5px rgba(var(--theme-primary-rgb), 0.5);
    padding-left: 5px;
}

.sidebar-footer-made {
    font-size: clamp(8px, 0.95vw, 13px);
    color: var(--theme-text);
    margin-top: clamp(0.3rem, 0.4vw, 0.5rem);
    text-align: center;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(var(--theme-primary-rgb), 0.6);
}

/* Sidebar Close Button (Mobile Only) */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.5);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: var(--theme-primary);
    font-size: 20px;
    line-height: 1;
    border-radius: 0;
    z-index: 101;
}

.sidebar-close-btn:hover {
    background: rgba(var(--theme-primary-rgb), 0.2);
    border-color: var(--theme-primary);
}

/* Main Content Adjustment */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    position: relative;
    z-index: 10;
}

/* No Sidebar Mode */
body.no-sidebar .main-content {
    margin-left: 0;
}

/* Password Modal for Private Section */
.password-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.password-modal.active {
    display: flex;
}

.modal-content {
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid rgba(var(--theme-primary-rgb), 0.5);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    font-family: Paragraph, 'Segoe UI', sans-serif;
    box-shadow: 0 0 20px rgba(var(--theme-primary-rgb), 0.3);
}

.modal-content h3 {
    margin-top: 0;
    color: var(--theme-primary);
    font-size: 18px;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 8px rgba(var(--theme-primary-rgb), 0.6);
}

.modal-content p {
    color: var(--theme-text);
    text-shadow: 2px 2px 4px rgba(var(--theme-primary-rgb), 0.5);
}

.modal-content input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.4);
    color: var(--theme-primary);
    font-family: Paragraph, 'Segoe UI', sans-serif;
    font-size: 16px;
    margin-bottom: 1rem;
    box-sizing: border-box;
    text-shadow: 2px 2px 4px rgba(var(--theme-primary-rgb), 0.5);
}

.modal-content input:focus {
    outline: none;
    border-color: var(--theme-primary);
    box-shadow: 0 0 10px rgba(var(--theme-primary-rgb), 0.4);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
}

.modal-buttons button {
    flex: 1;
    padding: 0.75rem;
    background: rgba(var(--theme-primary-rgb), 0.1);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.4);
    color: var(--theme-text);
    font-family: Paragraph, 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-shadow: 2px 2px 4px rgba(var(--theme-primary-rgb), 0.5);
}

.modal-buttons button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 100%;
    background: rgba(var(--theme-primary-rgb), 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease;
    z-index: -1;
}

.modal-buttons button:hover {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
    text-shadow: 0 0 8px rgba(var(--theme-primary-rgb), 0.8);
}

.modal-buttons button:hover::before {
    width: 100%;
}

.error-message {
    color: #ff5555;
    font-size: 14px;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    display: none;
    text-shadow: 2px 2px 6px rgba(255, 85, 85, 0.8);
    animation: blink 0.5s ease-in-out infinite;
}

.error-message.active {
    display: block;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        transition: left 0.3s ease;
        background: rgba(0, 0, 0, 0.95);
        border-right: 1px solid rgba(var(--theme-primary-rgb), 0.3);
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .sidebar-close-btn {
        display: block;
    }
    
    .sidebar-content {
        padding-top: 60px;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    /* Mobile flyout submenu - appears next to sidebar */
    .nav-submenu {
        left: calc(100% + 5px);
        min-width: 140px;
        max-width: calc(100vw - 295px);
    }
    
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        z-index: 99;
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
}

/* Swipe hint popup */
.swipe-hint {
    display: none;
}

@media (max-width: 768px) {
    .swipe-hint {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        position: fixed;
        bottom: 25px;
        left: 50%;
        transform: translateX(-50%) translateY(100px);
        background: rgba(0, 0, 0, 0.92);
        color: var(--theme-text);
        padding: 0.85rem 1.25rem;
        font-size: 12px;
        font-family: 'Courier New', monospace;
        z-index: 9000;
        pointer-events: none;
        white-space: nowrap;
        opacity: 0;
        border: 1px solid rgba(var(--theme-primary-rgb), 0.5);
        box-shadow: 
            0 4px 20px rgba(0, 0, 0, 0.5),
            0 0 15px rgba(var(--theme-primary-rgb), 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
    
    .swipe-hint::before {
        content: '☰';
        font-size: 14px;
        color: var(--theme-primary);
    }

    .swipe-hint.show {
        animation: swipeHintIn 5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    @keyframes swipeHintIn {
        0% { 
            opacity: 0; 
            transform: translateX(-50%) translateY(100px) scale(0.8);
        }
        12% { 
            opacity: 1; 
            transform: translateX(-50%) translateY(0) scale(1);
        }
        88% { 
            opacity: 1; 
            transform: translateX(-50%) translateY(0) scale(1);
        }
        100% { 
            opacity: 0; 
            transform: translateX(-50%) translateY(20px) scale(0.95);
        }
    }
}

