/* Dan Nkansah Ent — Global UI System */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #059669;
    --danger: #dc2626;
    --surface: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --radius: 0.875rem;
    --shadow: 0 4px 24px -4px rgba(15, 23, 42, 0.08);
    --shadow-hover: 0 12px 40px -8px rgba(37, 99, 235, 0.18);
}

/* ── Body & background ── */
.app-body {
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 45%, #f0fdf4 100%);
    color: var(--text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    animation: fade-in 0.35s ease-out;
}

.page-content {
    animation: fade-in-up 0.45s ease-out;
}

.max-w-4xl.mx-auto:not(.page-content),
.max-w-7xl.mx-auto:not(.page-content) {
    animation: fade-in-up 0.45s ease-out;
}

.bg-orbs {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.bg-orbs::before,
.bg-orbs::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
    animation: orb-float 12s ease-in-out infinite;
}

.bg-orbs::before {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, #93c5fd 0%, transparent 70%);
    top: -120px;
    right: -80px;
}

.bg-orbs::after {
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, #6ee7b7 0%, transparent 70%);
    bottom: -100px;
    left: -60px;
    animation-delay: -6s;
}

@keyframes orb-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -20px) scale(1.05); }
}

/* ── Animations ── */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slide-in-left {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes icon-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes icon-pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35); }
    70% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes count-up-glow {
    0%, 100% { text-shadow: 0 0 0 transparent; }
    50% { text-shadow: 0 0 20px rgba(37, 99, 235, 0.2); }
}

.animate-fade-in-up {
    animation: fade-in-up 0.6s ease-out forwards;
}

.animate-fade-in {
    animation: fade-in 0.5s ease-out forwards;
}

.animate-delay-1 { animation-delay: 0.1s; opacity: 0; }
.animate-delay-2 { animation-delay: 0.2s; opacity: 0; }
.animate-delay-3 { animation-delay: 0.3s; opacity: 0; }
.animate-delay-4 { animation-delay: 0.4s; opacity: 0; }

[data-animate] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

[data-animate].is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Cards ── */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
    position: relative;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--success));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(37, 99, 235, 0.15);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card-income::before { background: linear-gradient(90deg, #059669, #34d399); opacity: 1; }
.stat-card-expense::before { background: linear-gradient(90deg, #dc2626, #f87171); opacity: 1; }
.stat-card-net::before { background: linear-gradient(90deg, #2563eb, #818cf8); opacity: 1; }
.stat-card-shops::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); opacity: 1; }

.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.feature-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid #f1f5f9;
    box-shadow: var(--shadow);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(37, 99, 235, 0.12);
}

.feature-card:hover .icon-box {
    animation: icon-bounce 0.6s ease;
}

/* ── Icon boxes ── */
.icon-box {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    color: white;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.icon-box-lg {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.25rem;
}

.icon-box-md {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1rem;
}

.icon-box-green {
    background: linear-gradient(135deg, #059669, #34d399);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.icon-box-red {
    background: linear-gradient(135deg, #dc2626, #f87171);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

.icon-box-blue {
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.icon-box-purple {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

.icon-box-orange {
    background: linear-gradient(135deg, #ea580c, #fb923c);
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
}

.icon-animate {
    animation: icon-bounce 2.5s ease-in-out infinite;
}

.icon-animate-delay {
    animation: icon-bounce 2.5s ease-in-out infinite;
    animation-delay: 0.5s;
}

.icon-pulse {
    animation: icon-pulse-ring 2s ease-out infinite;
}

/* ── Buttons ── */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.625rem;
    font-weight: 600;
    font-size: 0.9375rem;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transition: all 0.25s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
    color: white;
}

.btn-secondary {
    background: white;
    color: var(--primary);
    padding: 0.75rem 1.5rem;
    border-radius: 0.625rem;
    font-weight: 600;
    font-size: 0.9375rem;
    border: 2px solid rgba(37, 99, 235, 0.2);
    transition: all 0.25s ease;
    text-decoration: none;
}

.btn-secondary:hover {
    background: #eff6ff;
    border-color: var(--primary);
    transform: translateY(-2px);
    color: var(--primary-dark);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.625rem;
    font-weight: 600;
    font-size: 0.9375rem;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
    transition: all 0.25s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.45);
    color: white;
}

/* ── Navbar polish ── */
.app-nav {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 1px 12px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 9990;
}

.app-nav.scrolled {
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

.nav-dropdown {
    position: relative;
    z-index: 9991;
}

.nav-dropdown-menu {
    z-index: 9999 !important;
    pointer-events: none;
}

.nav-dropdown-menu.is-open {
    pointer-events: auto !important;
}

#mobile-menu {
    position: relative;
    z-index: 9998;
}

.nav-link-hover {
    position: relative;
    transition: color 0.2s ease;
}

.nav-link-hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.25s ease, left 0.25s ease;
}

.nav-link-hover:hover::after {
    width: 80%;
    left: 10%;
}

/* ── Progress bar ── */
.progress-bar-track {
    height: 0.625rem;
    background: #f1f5f9;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-income {
    background: linear-gradient(90deg, #059669, #34d399);
}

.progress-bar-expense {
    background: linear-gradient(90deg, #dc2626, #f87171);
}

/* ── Stat values ── */
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-change-positive { color: #059669; }
.stat-change-negative { color: #dc2626; }

/* ── Forms (auth pages) ── */
.auth-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 8px 40px rgba(15, 23, 42, 0.1);
    border: 1px solid rgba(226, 232, 240, 0.8);
    animation: fade-in-up 0.6s ease-out;
}

.form-input {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
}

/* ── Alerts ── */
.alert {
    border-radius: 0.625rem;
    padding: 1rem;
    animation: slide-in-left 0.4s ease-out;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ── Table row hover ── */
.table-row-hover {
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.table-row-hover:hover {
    background-color: #f8fafc;
}

/* ── Dashboard stat cards enhancement ── */
.dashboard-stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid #f1f5f9;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dashboard-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.dashboard-stat-card:hover .icon-box {
    transform: scale(1.08);
}

/* ── Countdown ring ── */
.countdown-ring circle:last-child {
    transition: stroke-dashoffset 1s linear;
}

/* ── Hero gradient text ── */
.gradient-text {
    background: linear-gradient(135deg, #2563eb 0%, #059669 50%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Section divider ── */
.section-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    background: #eff6ff;
    color: var(--primary);
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* ── Footer ── */
.app-footer {
    background: white;
    border-top: 1px solid #f1f5f9;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    [data-animate] {
        opacity: 1;
        transform: none;
    }
}
