@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --theme-accent: #10b981;
    --theme-accent-rgb: 16, 185, 129;
    --primary: #0F172A;
    --accent: var(--theme-accent);
}

/* Dynamic Accent Overrides */
.text-accent { color: var(--theme-accent) !important; }
.bg-accent { background-color: var(--theme-accent) !important; }
.bg-accent\/10 { background-color: rgba(var(--theme-accent-rgb), 0.1) !important; }
.bg-accent\/20 { background-color: rgba(var(--theme-accent-rgb), 0.2) !important; }
.border-accent { border-color: var(--theme-accent) !important; }
.peer-checked\:bg-accent:checked ~ div { background-color: var(--theme-accent) !important; }
.peer-checked\:border-accent:checked ~ div { border-color: var(--theme-accent) !important; }
.shadow-accent\/30 { box-shadow: 0 4px 14px 0 rgba(var(--theme-accent-rgb), 0.3) !important; }
.ring-accent { --tw-ring-color: var(--theme-accent) !important; }
.focus\:ring-accent:focus { --tw-ring-color: var(--theme-accent) !important; }
.focus\:border-accent:focus { border-color: var(--theme-accent) !important; }

/* Ensure perfectly stable scrolling on mobile (fixes address bar jitter & layer rendering bugs) */
html, body {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    overflow: hidden !important;
    touch-action: pan-x pan-y;
    -webkit-tap-highlight-color: transparent;
}
body { padding-bottom: 0 !important; }

#mainContainer {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    scroll-behavior: smooth;
    padding-bottom: 84px; /* Fix gap: optimized to leave ~12px spacing above the 72px bottom navigation */
    will-change: scroll-position;
}


@media (min-width: 769px) {
    #mainContainer { padding-bottom: 0; }
}

@media (min-width: 768px) {
    .custom-scrollbar::-webkit-scrollbar,
    .settings-scroll::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    .custom-scrollbar::-webkit-scrollbar-track,
    .settings-scroll::-webkit-scrollbar-track {
        background: transparent;
    }
    .custom-scrollbar::-webkit-scrollbar-thumb,
    .settings-scroll::-webkit-scrollbar-thumb {
        background: rgba(156, 163, 175, 0.4);
        border-radius: 20px;
    }
    .custom-scrollbar::-webkit-scrollbar-thumb:hover,
    .settings-scroll::-webkit-scrollbar-thumb:hover {
        background: rgba(156, 163, 175, 0.7);
    }
}
@media (max-width: 767px) {
    .custom-scrollbar::-webkit-scrollbar,
    .settings-scroll::-webkit-scrollbar {
        display: none;
    }
}

.glass-panel, .glass-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}
.dark .glass-panel, .dark .glass-card {
    background: rgba(30, 41, 59, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.page-section {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.ripple {
    position: relative;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
}
.ripple::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    width: 100px;
    height: 100px;
    margin-top: -50px;
    margin-left: -50px;
    animation: rippleEffect 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
}
.dark .bg-white.ripple::after {
    background: rgba(0, 0, 0, 0.2);
}
@keyframes rippleEffect {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(4); opacity: 0; }
}

.hover-card, .hover-scale {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.hover-card:hover, .hover-scale:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}
.dark .hover-card:hover, .dark .hover-scale:hover {
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.15);
}

.toast {
    animation: slideUpFade 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards, fadeOut 0.3s ease-in forwards 3.5s;
    pointer-events: auto;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    will-change: transform, opacity;
}
@keyframes slideUpFade {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(10px); }
}

/* Premium Calendar Animations */
.calendar-day-hover:hover {
    background-color: rgba(var(--theme-accent-rgb), 0.15);
    transform: scale(1.1);
}
.calendar-day-selected {
    background-color: var(--theme-accent);
    color: white;
    box-shadow: 0 4px 14px rgba(var(--theme-accent-rgb), 0.4);
    transform: scale(1.05);
}

table th { position: sticky; top: 0; z-index: 10; }
tbody tr { transition: background-color 0.2s ease; }
tbody tr:hover td { color: var(--primary); }
.dark tbody tr:hover td { color: #fff; }

canvas {
    max-width: 100% !important;
    max-height: 100% !important;
}

input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0;
}
input[type=number] { -moz-appearance: textfield; }

@media print {
    body * { visibility: hidden; }
    .print-section, .print-section * { visibility: visible; }
    .print-section { position: absolute; left: 0; top: 0; width: 100%; border: none !important; box-shadow: none !important; }
    .no-print { display: none !important; }
}

#mainHeader {
    will-change: transform, opacity;
}

@media (max-width: 768px) {
    #fullHistoryPage .table-wrapper {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        overflow-x: visible !important;
        padding: 0 !important;
        touch-action: auto !important;
    }
    #fullHistoryPage table, #fullHistoryPage tbody, #fullHistoryPage th {
        display: block;
        width: 100%;
        min-width: 100% !important;
        border: none !important;
    }
    #fullHistoryPage thead { display: none; }
    #fullHistoryPage tbody {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    #fullHistoryPage tr {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        border-radius: 1.25rem;
        padding: 1.25rem;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
        border: 1px solid rgba(0, 0, 0, 0.03);
        position: relative;
        overflow: hidden;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    html.dark #fullHistoryPage tr {
        background: rgba(30, 41, 59, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.05);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }
    #fullHistoryPage tr:has(.text-success) { border-left: 5px solid #10B981; }
    #fullHistoryPage tr:has(.text-danger) { border-left: 5px solid #EF4444; }
    #fullHistoryPage td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 0.5rem 0 !important;
        border: none !important;
        white-space: normal !important;
        text-align: right;
    }
    #fullHistoryPage td::before {
        content: attr(data-label);
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        color: #9CA3AF;
        margin-right: 1rem;
        text-align: left;
        letter-spacing: 0.05em;
    }
    #fullHistoryPage td[data-label="Description"] {
        justify-content: flex-start;
        text-align: left;
        font-size: 1.15rem;
        color: #0F172A;
        padding-top: 0 !important;
        padding-bottom: 0.75rem !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
        margin-bottom: 0.5rem;
    }
    html.dark #fullHistoryPage td[data-label="Description"] {
        color: #F8FAFC;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    }
    #fullHistoryPage td[data-label="Description"]::before { display: none; }
    #fullHistoryPage td[data-label="Amount"] { font-size: 1.15rem; }
    #fullHistoryPage td:last-child {
        justify-content: flex-end;
        align-items: center;
        border-top: 1px dashed rgba(156, 163, 175, 0.3) !important;
        margin-top: 0.5rem;
        padding-top: 1rem !important;
        gap: 0.75rem;
        opacity: 1 !important;
    }
    #fullHistoryPage td:last-child::before { display: none; }
}

.mobile-bottom-nav { display: none; }
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0px; 
        left: 0px; 
        right: 0px;
        height: 72px;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(32px) saturate(200%);
        -webkit-backdrop-filter: blur(32px) saturate(200%);
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.05);
        justify-content: space-around;
        align-items: center;
        z-index: 99999;
        padding: 0 12px;
        transform: translateZ(0);
        will-change: transform;
    }
    .dark .mobile-bottom-nav {
        background: rgba(15, 23, 42, 0.9);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
    }
    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #9ca3af;
        font-size: 11px;
        font-weight: 600;
        gap: 4px;
        flex: 1;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: transparent;
        border: none;
        outline: none;
        cursor: pointer;
        padding: 8px 0;
        font-family: inherit;
        position: relative;
        z-index: 1;
    }
    .nav-item::before {
        content: '';
        position: absolute;
        inset: 4px 12px;
        border-radius: 12px;
        background: rgba(var(--theme-accent-rgb), 0.15);
        opacity: 0;
        transform: scale(0.8) translateY(10px);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: -1;
    }
    .nav-item.active::before {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    .nav-item i { 
        font-size: 20px; 
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); 
    }
    .nav-item.active { 
        color: var(--theme-accent); 
    }
    .dark .nav-item.active { 
        color: var(--theme-accent); 
    }
    .fab-container { 
        position: relative; 
        top: -20px; 
        z-index: 2; 
    }
    .add-btn {
        width: 56px;
        height: 56px;
        border: none;
        border-radius: 50%;
        background : var(--theme-accent);
        color: #fff;
        font-size: 24px;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
        box-shadow: 0 8px 24px rgba(var(--theme-accent-rgb), 0.4);
        transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
        outline: none;
        -webkit-tap-highlight-color: transparent;
    }
    .add-btn:active { 
        transform: scale(0.92); 
        box-shadow: 0 4px 12px rgba(var(--theme-accent-rgb), 0.3); 
    }
}

.cropper-view-box, .cropper-face { border-radius: 50%; }
.cropper-view-box { outline: 2px solid var(--theme-accent); }




*{
    -webkit-user-select:none;
    -moz-user-select:none;
    -ms-user-select:none;
    user-select:none;
}