/* ========================================
   FundLedger — Premium Aurora Sidebar
   ======================================== */

/* --- Mobile overlay --- */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 37, 64, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mobile-overlay.open {
    display: block;
    opacity: 1;
}

/* --- Mobile drawer --- */
.mobile-drawer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: #FFFFFF;
    z-index: 100;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 32px rgba(0,0,0,0.15);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.mobile-drawer.open {
    transform: translateX(0);
}

@media (max-width: 767px) {
    .mobile-drawer {
        display: flex;
    }
    .mobile-overlay {
        display: none;
    }
    .mobile-overlay.open {
        display: block;
    }
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #E8E8FC;
}
.mobile-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: #6B7C93;
    transition: all 0.15s;
    border: none;
    background: transparent;
    cursor: pointer;
}
.mobile-drawer-close:hover {
    background: #F5F6FF;
    color: #0A2540;
}

/* Mobile nav groups */
.mobile-drawer-nav {
    flex: 1;
    padding: 12px 0;
}
.mobile-nav-group {
    margin-bottom: 4px;
}
.mobile-nav-group-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #A3ACB9;
    padding: 12px 24px 6px;
}
.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    color: #0A2540;
    text-decoration: none;
    transition: all 0.15s;
    position: relative;
}
.mobile-nav-item:hover {
    background: #F5F6FF;
}
.mobile-nav-item:active {
    background: #E8E8FC;
}
.mobile-nav-item.active {
    color: #635BFF;
    background: rgba(99,91,255,0.06);
}
.mobile-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, #635BFF, #00D4FF);
}
.mobile-nav-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F5F6FF;
    flex-shrink: 0;
    transition: background 0.15s;
}
.mobile-nav-item.active .mobile-nav-item-icon {
    background: rgba(99,91,255,0.1);
}
.mobile-nav-item-icon svg {
    width: 18px;
    height: 18px;
    color: #6B7C93;
}
.mobile-nav-item.active .mobile-nav-item-icon svg {
    color: #635BFF;
}
.mobile-nav-active-icon {
    margin-left: auto;
    color: #635BFF;
    flex-shrink: 0;
}

/* Mobile drawer footer */
.mobile-drawer-footer {
    border-top: 1px solid #E8E8FC;
    padding: 16px 20px;
}
.mobile-drawer-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.mobile-drawer-signout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #DF1B41;
    text-decoration: none;
    transition: background 0.15s;
}
.mobile-drawer-signout:hover {
    background: rgba(223,27,65,0.05);
}

/* --- Desktop Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 72px;
    background: linear-gradient(180deg, #0B1D35 0%, #0A2540 40%, #0C1F3A 100%);
    border-right: 1px solid rgba(99,91,255,0.08);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.35s ease;
    z-index: 40;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg,
        rgba(99,91,255,0.2) 0%,
        rgba(0,212,255,0.1) 40%,
        rgba(99,91,255,0.15) 100%);
    z-index: 1;
}
.sidebar.expanded {
    width: 256px;
    box-shadow: 8px 0 32px rgba(0,0,0,0.2),
                2px 0 12px rgba(99,91,255,0.06);
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 0;
    min-height: 72px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: relative;
}
.sidebar-brand-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #635BFF 0%, #7A73FF 50%, #00D4FF 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin: 0 16px;
    box-shadow: 0 4px 16px rgba(99,91,255,0.35),
                inset 0 1px 0 rgba(255,255,255,0.2);
    transition: box-shadow 0.3s, transform 0.3s;
}
.sidebar-brand-icon svg {
    width: 20px;
    height: 20px;
}
.sidebar-brand:hover .sidebar-brand-icon {
    box-shadow: 0 6px 20px rgba(99,91,255,0.45),
                inset 0 1px 0 rgba(255,255,255,0.25);
    transform: scale(1.05);
}
.sidebar-brand-text {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 700;
    color: #FFFFFF;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.25s ease 0.05s;
    letter-spacing: -0.01em;
}
.sidebar.expanded .sidebar-brand-text {
    opacity: 1;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar {
    width: 3px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(99,91,255,0.2);
    border-radius: 4px;
}
.nav-section {
    margin-bottom: 8px;
}
.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    padding: 0 24px;
    margin-bottom: 6px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.25s ease 0.05s;
}
.sidebar.expanded .nav-section-label {
    opacity: 1;
}

/* Nav items */
.nav-item {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    margin: 2px 8px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 10px;
    overflow: hidden;
}
.nav-item:hover {
    color: rgba(255,255,255,0.95);
    background: rgba(255,255,255,0.06);
}
.nav-item.active {
    color: #FFFFFF;
    background: rgba(99,91,255,0.15);
}
.nav-item.active:hover {
    background: rgba(99,91,255,0.2);
}

/* Active indicator bar */
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    min-height: 20px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, #635BFF, #00D4FF);
    box-shadow: 0 0 8px rgba(99,91,255,0.4);
}

/* Icon container */
.nav-item-icon {
    flex-shrink: 0;
    width: 44px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s ease;
    position: relative;
}
.nav-item:hover .nav-item-icon {
    background: rgba(99,91,255,0.08);
}
.nav-item.active .nav-item-icon {
    background: rgba(99,91,255,0.1);
}
.nav-item-icon svg {
    width: 20px;
    height: 20px;
    opacity: 0.65;
    transition: all 0.2s ease;
}
.nav-item:hover .nav-item-icon svg {
    opacity: 1;
    color: #A5A0FF;
}
.nav-item.active .nav-item-icon svg {
    opacity: 1;
    color: #FFFFFF;
}

/* Label */
.nav-item-label {
    opacity: 0;
    flex: 1;
    transition: opacity 0.25s ease 0.05s;
    font-weight: 500;
    letter-spacing: -0.01em;
}
.sidebar.expanded .nav-item-label {
    opacity: 1;
}

/* Badge (optional, for "Home" etc) */
.nav-item-badge {
    display: none;
}

/* Collapsed tooltip */
.nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #1A2744;
    color: white;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid rgba(99,91,255,0.15);
    z-index: 100;
}
.sidebar:not(.expanded) .nav-item:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* User section */
.sidebar-user {
    padding: 12px 0;
    border-top: 1px solid rgba(255,255,255,0.06);
    position: relative;
}
.sidebar-user::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(99,91,255,0.2),
        transparent);
}
.sidebar-user-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-radius: 10px;
    margin: 0 8px;
    transition: background 0.2s;
    cursor: default;
}
.sidebar-user-inner:hover {
    background: rgba(255,255,255,0.04);
}
.user-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #635BFF 0%, #00D4FF 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(99,91,255,0.3);
}
.user-info {
    opacity: 0;
    transition: opacity 0.25s ease 0.05s;
    min-width: 0;
}
.sidebar.expanded .user-info {
    opacity: 1;
}
.user-info-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.user-info-role {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1.3;
}
.user-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #30B566;
    display: inline-block;
    box-shadow: 0 0 6px rgba(48,181,102,0.5);
}

/* Toggle */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    cursor: pointer;
    color: rgba(255,255,255,0.25);
    transition: all 0.2s;
    border-top: 1px solid rgba(255,255,255,0.06);
    position: relative;
}
.sidebar-toggle::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(99,91,255,0.15),
        transparent);
}
.sidebar-toggle:hover {
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.02);
}
.sidebar-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.expanded .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* --- Card animations --- */
@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.card-animate {
    opacity: 0;
    animation: card-enter 0.4s ease-out forwards;
}
.card-animate:nth-child(1) { animation-delay: 0ms; }
.card-animate:nth-child(2) { animation-delay: 80ms; }
.card-animate:nth-child(3) { animation-delay: 160ms; }
.card-animate:nth-child(4) { animation-delay: 240ms; }
.card-animate:nth-child(5) { animation-delay: 320ms; }
.card-animate:nth-child(6) { animation-delay: 400ms; }

/* --- Status pill pulse --- */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.8); }
}
.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 2s ease-in-out infinite;
}

/* --- Gradient text utility --- */
.gradient-text {
    background: linear-gradient(135deg, #635BFF, #00D4FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Card hover glow --- */
.card-glow {
    transition: all 0.25s;
}
.card-glow:hover {
    border-color: #D0CFF8;
    box-shadow: 0 0 20px rgba(99,91,255,0.08), 0 2px 8px rgba(99,91,255,0.06);
}

/* --- Login gradient background --- */
.auth-bg {
    background: linear-gradient(135deg, rgba(99,91,255,0.03) 0%, rgba(0,212,255,0.03) 50%, rgba(99,91,255,0.02) 100%);
}

/* --- Chart pulse dot --- */
@keyframes chart-pulse {
    0%, 100% { opacity: 0.3; r: 4; }
    50% { opacity: 0.1; r: 10; }
}

/* --- Form input error state --- */
.input-error {
    border-color: #DF1B41 !important;
    focus:ring-color: rgba(223,27,65,0.15) !important;
}

/* --- Message/notification toasts --- */
.toast {
    animation: card-enter 0.3s ease-out;
}
