/* ============================================
   Modern Professional Sidebar Styles
   Mobile-First Responsive Design
   ============================================ */

.sidebar {
    background: linear-gradient(180deg, #1e3a5f 0%, #2d4a6e 50%, #1a2f4a 100%);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    width: 100%;
    z-index: 1000;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    z-index: 1;
}

.top-row.navbar {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.25rem;
    min-height: 70px;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.navbar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff !important;
    text-decoration: none;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.navbar-brand::before {
    content: '🍪';
    font-size: 1.4rem;
}

.navbar-brand:hover {
    color: #4facfe !important;
    transition: color 0.3s ease;
}

.navbar-toggler {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem;
    transition: all 0.3s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.navbar-toggler:active {
    transform: scale(0.95);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    width: 24px;
    height: 24px;
}

.nav-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 2;
}

.nav-scrollable::-webkit-scrollbar {
    width: 6px;
}

.nav-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.nav-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.nav-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.nav-scrollable nav {
    padding: 0 1rem;
    position: relative;
    z-index: 2;
}

.nav-item {
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 2;
}

.nav-item ::deep .nav-link {
    color: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    text-decoration: none;
    margin-bottom: 0.25rem;
    min-height: 44px;
    z-index: 2;
    background: transparent;
    white-space: nowrap;
}

.nav-item ::deep .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: linear-gradient(180deg, #4facfe 0%, #00f2fe 100%);
    transform: scaleY(0);
    transition: transform 0.3s ease;
    border-radius: 0 4px 4px 0;
    z-index: -1;
}

.nav-item ::deep .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav-item ::deep .nav-link:hover::before {
    transform: scaleY(1);
}

.nav-item ::deep .nav-link.active {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.2) 0%, rgba(0, 242, 254, 0.2) 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(79, 172, 254, 0.3);
    border: 1px solid rgba(79, 172, 254, 0.3);
}

.nav-item ::deep .nav-link.active::before {
    transform: scaleY(1);
}

.nav-item ::deep .nav-link span {
    font-size: 1.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.nav-item ::deep .nav-link:hover span {
    transform: scale(1.15);
}

.nav-item ::deep .nav-link.active span {
    transform: scale(1.1);
}

/* ===== Mobile Styles ===== */
@media (max-width: 640.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        max-width: 85vw;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
        visibility: visible;
        opacity: 1;
    }
    
    .sidebar.show {
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .sidebar.show .nav-scrollable {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .sidebar.show .nav-scrollable nav {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .sidebar.show .nav-item {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .sidebar.show .nav-item ::deep .nav-link {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        color: rgba(255, 255, 255, 0.95) !important;
    }
    
    .navbar-toggler {
        display: flex !important;
    }
    
    .nav-scrollable {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
        z-index: 10 !important;
        height: auto !important;
        max-height: calc(100vh - 70px) !important;
    }
    
    .nav-scrollable.collapse {
        display: none !important;
    }
    
    .nav-scrollable.collapse.show {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
        z-index: 10 !important;
    }

    .nav-scrollable nav {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
        z-index: 10 !important;
    }

    .nav-item {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
        z-index: 10 !important;
        margin-bottom: 0.5rem !important;
    }

    .nav-item ::deep .nav-link {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        color: rgba(255, 255, 255, 0.95) !important;
        background: transparent !important;
        position: relative !important;
        z-index: 10 !important;
    }

    .nav-item ::deep .nav-link span {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        color: rgba(255, 255, 255, 0.95) !important;
        z-index: 11 !important;
    }

    .nav-item ::deep .nav-link span:last-child {
        display: inline !important;
        opacity: 1 !important;
        visibility: visible !important;
        color: rgba(255, 255, 255, 0.95) !important;
    }

    .top-row.navbar {
        min-height: 60px;
        padding: 0.75rem 1rem;
        z-index: 1051;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    .nav-item ::deep .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* ===== Desktop Styles ===== */
@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 280px;
        height: 100vh;
        position: sticky;
        top: 0;
        display: block !important;
        transform: none !important;
        flex-shrink: 0;
    }
    
    .sidebar .nav-scrollable {
        display: block !important;
    }
    
    .navbar-toggler {
        display: none !important;
    }
}

/* ===== Sidebar Overlay (Mobile Only) ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1049;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    display: none;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
    display: block;
}

@media (min-width: 641px) {
    .sidebar-overlay {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

/* ===== Loading Animation ===== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.nav-item {
    animation: slideIn 0.3s ease forwards;
}

.nav-item:nth-child(1) { animation-delay: 0.05s; }
.nav-item:nth-child(2) { animation-delay: 0.1s; }
.nav-item:nth-child(3) { animation-delay: 0.15s; }
.nav-item:nth-child(4) { animation-delay: 0.2s; }
.nav-item:nth-child(5) { animation-delay: 0.25s; }

/* ===== Collapse Animation ===== */
.collapse {
    display: none;
}

.collapse.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
