/* ═══════════════════════════════════════════════════════════
   HOMEBASE — MOTION & DEPTH LANGUAGE
   All interactive depth, cursor-following light, and spring
   physics live here. Pure enhancement layer — remove this
   file and the app still works perfectly.
   ═══════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS — Motion-specific ── */
:root {
    --spring-overshoot: cubic-bezier(0.34, 1.56, 0.64, 1);
    --spring-smooth: cubic-bezier(0.23, 1, 0.32, 1);
    --motion-fast: 0.2s;
    --motion-medium: 0.35s;
    --motion-slow: 0.5s;
}

/* Respect user preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .ambient-enhanced { display: none !important; }
    .section-bar-bg::after { display: none !important; }
    .dark-hero-glow, .dark-hero-glow-cool { display: none !important; }
    .glass-highlight { display: none !important; }
}

/* ═══════════════════════════════════════════
   1. AMBIENT BACKGROUND — More alive
   Enhance existing aurora-bg blobs
   ═══════════════════════════════════════════ */

/* Increase existing blob visibility slightly */
.aurora-bg::before,
.aurora-bg::after,
.aurora-bg .blob-1,
.aurora-bg .blob-2,
.aurora-bg .blob-3 {
    opacity: 0.25;                /* was 0.18 — slightly more visible */
    filter: blur(160px);          /* was 180px — slightly sharper */
    animation-duration: 40s;      /* was 50s — slightly faster breathing */
}

/* Make blob colors richer */
.aurora-bg::before {
    background: radial-gradient(circle, rgba(0, 122, 255, 0.12) 0%, transparent 70%);
}
.aurora-bg::after {
    background: radial-gradient(circle, rgba(88, 86, 214, 0.08) 0%, transparent 70%);
}
.aurora-bg .blob-1 {
    background: radial-gradient(circle, rgba(52, 199, 89, 0.07) 0%, transparent 70%);
}
.aurora-bg .blob-2 {
    background: radial-gradient(circle, rgba(90, 200, 250, 0.07) 0%, transparent 70%);
}
.aurora-bg .blob-3 {
    background: radial-gradient(circle, rgba(175, 82, 222, 0.06) 0%, transparent 70%);
}

/* ═══════════════════════════════════════════
   2. SECTION BAR — Cursor-following light
   Radial highlight tracks mouse position
   ═══════════════════════════════════════════ */
.section-bar-bg::after {
    content: '';
    position: absolute;
    top: -50%; left: -30%;
    width: 160%; height: 160%;
    background: radial-gradient(
        ellipse at var(--mouse-x, 50%) var(--mouse-y, 30%),
        rgba(255, 255, 255, 0.12) 0%,
        transparent 50%
    );
    pointer-events: none;
    transition: all 0.5s var(--spring-smooth);
    z-index: 1;
}

/* Ensure section-bar-content sits above the light */
.section-bar-content {
    z-index: 2;
}

/* ── Insight pill lift ── */
.section-bar-insight {
    transition: all 0.3s var(--spring-smooth);
    border: 0.5px solid rgba(255,255,255,0.1);
}
.section-bar-insight:hover {
    background: rgba(255,255,255,0.22);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ── Section bar button enhanced hover ── */
.section-bar-btn {
    transition: all 0.25s var(--spring-smooth);
}
.section-bar-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.28);
}

/* ═══════════════════════════════════════════
   3. SIDEBAR — Liquid highlight on nav items
   Radial glow follows cursor within each item
   ═══════════════════════════════════════════ */
.sidebar-item {
    position: relative;
    overflow: clip;
}
.sidebar-item::before {
    content: '';
    position: absolute;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,122,255,0.06) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: translate(-50%, -50%);
    left: var(--mx, 50%);
    top: var(--my, 50%);
}
.sidebar-item:hover::before {
    opacity: 1;
}

/* Icon spring on hover */
.sidebar-item .material-symbols-outlined {
    transition: color 0.2s ease, transform 0.25s var(--spring-overshoot);
}
.sidebar-item:hover .material-symbols-outlined {
    transform: scale(1.1);
}

/* Avatar spring */
.sidebar-hero-avatar {
    transition: transform 0.3s var(--spring-overshoot), box-shadow 0.3s ease;
}
.sidebar-hero-avatar:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}

/* ═══════════════════════════════════════════
   4. CARDS — Glass specular highlight
   A soft white glow follows cursor on hover
   ═══════════════════════════════════════════ */

/* The highlight element — inserted by JS */
.glass-highlight {
    position: absolute;
    width: 280px; height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 60%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    will-change: transform;
    z-index: 0;
}
.card:hover .glass-highlight,
.stat-card:hover .glass-highlight,
.cal-keyday:hover .glass-highlight,
.coming-up-hero:hover .glass-highlight {
    opacity: 1;
}

/* Enhanced card top-edge light refraction */
.card::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.5) 20%,
        rgba(255,255,255,0.5) 80%,
        transparent 100%
    );
    height: 1px;
    top: 0; left: 0; right: 0;
    border-radius: inherit;
    transition: opacity 0.3s ease;
    opacity: 0.6;
}
.card:hover::before {
    opacity: 1;
}

/* Stat card enhanced hover */
.stat-card {
    transition: all var(--motion-medium) var(--spring-smooth);
}
.stat-card:hover {
    transform: translateY(-3px);
}

/* ═══════════════════════════════════════════
   5. KEY DAY CARDS — 3D Tilt + Inner light
   Cards tilt toward cursor like physical objects
   ═══════════════════════════════════════════ */
.cal-keyday {
    transform-style: preserve-3d;
    will-change: transform;
    transition: all var(--motion-medium) var(--spring-smooth);
    position: relative;
    overflow: hidden;
}

/* Inner light that intensifies on hover */
.cal-keyday::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, transparent 100%);
    border-radius: inherit;
    pointer-events: none;
    opacity: 0.4;
    transition: opacity 0.3s ease;
    z-index: 0;
}
.cal-keyday:hover::before {
    opacity: 0.8;
}

/* Ensure content sits above (exclude glass-highlight which must stay absolute) */
.cal-keyday > *:not(.glass-highlight) {
    position: relative;
    z-index: 1;
}

.cal-keyday:hover {
    box-shadow:
        0 0.5px 0 rgba(255,255,255,0.55) inset,
        0 8px 32px rgba(0,0,0,0.10),
        0 2px 8px rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.08);
}

/* Active press — snappy spring */
.cal-keyday:active {
    transform: translateY(-2px) scale(0.98) !important;
    transition: transform 80ms ease !important;
}

/* ═══════════════════════════════════════════
   6. DARK HERO (Month Pulse + Debt Hero)
   Cursor-following dual glow system
   ═══════════════════════════════════════════ */

/* Glow elements — inserted by JS on dark surfaces */
.dark-hero-glow {
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    pointer-events: none;
    transition: transform 0.6s var(--spring-smooth);
    will-change: transform;
    filter: blur(20px);
    z-index: 0;
}
.dark-hero-glow.warm {
    background: radial-gradient(circle,
        rgba(255,59,48,0.10) 0%,
        rgba(255,59,48,0.03) 40%,
        transparent 70%);
}
.dark-hero-glow.cool {
    background: radial-gradient(circle,
        rgba(0,122,255,0.06) 0%,
        transparent 60%);
    width: 300px; height: 300px;
    filter: blur(30px);
    transition-duration: 0.8s;
}
/* Green variant for money pages */
.dark-hero-glow.green {
    background: radial-gradient(circle,
        rgba(52,199,89,0.10) 0%,
        rgba(52,199,89,0.03) 40%,
        transparent 70%);
}
/* Purple variant for hustle pages */
.dark-hero-glow.purple {
    background: radial-gradient(circle,
        rgba(175,82,222,0.10) 0%,
        transparent 60%);
}

/* Command Center entrance */
.command-center {
    animation: ccEntrance 0.6s ease both;
    animation-delay: 0.15s;
}
@keyframes ccEntrance {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.cc-col {
    animation: ccColFade 0.4s ease both;
}
.cc-col:nth-child(1) { animation-delay: 0.3s; }
.cc-col:nth-child(2) { animation-delay: 0.4s; }
.cc-col:nth-child(3) { animation-delay: 0.5s; }
.cc-col:nth-child(4) { animation-delay: 0.6s; }
@keyframes ccColFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════
   7. LIST ROWS — Directional slide + spring
   Hovering reveals accent, slides content right
   ═══════════════════════════════════════════ */

/* Income rows, bill rows, queue items, etc. */
.mo-income-row,
.pe-item,
.be2-row,
.dp-queue-item {
    transition: all var(--motion-medium) var(--spring-smooth);
    position: relative;
}
.mo-income-row:hover,
.pe-item:hover,
.be2-row:hover {
    transform: translateX(4px);
}

/* Pet cards */
.pet-card {
    transition: all var(--motion-medium) var(--spring-smooth);
}
.pet-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
}

/* Account cards */
.acl-card:hover {
    transform: translateY(-2px);
}

/* ═══════════════════════════════════════════
   8. PROGRESS BARS — Animated fill + glow
   Progress bars animate on page entrance
   ═══════════════════════════════════════════ */

/* Generic animated progress fill */
.progress-animated {
    transition: width 1.2s var(--spring-smooth);
    position: relative;
}
.progress-animated::after {
    content: '';
    position: absolute;
    right: 0; top: -2px; bottom: -2px;
    width: 20px;
    background: inherit;
    filter: blur(8px);
    opacity: 0.6;
    border-radius: inherit;
}

/* Debt hero progress bar glow */
.dp-hero-bar-fill {
    transition: width 1.2s var(--spring-smooth);
    box-shadow: 0 0 12px rgba(52,199,89,0.4);
}

/* Goal progress bars */
.goal-progress-fill {
    transition: width 1s var(--spring-smooth);
}

/* Milestone progress */
.ms-progress-fill {
    transition: width 1s var(--spring-smooth);
}

/* ═══════════════════════════════════════════
   9. BUTTONS — Spring press + lift hover
   Every button should feel physically pushable
   ═══════════════════════════════════════════ */

/* Already have good base, enhance with spring overshoot */
.btn {
    transition: all var(--motion-fast) var(--spring-smooth);
}
.btn:hover {
    transform: translateY(-1px);
}
.btn:active {
    transform: scale(0.95) translateY(0);
    transition: transform 60ms ease;
}

/* Primary buttons get a subtle glow on hover */
.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(0,122,255,0.3);
}

/* Ghost buttons get background fill */
.btn-ghost:hover {
    background: rgba(0,122,255,0.08);
}

/* ═══════════════════════════════════════════
   10. MODALS — Entrance spring + backdrop depth
   Modals should feel like they rise from below
   ═══════════════════════════════════════════ */
.modal {
    transition: transform 0.35s var(--spring-overshoot),
                opacity 0.2s ease-out;
}
.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

/* Detail panels slide in from right */
.dp-detail-panel {
    transition: transform 0.3s var(--spring-smooth),
                opacity 0.2s ease;
}
.dp-detail-overlay.active .dp-detail-panel {
    transform: translateX(0);
}

/* ═══════════════════════════════════════════
   11. TIMELINE DOTS — Pulse + spring hover
   ═══════════════════════════════════════════ */
.dp-journey-dot {
    transition: transform 0.3s var(--spring-overshoot),
                box-shadow 0.3s ease;
}
.dp-journey-dot:hover {
    transform: scale(1.3);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
/* Debt-free dot permanent soft pulse */
.dp-journey-dot.free::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(52,199,89,0.2);
    animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 0; }
}

/* ═══════════════════════════════════════════
   12. CALENDAR DAY CELLS — Subtle lift
   ═══════════════════════════════════════════ */
.cal-day {
    transition: all var(--motion-medium) var(--spring-smooth);
}
.cal-day:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.cal-day:active {
    transform: scale(0.98);
    transition: transform 60ms ease;
}

/* ═══════════════════════════════════════════
   13. SCROLL-TRIGGERED STAGGER — Enhance entrance
   More dramatic stagger for content after section bar
   ═══════════════════════════════════════════ */
@keyframes cardInEnhanced {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.page.active > *:not(.section-bar) {
    animation-name: cardInEnhanced;
    animation-duration: 0.5s;
    animation-timing-function: var(--spring-smooth);
}

/* ═══════════════════════════════════════════
   14. HOVER GLOW — Primary interactive elements
   Blue glow ring on key interactive elements
   ═══════════════════════════════════════════ */
.sidebar-item.active {
    box-shadow: 0 0 0 1px rgba(0,122,255,0.1),
                0 1px 4px rgba(0,122,255,0.06);
}

/* Focus ring — keyboard nav gets a visible ring */
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,122,255,0.3);
    border-radius: inherit;
}

/* ═══════════════════════════════════════════
   15. RECEIPT CARD — Transaction shimmer
   ═══════════════════════════════════════════ */
.tx-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.08);
}

/* ═══════════════════════════════════════════
   16. WIDGET TILES — Home Hub depth
   ═══════════════════════════════════════════ */
.coming-up-hero,
.cu-day-card {
    transition: all var(--motion-medium) var(--spring-smooth);
}
.coming-up-hero:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}
.cu-day-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* ═══════════════════════════════════════════
   17. SIDEBAR — Scroll fade + top highlight
   ═══════════════════════════════════════════ */
.sidebar-nav {
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0px,
        black 16px,
        black calc(100% - 16px),
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0px,
        black 16px,
        black calc(100% - 16px),
        transparent 100%
    );
}

/* Sidebar top highlight — simulates overhead light */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 100px;
    background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
    border-radius: inherit;
}

/* ═══════════════════════════════════════════
   18. HOME HUB GREETING — Parallax
   ═══════════════════════════════════════════ */
.hero-greeting {
    transition: transform 0.1s linear;
}

/* ═══════════════════════════════════════════
   19. RECEIPT CARD — Hover rotation
   ═══════════════════════════════════════════ */
.tx-receipt-card {
    transition: all var(--motion-medium) var(--spring-smooth);
}
.tx-receipt-card:hover {
    transform: translateY(-3px) rotate(-0.3deg);
    box-shadow: 0 12px 40px rgba(0,0,0,0.10);
}

/* ═══════════════════════════════════════════
   20. SEGMENTED CONTROL — Sliding indicator
   ═══════════════════════════════════════════ */
.seg-slider {
    position: absolute;
    top: 4px; bottom: 4px;
    left: 0;
    border-radius: 10px;
    background: rgba(255,255,255,0.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.3s var(--spring-smooth),
                width 0.3s var(--spring-smooth);
    z-index: 0;
    pointer-events: none;
}
.cal-mode-bar, .seg-control {
    position: relative;
}
.cal-mode-btn, .seg-btn {
    position: relative;
    z-index: 1;
}

/* ═══════════════════════════════════════════
   MOBILE — Disable expensive effects
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Disable 3D tilt on key days — saves battery */
    .cal-keyday {
        transform-style: flat !important;
    }

    /* Disable glass highlights — heavy on mobile GPU */
    .glass-highlight {
        display: none !important;
    }

    /* Disable dark hero glow — heavy on mobile */
    .dark-hero-glow {
        display: none !important;
    }

    /* Reduce card hover motion on touch — no hover on phones */
    .card:hover,
    .stat-card:hover {
        transform: none;
        box-shadow: var(--shadow-glass);
    }

    /* Active press states still work (touch-friendly) */
    .card:active {
        transform: scale(0.98);
    }
    .stat-card:active {
        transform: scale(0.98);
    }
}
