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

:root {
    --green-dark:  #2D6A4F;
    --green-mid:   #40916C;
    --green-light: #74C69D;
    --cream:       #FFF8F0;
    --orange:      #F4A261;
    --orange-dark: #E76F51;
    --text:        #2C3E50;
    --text-light:  #6B7280;
    --border:      #E5E7EB;
    --white:       #FFFFFF;
    --shadow:      0 2px 12px rgba(0,0,0,.08);
    --radius:      12px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--cream);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ── Nav ──────────────────────────────────────────────────── */
nav {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: .875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green-dark);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.nav-brand span { font-size: 1.4rem; }

.nav-links { display: flex; align-items: center; gap: 1rem; }

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: .9rem;
    transition: color .2s;
}

.nav-links a:hover { color: var(--green-dark); }

/* ── Layout ───────────────────────────────────────────────── */
.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.container-sm {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card + .card { margin-top: 1rem; }

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 1rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .65rem 1.25rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: opacity .2s, transform .1s;
}

.btn:active { transform: scale(.98); }
.btn:hover { opacity: .9; }

.btn-primary {
    background: var(--green-dark);
    color: var(--white);
}

.btn-secondary {
    background: var(--white);
    color: var(--green-dark);
    border: 2px solid var(--green-dark);
}

.btn-orange {
    background: var(--orange);
    color: var(--white);
}

.btn-danger {
    background: #EF4444;
    color: var(--white);
}

.btn-full { width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.2rem; }

label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .4rem;
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
textarea,
select {
    width: 100%;
    padding: .65rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color .2s;
    outline: none;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--green-mid);
}

textarea { resize: vertical; min-height: 100px; }

.hint {
    font-size: .8rem;
    color: var(--text-light);
    margin-top: .3rem;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    padding: .85rem 1.1rem;
    border-radius: 8px;
    font-size: .9rem;
    margin-bottom: 1.2rem;
}

.alert-error   { background: #FEE2E2; color: #B91C1C; border: 1px solid #FECACA; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ── Hero (homepage) ──────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 4rem 1.5rem 3rem;
}

.hero-emoji { font-size: 4rem; display: block; margin-bottom: 1rem; }

.hero h1 {
    font-size: 2.2rem;
    color: var(--green-dark);
    margin-bottom: .75rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 500px;
    margin: 0 auto 2rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Recipe grid ──────────────────────────────────────────── */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.recipe-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.25rem;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow .2s, transform .15s;
    display: block;
}

.recipe-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    transform: translateY(-2px);
}

.recipe-card-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--green-dark);
    margin-bottom: .4rem;
}

.recipe-card-meta {
    font-size: .8rem;
    color: var(--text-light);
}

.recipe-card-from {
    margin-top: .5rem;
    font-size: .85rem;
    color: var(--orange-dark);
    font-style: italic;
}

/* ── Recipe detail ────────────────────────────────────────── */
.recipe-header {
    margin-bottom: 2rem;
}

.recipe-header h1 {
    font-size: 1.8rem;
    color: var(--green-dark);
    margin-bottom: .25rem;
}

.recipe-from {
    font-size: 1rem;
    color: var(--orange-dark);
    font-style: italic;
    margin-bottom: .75rem;
}

.recipe-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: .875rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.recipe-meta span { display: flex; align-items: center; gap: .3rem; }

.recipe-section { margin-bottom: 2rem; }

.recipe-section h2 {
    font-size: 1.1rem;
    color: var(--green-dark);
    margin-bottom: .75rem;
    padding-bottom: .4rem;
    border-bottom: 2px solid var(--green-light);
}

.ingredients-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.ingredients-list li {
    padding: .4rem .6rem;
    background: var(--cream);
    border-radius: 6px;
    font-size: .95rem;
}

.steps-list {
    list-style: none;
    counter-reset: steps;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.steps-list li {
    display: flex;
    gap: .9rem;
    counter-increment: steps;
}

.steps-list li::before {
    content: counter(steps);
    background: var(--green-dark);
    color: white;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: .1rem;
}

/* ── Family code badge ────────────────────────────────────── */
.code-badge {
    display: inline-block;
    background: var(--green-dark);
    color: white;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: .3rem;
    padding: .75rem 1.5rem;
    border-radius: 10px;
    font-family: monospace;
    margin: 1rem 0;
}

/* ── Page title ───────────────────────────────────────────── */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 1.5rem;
}

.page-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    align-items: center;
    justify-content: space-between;
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state span { font-size: 3rem; display: block; margin-bottom: 1rem; }

/* ── Family switcher ──────────────────────────────────────── */
.family-tabs {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.family-tab {
    padding: .45rem 1rem;
    border-radius: 20px;
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid var(--green-dark);
    color: var(--green-dark);
    transition: background .2s, color .2s;
}

.family-tab.active, .family-tab:hover {
    background: var(--green-dark);
    color: white;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
    .hero h1 { font-size: 1.6rem; }
    .recipe-grid { grid-template-columns: 1fr; }
    .page-actions { flex-direction: column; align-items: flex-start; }
}
