/* Modern Sidebar - Fiacore 2025 */
/* Professional fintech sidebar with animations, grouping, and micro-interactions */

:root {
    /* Semantic Color System */
    --color-primary: #3b82f6;
    --color-primary-light: #60a5fa;
    --color-primary-dark: #2563eb;
    --color-income: #10B981;
    --color-income-light: #34D399;
    --color-expense: #F87171;
    --color-expense-light: #FCA5A5;
    --color-warning: #F59E0B;
    --color-warning-light: #FBBF24;
    --color-success: #10B981;
    --color-neutral: #6B7280;
    
    /* Sidebar Variables */
    --sidebar-width: 320px;
    --sidebar-bg: #ffffff;
    --sidebar-shadow: -8px 0 32px rgba(0, 0, 0, 0.08);
    --sidebar-transition: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --item-hover-bg: rgba(59, 130, 246, 0.08);
    --item-active-bg: rgba(59, 130, 246, 0.15);
    --section-header-color: #64748b;
    --item-text-color: #3b82f6;
    --border-radius: 12px;
}

/* ===== SIDEBAR CONTAINER ===== */
.right-sidebar {
    position: fixed;
    top: 60px;
    right: calc(-1 * var(--sidebar-width) - 20px);
    width: var(--sidebar-width);
    height: calc(100vh - 60px);
    background: var(--sidebar-bg);
    box-shadow: var(--sidebar-shadow);
    z-index: 1000;
    transition: right var(--sidebar-transition);
    overflow-y: auto;
    overflow-x: hidden;
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
}

.right-sidebar.active {
    right: 0;
}

/* Custom Scrollbar */
.right-sidebar::-webkit-scrollbar {
    width: 6px;
}

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

.right-sidebar::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.2);
    border-radius: 3px;
}

.right-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.4);
}

/* ===== SIDEBAR HEADER ===== */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.08);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.03) 0%, rgba(255, 255, 255, 1) 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1F2937;
    letter-spacing: -0.02em;
}

.sidebar-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--text-muted, #6B7280);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.sidebar-close-btn:hover {
    background: var(--bg-hover, #f3f4f6);
    color: var(--text-primary, #374151);
}

/* ===== SIDEBAR MENU ===== */
.sidebar-menu {
    padding: 12px 0 24px 0;
}

/* ===== SECTION GROUPS ===== */
.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px 8px 24px;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s ease;
}

.sidebar-section-header:hover {
    background: rgba(59, 130, 246, 0.02);
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--section-header-color);
    margin: 0;
}

.sidebar-section-chevron {
    font-size: 0.65rem;
    color: var(--section-header-color);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-section.collapsed .sidebar-section-chevron {
    transform: rotate(-90deg);
}

.sidebar-section-items {
    overflow: hidden;
    max-height: 1000px;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 1;
}

.sidebar-section.collapsed .sidebar-section-items {
    max-height: 0;
    opacity: 0;
}

/* ===== SIDEBAR ITEMS ===== */
.sidebar-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    margin: 2px 12px;
    color: var(--item-text-color, #3b82f6);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.sidebar-item span {
    color: var(--item-text-color, #3b82f6);
}

/* Staggered animation for menu items */
.sidebar-item {
    opacity: 0;
    transform: translateX(20px);
    animation: slideInItem 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.right-sidebar.active .sidebar-item:nth-child(1) { animation-delay: 0.05s; }
.right-sidebar.active .sidebar-item:nth-child(2) { animation-delay: 0.08s; }
.right-sidebar.active .sidebar-item:nth-child(3) { animation-delay: 0.11s; }
.right-sidebar.active .sidebar-item:nth-child(4) { animation-delay: 0.14s; }
.right-sidebar.active .sidebar-item:nth-child(5) { animation-delay: 0.17s; }
.right-sidebar.active .sidebar-item:nth-child(6) { animation-delay: 0.20s; }

@keyframes slideInItem {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Hover Effects */
.sidebar-item:hover {
    background: var(--item-hover-bg);
    color: var(--color-primary);
    transform: translateX(4px);
    text-decoration: none;
}

.sidebar-item:hover i {
    transform: scale(1.15);
}

/* Active State */
.sidebar-item.active {
    background: var(--item-active-bg);
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--color-primary);
    border-radius: 0 4px 4px 0;
}

/* Icon Styling */
.sidebar-item i {
    font-size: 1.05rem;
    margin-right: 14px;
    width: 22px;
    text-align: center;
    color: var(--color-primary);
    transition: all 0.25s ease;
    opacity: 0.85;
}

.sidebar-item:hover i,
.sidebar-item.active i {
    opacity: 1;
}

/* Text Styling */
.sidebar-item span {
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: -0.01em;
}

/* ===== SIDEBAR DIVIDER ===== */
.sidebar-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.15), transparent);
    margin: 16px 24px;
}

/* ===== HAMBURGER MENU ANIMATION ===== */
.hamburger-menu {
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    gap: 5px;
    border-radius: 10px;
    transition: all 0.25s ease;
}

.hamburger-menu:hover {
    background: rgba(59, 130, 246, 0.08);
}

.hamburger-line {
    width: 22px;
    height: 2.5px;
    background: var(--color-primary);
    border-radius: 2px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Hamburger to X Animation */
.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* ===== OVERLAY ===== */
.sidebar-overlay {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100vh - 60px);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    background: rgba(15, 23, 42, 0.2);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== SECTION-SPECIFIC ICONS ===== */
/* Overview Section - Blue tones */
.sidebar-section[data-section="overview"] .sidebar-item i {
    color: #3b82f6;
}

/* Financial Tracking - Green/teal tones */
.sidebar-section[data-section="tracking"] .sidebar-item i {
    color: #0D9488;
}

/* AI & Insights - Purple tones */
.sidebar-section[data-section="ai"] .sidebar-item i {
    color: #8B5CF6;
}

/* Tools - Amber tones */
.sidebar-section[data-section="tools"] .sidebar-item i {
    color: #D97706;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .right-sidebar {
        width: 100%;
        right: -100%;
        border-radius: 0;
    }
    
    .right-sidebar.active {
        right: 0;
    }
    
    .sidebar-item {
        padding: 16px 20px;
        margin: 2px 8px;
    }
    
    .hamburger-menu {
        width: 40px;
        height: 40px;
    }
}

/* ===== MAINTENANCE LOGOUT ITEM ===== */
.maintenance-logout-item {
    color: #DC2626 !important;
}

.maintenance-logout-item i {
    color: #DC2626 !important;
}

.maintenance-logout-item:hover {
    background: rgba(220, 38, 38, 0.08) !important;
}

/* ===== NOTIFICATION BADGE ON MENU ===== */
.sidebar-item .notification-dot {
    width: 8px;
    height: 8px;
    background: #EF4444;
    border-radius: 50%;
    margin-left: auto;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

/* ===== DARK MODE SUPPORT ===== */
[data-theme="dark"] .right-sidebar,
.theme-dark .right-sidebar {
    --sidebar-bg: #1F2937;
    --sidebar-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
    --item-hover-bg: rgba(59, 130, 246, 0.15);
    --item-active-bg: rgba(59, 130, 246, 0.2);
    --section-header-color: #6B7280;
}

[data-theme="dark"] .sidebar-header,
.theme-dark .sidebar-header {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, #1F2937 100%);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .sidebar-header h3,
.theme-dark .sidebar-header h3 {
    color: #F9FAFB;
}

[data-theme="dark"] .sidebar-item,
.theme-dark .sidebar-item {
    color: #60A5FA;
}

[data-theme="dark"] .sidebar-item span,
.theme-dark .sidebar-item span {
    color: #60A5FA;
}

[data-theme="dark"] .sidebar-item:hover,
.theme-dark .sidebar-item:hover {
    color: #93C5FD;
}

[data-theme="dark"] .sidebar-item:hover span,
.theme-dark .sidebar-item:hover span {
    color: #93C5FD;
}

[data-theme="dark"] .sidebar-overlay,
.theme-dark .sidebar-overlay {
    background: rgba(0, 0, 0, 0.5);
}
