/* Finance Flow Premium Design System */

.glass {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.02);
    transition: all 0.5s ease;
}

.dark .glass {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-premium {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.glass-premium::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    transform: rotate(45deg);
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    animation: shine 8s infinite linear;
}

.sidebar-glass {
    background-color: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
}

.dark .sidebar-glass {
    background-color: rgba(10, 10, 12, 0.6);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.mesh-gradient {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #2dd4bf 100%);
    background-size: 200% 200%;
    animation: gradientMove 10s infinite alternate;
}

.active-nav {
    color: #6366f1;
    position: relative;
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.dark .active-nav {
    color: white;
    text-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.active-nav::after {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.25rem;
    height: 1.5rem;
    background-color: #6366f1;
    border-top-right-radius: 9999px;
    border-bottom-right-radius: 9999px;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.8);
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(100px, auto);
    gap: 1.5rem;
}


/* Sidebar Structure - Unified */
#sidebar {
    width: 17rem;
    transition: width 0.4s cubic-bezier(0.2, 0, 0, 1);
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 50;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

#sidebar::-webkit-scrollbar {
    width: 4px;
}

#sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(99, 102, 241, 0.1);
    border-radius: 20px;
}

.dark #sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.05);
}

#sidebar.collapsed {
    width: 5.5rem;
}

#main-content {
    margin-left: 17rem;
    transition: margin-left 0.4s cubic-bezier(0.2, 0, 0, 1), padding 0.4s ease;
    width: auto;
    min-height: 100vh;
}

#main-content.collapsed {
    margin-left: 5.5rem;
}

/* Sidebar Content Visibility */
.sidebar-item-text,
.logo-text,
.theme-text,
.sidebar-label,
.sidebar-footer-card {
    opacity: 1;
    transform: translateX(0);
}

.sidebar-footer-card {
    white-space: normal !important;
}

/* Collapsed State Styling */
.collapsed .sidebar-item-text,
.collapsed .logo-text,
.collapsed .theme-text,
.collapsed .sidebar-label,
.collapsed .sidebar-footer-card {
    opacity: 0 !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none;
    position: absolute;
}

.collapsed .nav-link {
    padding-left: 0;
    padding-right: 0;
    justify-content: center;
    width: 2.5rem;
    margin-left: auto;
    margin-right: auto;
    border-radius: 0.75rem;
}

.collapsed .logo-container {
    flex-direction: column;
    gap: 1.5rem;
    padding-left: 0;
    padding-right: 0;
    padding-top: 2rem;
    padding-bottom: 2rem;
    justify-content: flex-start;
    align-items: center;
}

.collapsed .logo-container .logo-title {
    display: none;
}

/* Ensure toggle button is visible and centered in collapsed mode */
.collapsed .sidebar-header-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 0.75rem;
    background-color: rgba(255, 255, 255, 0.05);
}

.collapsed .sidebar-header-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.collapsed .nav-link span:first-child {
    margin-right: 0;
}

/* Mobile Adjustments */
@media (max-width: 1024px) {
    #sidebar {
        position: fixed;
        left: -100% !important;
        width: 17rem !important;
    }

    #sidebar.active {
        left: 0 !important;
    }

    #main-content {
        margin-left: 0 !important;
    }

    .sidebar-header-toggle {
        display: block;
    }
}

#sidebar.hidden-total {
    transform: translateX(-100%);
    width: 0 !important;
    border-right: none;
}

#main-content.full-width {
    margin-left: 0 !important;
}

#sidebar-show-trigger {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 60;
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6366f1;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

#sidebar-show-trigger:hover {
    transform: scale(1.1);
}

#sidebar-show-trigger:active {
    transform: scale(0.95);
}

#sidebar-scrim {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

/* Transaction Date Grouping */
.date-group-header {
    position: sticky;
    top: 0;
    z-index: 10;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    backdrop-filter: blur(12px);
    background-color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    margin-top: 1.5rem;
}

.dark .date-group-header {
    background-color: rgba(10, 10, 12, 0.5);
}

.date-group-header:first-of-type {
    margin-top: 0;
}

.date-group-label {
    font-size: 11px;
    font-weight: 900;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    white-space: nowrap;
}

.dark .date-group-label {
    color: #64748b;
}

.date-group-header::after {
    content: '';
    height: 1px;
    width: 100%;
    background-color: #e2e8f0;
}

.dark .date-group-header::after {
    background-color: rgba(255, 255, 255, 0.05);
}

.glow-border {
    position: relative;
}

.glow-border::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(90deg, #6366f1, #a855f7, #2dd4bf);
    border-radius: inherit;
    z-index: -1;
    opacity: 0.5;
}

.sparkline-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 0;
    animation: dash 3s linear forwards;
}

@keyframes dash {
    from {
        stroke-dashoffset: 1000;
    }

    to {
        stroke-dashoffset: 0;
    }
}

.bar-container:hover .tooltip {
    opacity: 1;
    transform: translateY(-10px) translateX(-50%);
}

.bar-grow {
    animation: barGrow 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform-origin: bottom;
    transform: scaleY(0);
}

@keyframes barGrow {
    to {
        transform: scaleY(1);
    }
}

.progress-ring-circle {
    transition: stroke-dashoffset 1s ease-in-out;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
}

.celebrate-icon {
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-5px);
    }

    60% {
        transform: translateY(-3px);
    }
}

/* Shimmer Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.btn-shimmer {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 25%, #2dd4bf 50%, #a855f7 75%, #6366f1 100%);
    background-size: 300% 100%;
    animation: shimmer 4s ease-in-out infinite;
}

.btn-shimmer:hover {
    filter: brightness(1.15);
    box-shadow: 0 8px 30px -8px rgba(99, 102, 241, 0.5);
}

.btn-shimmer:active {
    transform: scale(0.98);
}

.custom-dropdown-menu.show {
    max-height: 500px;
    opacity: 1;
}

/* --- Advanced Micro-Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-soft {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-float {
    animation: float 4s ease-in-out infinite;
}

.hover-lift {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.hover-lift:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px -15px rgba(99, 102, 241, 0.15);
}

.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

.stagger-6 {
    animation-delay: 0.6s;
}

/* Smooth Tilt simulation with subtle rotate */
.hover-rotate:hover {
    transform: translateY(-8px) rotate(0.5deg);
}

@keyframes shine {
    from {
        transform: translateX(-100%) rotate(45deg);
    }

    to {
        transform: translateX(100%) rotate(45deg);
    }
}

@keyframes gradientMove {
    0% {
        background-position: 0% 0%;
    }

    100% {
        background-position: 100% 100%;
    }
}

/* Base Layout Enhancements */
body {
    background-color: #f8fafc;
    color: #0f172a;
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(45, 212, 191, 0.03) 0px, transparent 50%);
    transition: background-color 0.4s ease, color 0.4s ease;
}

.dark body {
    background-color: #0a0a0c;
    color: #f1f5f9;
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.18) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(99, 102, 241, 0.08) 0px, transparent 50%);
}

/* Unified Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(100, 116, 139, 0.2);
    border-radius: 20px;
    border: 1px solid transparent;
    background-clip: content-box;
}

.dark ::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(100, 116, 139, 0.4);
}

.dark ::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Global Transitions */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}