/* ═══════════════════════════════════════════════════════════════
   Casa Tropicale — Warm Mediterranean Utility
   ═══════════════════════════════════════════════════════════════ */

/* ── Fonts ──────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,500;0,9..144,700;1,9..144,400&family=Hanken+Grotesk:wght@400;500;600;700&display=swap');

/* ── Palette ────────────────────────────────────────────────── */
:root {
    --limestone:  #F4EDE2;
    --limestone-d: #E8DFD0;
    --ink:        #23201B;
    --ink-50:     rgba(35,32,27,.5);
    --ink-30:     rgba(35,32,27,.3);
    --ink-12:     rgba(35,32,27,.12);
    --ink-06:     rgba(35,32,27,.06);
    --terracotta: #C8643C;
    --terracotta-l: #D98A66;
    --aegean:     #2E6E78;
    --aegean-d:   #1F4F57;
    --aegean-l:   #3A8B97;
    --marigold:   #E8A93B;
    --marigold-l: #F0C46C;
    --sea-foam:   #DCE8E3;
    --sea-foam-d: #C4D6CE;
    --success:    #4E8A5B;
    --success-l:  #6BA578;
    --danger:     #C0503A;
    --white:      #FEFDFB;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body:    'Hanken Grotesk', system-ui, sans-serif;

    --shadow-sm:  0 1px 3px rgba(35,32,27,.06), 0 1px 2px rgba(35,32,27,.04);
    --shadow-md:  0 4px 12px rgba(35,32,27,.08), 0 2px 4px rgba(35,32,27,.04);
    --shadow-lg:  0 8px 24px rgba(35,32,27,.10), 0 4px 8px rgba(35,32,27,.04);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--limestone);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* Subtle grain texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.025'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
}

/* Warm gradient wash */
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 50vh;
    background: linear-gradient(180deg, var(--sea-foam) 0%, transparent 100%);
    opacity: .18;
    pointer-events: none;
    z-index: -1;
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, .font-display { font-family: var(--font-display); }
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 500; line-height: 1.3; }
h3 { font-size: 1.05rem; font-weight: 500; line-height: 1.4; }

.font-tabular { font-variant-numeric: tabular-nums; }
.text-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Card ───────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--ink-06);
    overflow: hidden;
    transition: box-shadow .2s ease, transform .15s ease;
}
.card:active { transform: scale(.985); }
.card-padded { padding: 1rem 1.1rem; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: .875rem;
    border: none;
    border-radius: var(--radius-md);
    padding: .75rem 1.25rem;
    cursor: pointer;
    min-height: 48px;
    transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
    text-decoration: none;
    line-height: 1.2;
}
.btn:active { transform: scale(.97); }

.btn-aegean {
    background: var(--aegean);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(46,110,120,.25);
}
.btn-aegean:hover { background: var(--aegean-d); }

.btn-terracotta {
    background: var(--terracotta);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(200,100,60,.2);
}
.btn-terracotta:hover { background: #B55A35; }

.btn-marigold {
    background: var(--marigold);
    color: var(--ink);
    box-shadow: 0 2px 8px rgba(232,169,59,.25);
}

.btn-ghost {
    background: transparent;
    color: var(--ink-50);
    padding: .5rem .75rem;
    min-height: 40px;
}
.btn-ghost:hover { background: var(--ink-06); }

.btn-sm { font-size: .78rem; padding: .5rem 1rem; min-height: 40px; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }
.btn-danger { background: var(--danger); color: var(--white); }

/* ── Progress Bar ───────────────────────────────────────────── */
.progress-track {
    width: 100%;
    height: 8px;
    background: var(--ink-06);
    border-radius: 99px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--aegean);
    transition: width .6s cubic-bezier(.34,1.56,.64,1);
}
.progress-fill[data-complete="true"] { background: var(--success); }
.progress-fill[data-warn="true"] { background: var(--marigold); }

/* ── Badge ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: .68rem;
    font-weight: 600;
    padding: .2rem .55rem;
    border-radius: 99px;
    line-height: 1.4;
}
.badge-aegean   { background: rgba(46,110,120,.12); color: var(--aegean); }
.badge-marigold { background: rgba(232,169,59,.15); color: #8B6520; }
.badge-success  { background: rgba(78,138,91,.12);  color: var(--success); }
.badge-danger   { background: rgba(192,80,58,.1);   color: var(--danger); }
.badge-purple   { background: rgba(120,80,160,.1);  color: #6B4F8A; }

/* ── Form Controls ──────────────────────────────────────────── */
.input, select.input {
    font-family: var(--font-body);
    font-size: .875rem;
    padding: .65rem .85rem;
    border: 1.5px solid var(--ink-12);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--ink);
    width: 100%;
    min-height: 44px;
    transition: border-color .15s ease, box-shadow .15s ease;
    outline: none;
    -webkit-appearance: none;
}
.input:focus {
    border-color: var(--aegean);
    box-shadow: 0 0 0 3px rgba(46,110,120,.12);
}
textarea.input { resize: vertical; min-height: 80px; }

.form-label {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    color: var(--ink-50);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .3rem;
}

/* ── Sticky Bottom Nav ──────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--ink-06);
    display: flex;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 100;
    box-shadow: 0 -2px 12px rgba(35,32,27,.06);
}
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .55rem .25rem .45rem;
    text-decoration: none;
    color: var(--ink-30);
    font-size: .62rem;
    font-weight: 600;
    transition: color .15s ease;
    gap: .15rem;
    min-height: 52px;
    justify-content: center;
}
.bottom-nav a.active {
    color: var(--aegean);
}
.bottom-nav a.active .nav-icon {
    background: rgba(46,110,120,.1);
    border-radius: 12px;
}
.nav-icon {
    font-size: 1.25rem;
    line-height: 1;
    padding: .15rem .5rem;
    transition: background .15s ease;
}

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
    background: var(--aegean);
    color: var(--white);
    padding: 1.5rem 1.25rem 2.5rem;
    position: relative;
    overflow: hidden;
}
.app-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0; right: 0;
    height: 24px;
    background: var(--limestone);
    border-radius: 24px 24px 0 0;
}
/* Sun motif */
.app-header::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(232,169,59,.25) 0%, transparent 70%);
    border-radius: 50%;
}
.header-brand { font-size: .65rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .7; }
.header-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; margin-top: .15rem; }
.header-sub { font-size: .8rem; opacity: .65; margin-top: .1rem; }

/* ── Stagger Animation ──────────────────────────────────────── */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.stagger { animation: fadeSlideUp .4s ease-out both; }
.stagger:nth-child(1) { animation-delay: .05s; }
.stagger:nth-child(2) { animation-delay: .1s; }
.stagger:nth-child(3) { animation-delay: .15s; }
.stagger:nth-child(4) { animation-delay: .2s; }
.stagger:nth-child(5) { animation-delay: .25s; }
.stagger:nth-child(6) { animation-delay: .3s; }
.stagger:nth-child(7) { animation-delay: .35s; }
.stagger:nth-child(8) { animation-delay: .4s; }

/* ── Checklist Check-off ────────────────────────────────────── */
.check-item {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .85rem 1rem;
    cursor: pointer;
    transition: background .12s ease;
    min-height: 48px;
    -webkit-user-select: none;
    user-select: none;
}
.check-item:active { background: var(--ink-06); }

.check-box {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 2px solid var(--ink-12);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s cubic-bezier(.34,1.56,.64,1);
    margin-top: 1px;
    position: relative;
    background: var(--white);
}
.check-box svg {
    width: 14px;
    height: 14px;
    stroke: var(--white);
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    transition: stroke-dashoffset .3s cubic-bezier(.34,1.56,.64,1) .05s;
}

.check-item[data-done="true"] .check-box {
    background: var(--aegean);
    border-color: var(--aegean);
    transform: scale(1.1);
    animation: checkPop .35s cubic-bezier(.34,1.56,.64,1);
}
.check-item[data-done="true"] .check-box svg {
    stroke-dashoffset: 0;
}
.check-item[data-done="true"] .check-label {
    color: var(--ink-30);
    text-decoration: line-through;
    text-decoration-color: var(--ink-12);
}

@keyframes checkPop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.25); }
    100% { transform: scale(1.1); }
}

.check-label {
    font-size: .875rem;
    color: var(--ink);
    line-height: 1.45;
    transition: color .2s ease;
    padding-top: 1px;
}

/* ── Breathing Pulse (active timer) ─────────────────────────── */
@keyframes breathe {
    0%, 100% { box-shadow: 0 0 0 0 rgba(232,169,59,.3); }
    50%      { box-shadow: 0 0 0 12px rgba(232,169,59,.0); }
}
.breathing {
    animation: breathe 3s ease-in-out infinite;
}

@keyframes pulseRing {
    0%   { transform: scale(.95); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}
.pulse-ring {
    position: absolute;
    inset: 0;
    border: 2px solid var(--marigold);
    border-radius: inherit;
    animation: pulseRing 2.5s ease-out infinite;
}

/* ── Celebration (100% complete) ────────────────────────────── */
@keyframes celebrate {
    0%   { transform: scale(1); }
    15%  { transform: scale(1.05); }
    30%  { transform: scale(1); }
    45%  { transform: scale(1.03); }
    60%  { transform: scale(1); }
}
.celebrate { animation: celebrate .6s ease; }

@keyframes confettiBurst {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-30px) scale(1.5); }
}

/* ── Section Header ─────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .65rem 1rem;
    background: var(--limestone);
    border-bottom: 1px solid var(--ink-06);
}
.section-title {
    font-family: var(--font-body);
    font-size: .78rem;
    font-weight: 700;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Deep clean section variant */
.section-deep .section-header {
    background: rgba(120,80,160,.06);
    border-bottom-color: rgba(120,80,160,.1);
}
.section-deep .section-title { color: #6B4F8A; }
.section-deep .check-item[data-done="true"] .check-box {
    background: #7B5BA0;
    border-color: #7B5BA0;
}

/* ── Hero Card (Start Cleaning / In Progress) ───────────────── */
.hero-card {
    background: linear-gradient(135deg, var(--aegean) 0%, var(--aegean-d) 100%);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    color: var(--white);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(46,110,120,.2);
}
.hero-card::before {
    content: '';
    position: absolute;
    top: -20px; right: -20px;
    width: 100px; height: 100px;
    background: radial-gradient(circle, rgba(232,169,59,.2) 0%, transparent 70%);
    border-radius: 50%;
}
.hero-card.active {
    background: linear-gradient(135deg, var(--marigold) 0%, #D49530 100%);
    box-shadow: 0 8px 24px rgba(232,169,59,.25);
}
.hero-card.active .hero-property { color: rgba(35,32,27,.6); }
.hero-card.active .hero-title { color: var(--ink); }
.hero-card.active .hero-timer { color: var(--ink); }

.hero-property { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.hero-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; margin: .25rem 0 .5rem; }
.hero-timer { font-family: var(--font-body); font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Stats Grid ─────────────────────────────────────────────── */
.stat-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: .85rem;
    text-align: center;
    border: 1px solid var(--ink-06);
}
.stat-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .65rem; font-weight: 600; color: var(--ink-50); text-transform: uppercase; letter-spacing: .05em; margin-top: .15rem; }

/* ── Info Banner ────────────────────────────────────────────── */
.info-banner {
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
}
.info-banner-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: .1rem; }
.info-banner-title { font-weight: 700; font-size: .85rem; }
.info-banner-text { font-size: .78rem; line-height: 1.5; margin-top: .15rem; }

.info-aegean   { background: rgba(46,110,120,.08); color: var(--aegean-d); }
.info-marigold { background: rgba(232,169,59,.1);  color: #7A5C1A; }
.info-purple   { background: rgba(120,80,160,.06); color: #5B3E7A; }
.info-danger   { background: rgba(192,80,58,.06);  color: var(--danger); }

/* ── Note/Pin ───────────────────────────────────────────────── */
.note-pin {
    font-size: .75rem;
    background: rgba(232,169,59,.1);
    color: #7A5C1A;
    padding: .4rem .65rem;
    border-radius: var(--radius-sm);
    line-height: 1.4;
}

/* ── Toggle Switch ──────────────────────────────────────────── */
.toggle-track {
    width: 48px;
    height: 28px;
    border-radius: 99px;
    background: var(--ink-12);
    position: relative;
    cursor: pointer;
    transition: background .2s ease;
    flex-shrink: 0;
}
.toggle-track.on { background: var(--aegean); }
.toggle-track.purple.on { background: #7B5BA0; }
.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.toggle-track.on .toggle-thumb { transform: translateX(20px); }

/* ── Page container ─────────────────────────────────────────── */
.page-content {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 1rem 6rem;
}

/* ── Dividers ───────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--ink-06); }

/* ── Utilities ──────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: .35rem; }
.gap-sm { gap: .5rem; }
.gap-md { gap: .75rem; }
.gap-lg { gap: 1rem; }
.gap-xl { gap: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }
.mt-xs { margin-top: .35rem; }
.mt-sm { margin-top: .5rem; }
.mt-md { margin-top: .75rem; }
.mt-lg { margin-top: 1rem; }
.mt-xl { margin-top: 1.5rem; }
.mb-sm { margin-bottom: .5rem; }
.mb-md { margin-bottom: .75rem; }
.mb-lg { margin-bottom: 1rem; }
.mb-xl { margin-bottom: 1.5rem; }
.p-md { padding: .75rem; }
.text-sm { font-size: .8rem; }
.text-xs { font-size: .72rem; }
.text-muted { color: var(--ink-50); }
.text-aegean { color: var(--aegean); }
.text-marigold { color: var(--marigold); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.hidden { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Alpine cloak ───────────────────────────────────────────── */
[x-cloak] { display: none !important; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-12); border-radius: 99px; }
