/* Sourdough Starter Timer — style.css — Warm Artisan Bakery */

:root {
    --bg: #2C1810;
    --bg2: #3A1F12;
    --surface: #4A2818;
    --surface2: #5C3322;
    --border: #6B3D28;
    --primary: #D4A574;
    --secondary: #8B6F47;
    --accent: #F4E8D1;
    --cream: #FFF8F0;
    --text: #F4E8D1;
    --muted: #A07850;
    --red: #E8805A;
    --green: #7DB87A;
    --blue: #8AB4C4;
    --radius: 16px;
    --radius-sm: 8px;
}

body.light {
    --bg: #FFF8F0;
    --bg2: #F4E8D1;
    --surface: #FFFFFF;
    --surface2: #FDF4E8;
    --border: #D4A574;
    --text: #3A1F12;
    --muted: #8B6F47;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* ── Bubble field ─────────────────────────────────────── */
.bubble-field {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(212, 165, 116, 0.06);
    animation: float-up 18s ease-in-out infinite;
}

.b1 {
    width: 80px;
    height: 80px;
    left: 10%;
    animation-delay: 0s;
}

.b2 {
    width: 50px;
    height: 50px;
    left: 30%;
    animation-delay: 3s;
}

.b3 {
    width: 110px;
    height: 110px;
    left: 60%;
    animation-delay: 6s;
}

.b4 {
    width: 40px;
    height: 40px;
    left: 80%;
    animation-delay: 1s;
}

.b5 {
    width: 70px;
    height: 70px;
    left: 48%;
    animation-delay: 9s;
}

@keyframes float-up {

    0%,
    100% {
        transform: translateY(110vh) scale(0.8);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 0.4;
    }

    100% {
        transform: translateY(-10vh) scale(1.2);
        opacity: 0;
    }
}

/* ── Header ──────────────────────────────────────────── */
.app-header {
    position: relative;
    z-index: 10;
    background: rgba(44, 24, 16, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
}

body.light .app-header {
    background: rgba(255, 248, 240, 0.95);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 1180px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 22px;
    background: linear-gradient(135deg, var(--primary), #A0631A);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(212, 165, 116, 0.35);
}

h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}

.logo-sub {
    font-size: 0.62rem;
    color: var(--muted);
    margin-top: 3px;
}

.header-right {
    display: flex;
    gap: 8px;
}

/* ── Tab nav ─────────────────────────────────────────── */
.tab-nav {
    position: relative;
    z-index: 10;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 2px;
    padding: 8px 20px 0;
    overflow-x: auto;
    max-width: 1220px;
    margin: 0 auto;
    width: 100%;
}

.tab-btn {
    padding: 8px 16px;
    border-radius: 8px 8px 0 0;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    color: var(--muted);
    transition: all 0.18s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text);
    background: rgba(212, 165, 116, 0.08);
}

.tab-btn.active {
    background: var(--surface);
    border-color: var(--border);
    color: var(--primary);
}

/* ── Main ────────────────────────────────────────────── */
.app-main {
    position: relative;
    z-index: 1;
    padding: 20px;
    max-width: 1180px;
    margin: 0 auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ── Card ────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: background 0.3s;
}

.card-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ── Dashboard grid ──────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    grid-template-rows: auto auto;
    gap: 16px;
}

.starter-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* ── Rise Bubble ─────────────────────────────────────── */
.starter-avatar {
    width: 140px;
    height: 140px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rise-bubble {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #F4E8D1, #C4894C);
    box-shadow: 0 8px 30px rgba(212, 165, 116, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: rise-pulse 3s ease-in-out infinite;
    position: relative;
    cursor: default;
}

@keyframes rise-pulse {

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

    50% {
        transform: scale(1.06) translateY(-4px);
    }
}

.rise-face {
    font-size: 2rem;
    line-height: 1;
}

.rise-name {
    font-size: 0.6rem;
    font-family: 'Playfair Display', Georgia, serif;
    color: #7A4820;
    font-weight: 600;
    margin-top: 3px;
    max-width: 80px;
    text-align: center;
    word-break: break-word;
}

.starter-info {
    width: 100%;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
}

.info-label {
    color: var(--muted);
}

.info-val {
    font-weight: 600;
}

.feed-next {
    color: var(--red);
}

.name-input {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.8rem;
    outline: none;
    width: 100%;
    font-family: 'Playfair Display', Georgia, serif;
}

.name-input:focus {
    border-color: var(--primary);
}

/* ── Countdown ───────────────────────────────────────── */
.countdown {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    letter-spacing: 0.05em;
    margin: 8px 0;
}

.countdown-bar-wrap {
    background: var(--surface2);
    border-radius: 4px;
    height: 6px;
    margin-bottom: 12px;
    overflow: hidden;
}

.countdown-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #F4E8D1);
    border-radius: 4px;
    transition: width 1s linear;
}

.schedule-opts {}

.opt-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.opt-btn {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    transition: all 0.18s;
}

.opt-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #2C1810;
    font-weight: 600;
}

.small-input {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.78rem;
    outline: none;
    width: 80px;
}

/* ── Form ────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.fg {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fg-full {
    grid-column: span 2;
}

.field-label {
    font-size: 0.65rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.field-input,
.field-select {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.78rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.field-input:focus,
.field-select:focus {
    border-color: var(--primary);
}

.field-input::placeholder {
    color: var(--muted);
}

.field-ta {
    resize: vertical;
    min-height: 54px;
}

/* ── Chart ───────────────────────────────────────────── */
canvas {
    width: 100%;
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.68rem;
    color: var(--muted);
    margin-top: 6px;
}

.cl-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.cl-rise {
    background: var(--primary);
}

.cl-temp {
    background: var(--red);
}

/* ── History ─────────────────────────────────────────── */
.history-table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

th {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

tr:hover td {
    background: rgba(212, 165, 116, 0.04);
}

/* ── Heatmap ─────────────────────────────────────────── */
.heatmap-wrap {}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.hm-day {
    aspect-ratio: 1;
    border-radius: 4px;
    background: var(--surface2);
    cursor: default;
    transition: transform 0.1s;
}

.hm-day:hover {
    transform: scale(1.1);
}

.hm-0 {
    background: var(--surface2);
}

.hm-1 {
    background: rgba(212, 165, 116, 0.3);
}

.hm-2 {
    background: rgba(212, 165, 116, 0.55);
}

.hm-3 {
    background: rgba(212, 165, 116, 0.8);
}

.hm-4 {
    background: var(--primary);
}

.hm-month {
    margin-bottom: 14px;
}

.hm-month-label {
    font-size: 0.72rem;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 600;
}

/* ── Calculator ──────────────────────────────────────── */
.calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.recipe-result {
    margin-top: 12px;
    background: var(--surface2);
    border-radius: 10px;
    padding: 14px;
}

.recipe-result.hidden {
    display: none;
}

.rr-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.82rem;
}

.rr-label {
    color: var(--muted);
}

.rr-val {
    font-weight: 700;
    color: var(--primary);
}

/* ── Guide ───────────────────────────────────────────── */
.guide-card {
    max-width: 800px;
}

.guide-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.guide-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
}

.guide-q {
    padding: 12px 16px;
    background: var(--surface2);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.guide-q::after {
    content: '▼';
    font-size: 0.65rem;
    color: var(--muted);
    transition: transform 0.2s;
}

.guide-item.open .guide-q::after {
    transform: rotate(180deg);
}

.guide-a {
    display: none;
    padding: 12px 16px;
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--accent);
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.guide-item.open .guide-a {
    display: block;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.18s;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: #2C1810;
}

.btn-primary:hover {
    background: #C49060;
    box-shadow: 0 4px 14px rgba(212, 165, 116, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--primary);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.72rem;
}

.btn-feed {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
    font-size: 1rem;
    padding: 12px;
    border-radius: 12px;
}

/* ── Feed Toast ──────────────────────────────────────── */
.feed-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 500;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slide-in 0.25s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.feed-toast.hidden {
    display: none;
}

.ft-icon {
    font-size: 1.5rem;
}

.ft-msg {
    font-size: 0.82rem;
    color: var(--accent);
    font-weight: 500;
}

@keyframes slide-in {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
}

/* ── Empty state ─────────────────────────────────────── */
.empty-state {
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
    padding: 30px;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 800px) {

    .dashboard-grid,
    .calc-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .fg-full {
        grid-column: auto;
    }
}