@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ===== VARIABLES ===== */
:root {
    --cream:        #faf6f0;
    --warm-white:   #ffffff;
    --parchment:    #f2ead8;
    --gold:         #c49a3c;
    --gold-light:   #e8c97a;
    --olive:        #5a6e3a;
    --olive-light:  #e8eed8;
    --charcoal:     #1e1e1e;
    --text:         #2d2620;
    --muted:        #7a6f64;
    --border:       rgba(196,154,60,0.2);
    --shadow-warm:  rgba(196,154,60,0.12);
    --max-width:    1100px;
}

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

html { scroll-behavior: smooth; }

body {
    background-color: var(--cream);
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ===== CONTAINER ===== */
.container { max-width: var(--max-width); }

/* ===== TYPOGRAPHY ===== */
h1 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    color: var(--charcoal);
    line-height: 1.15;
    letter-spacing: -0.5px;
    text-align: center;
    margin-bottom: 0.4rem;
}

h2 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
    color: var(--charcoal);
    letter-spacing: -0.3px;
}

h3 { font-family: 'DM Sans', sans-serif; font-weight: 600; }

/* ===== NAVBAR ===== */
.navbar {
    background: var(--charcoal) !important;
    border-bottom: 2px solid var(--gold);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-family: 'DM Serif Display', serif !important;
    font-size: 1.25rem !important;
    color: var(--gold) !important;
    letter-spacing: 0.3px;
}

.navbar-nav .nav-link {
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.75) !important;
    padding: 0.4rem 0.85rem !important;
    border-radius: 2rem;
    transition: color 0.2s, background 0.2s;
}

.navbar-nav .nav-link:hover {
    color: var(--gold) !important;
    background: rgba(196,154,60,0.1);
}

/* ===== HERO ===== */
#hero {
    background: linear-gradient(160deg, var(--parchment) 0%, #ede3cc 100%);
    border-bottom: 2px solid var(--border);
    padding: 4rem 0 3rem;
    position: relative;
    overflow: hidden;
}

#hero::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196,154,60,0.12) 0%, transparent 70%);
    pointer-events: none;
}

#hero h1 { margin-bottom: 0.5rem; }

#hero h3 {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

#hero .img-fluid {
    border-radius: 1rem;
    box-shadow: 0 16px 48px rgba(0,0,0,0.14);
    border: 3px solid var(--parchment);
    max-height: 420px;
    object-fit: cover;
    width: 100%;
}

/* ===== NUTRITION SCORE ===== */
#nutrition-score {
    margin: 1.25rem 0;
}

#nutrition-score .rounded-pill {
    background: var(--warm-white) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 4px 16px var(--shadow-warm);
    font-family: 'DM Sans', sans-serif;
}

/* ===== SECTIONS ===== */
section {
    background: var(--warm-white);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    box-shadow: 0 2px 16px var(--shadow-warm);
}

section h2 {
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--parchment);
    position: relative;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0;
    width: 48px; height: 2px;
    background: var(--gold);
    border-radius: 1px;
}

/* ===== INGREDIENT CARDS ===== */
.ingredient-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid var(--border) !important;
    box-shadow: 0 2px 12px var(--shadow-warm);
    background: var(--warm-white);
    border-radius: 0.875rem !important;
    overflow: hidden;
    height: 100%;
}

.ingredient-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(196,154,60,0.18);
}

.ingredient-img-wrapper {
    height: 160px;
    background: var(--cream);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.ingredient-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 10px;
    transition: transform 0.3s ease;
}

.ingredient-card:hover .ingredient-img {
    transform: scale(1.06);
}

.ingredient-card .card-title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--charcoal);
}

.ingredient-card .card-text {
    font-size: 0.78rem;
    color: var(--muted);
}

/* ===== NUTRISCORE BADGES ===== */
.nutriscore-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.5rem;
    font-weight: 800;
    color: #ffffff;
    font-size: 1.1rem;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
    font-family: 'DM Sans', sans-serif;
}

.nutriscore-badge:hover { transform: scale(1.12); }

.nutriscore-a { background-color: #00823f; }
.nutriscore-b { background-color: #85bb2f; }
.nutriscore-c { background-color: #fecb02; color: #333 !important; }
.nutriscore-d { background-color: #ee8100; }
.nutriscore-e { background-color: #e63e11; }
.nutriscore-unknown { background-color: var(--muted); }

/* ===== STEPS ===== */
#steps { counter-reset: step; }

#steps .list-group-item {
    counter-increment: step;
    position: relative;
    padding: 1.1rem 1.25rem 1.1rem 4.5rem;
    border: none;
    border-bottom: 1px solid var(--parchment);
    background: transparent;
    font-size: 0.97rem;
    color: var(--text);
    transition: background 0.2s;
}

#steps .list-group-item:last-child { border-bottom: none; }

#steps .list-group-item:hover { background: var(--cream); }

#steps .list-group-item::before {
    content: counter(step);
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.4rem;
    height: 2.4rem;
    line-height: 2.4rem;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    font-family: 'DM Sans', sans-serif;
    box-shadow: 0 2px 8px rgba(196,154,60,0.3);
}

/* ===== SEARCH SECTION ===== */
.search-section {
    background: linear-gradient(135deg, var(--olive-light) 0%, #dfe8c8 100%) !important;
    border: 1px solid rgba(90,110,58,0.2) !important;
    border-radius: 1rem !important;
    box-shadow: 0 4px 20px rgba(90,110,58,0.08) !important;
}

.search-section h3 { color: var(--olive) !important; }

#searchInput {
    border: 1.5px solid rgba(90,110,58,0.3) !important;
    background: var(--warm-white);
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#searchInput:focus {
    border-color: var(--olive) !important;
    box-shadow: 0 0 0 3px rgba(90,110,58,0.15) !important;
    outline: none;
}

#searchButton {
    background: var(--olive) !important;
    border-color: var(--olive) !important;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: background 0.2s, transform 0.15s;
}

#searchButton:hover {
    background: #4a5c2e !important;
    transform: translateY(-1px);
}

.search-result-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border) !important;
    border-radius: 0.875rem !important;
    overflow: hidden;
    height: 100%;
    background: var(--warm-white);
}

.search-result-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px var(--shadow-warm);
}

.search-result-card .btn-outline-primary {
    border-color: var(--olive) !important;
    color: var(--olive) !important;
    font-size: 0.82rem;
    font-weight: 600;
}

.search-result-card .btn-outline-primary:hover {
    background: var(--olive) !important;
    color: #fff !important;
}

/* ===== SKELETON ===== */
.skeleton {
    background: linear-gradient(90deg, #ede8df 25%, #e0d9cc 50%, #ede8df 75%);
    background-size: 200% 100%;
    animation: shimmer 1.6s infinite;
    border-radius: 4px;
}

.skeleton-image  { width: 100%; height: 160px; border-radius: 0.875rem 0.875rem 0 0; }
.skeleton-title  { height: 1.2rem; width: 65%; margin-bottom: 0.75rem; }
.skeleton-subtitle { height: 0.8rem; width: 40%; margin-bottom: 1rem; }
.skeleton-badge  { height: 2.2rem; width: 2.2rem; border-radius: 0.5rem; }

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

/* ===== FOOTER ===== */
footer {
    font-size: 0.875rem;
    background: var(--charcoal) !important;
    border-top: 2px solid var(--gold);
}

footer a.text-warning {
    color: var(--gold-light) !important;
    text-decoration: none;
    transition: color 0.2s;
}
footer a.text-warning:hover { color: #fff !important; }

/* ===== UTILITIES ===== */
.lead { font-size: 1.05rem; color: var(--muted); font-style: italic; }
.border-bottom { border-color: var(--border) !important; }
hr { border-color: var(--border) !important; opacity: 1; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 576px) {
    section { padding: 1.25rem; }
    #steps .list-group-item { padding-left: 3.5rem; }
    #steps .list-group-item::before { width: 2rem; height: 2rem; line-height: 2rem; font-size: 0.875rem; }
    #hero { padding: 2.5rem 0 2rem; }
}