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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f8f9fa;
    color: #2d2d2d;
    line-height: 1.5;
}

/* --- Focus-visible (keyboard accessibility) --- */
:focus-visible {
    outline: 2px solid #0d7377;
    outline-offset: 2px;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid #0d7377;
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- Header --- */
header {
    background: linear-gradient(135deg, #064d50 0%, #0d7377 100%);
    color: #fff;
    padding: 1.2rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(0,0,0,0.15);
    transition: padding 0.25s ease, box-shadow 0.25s ease;
}

header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0d7377 0%, #2ec4c4 50%, #0d7377 100%);
    opacity: 0.6;
}

header.compact {
    padding: 0.6rem 1rem;
}

header.compact .header-text p {
    opacity: 0;
    max-height: 0;
    margin: 0;
    overflow: hidden;
}

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

a.header-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    color: inherit;
}

.header-logo img {
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: transform 0.25s ease;
}

header.compact .header-logo img {
    transform: scale(0.7);
}

.header-text {
    text-align: left;
}

header h1 {
    font-size: 2.2rem;
    letter-spacing: -0.02em;
    transition: font-size 0.25s ease;
}

header p {
    margin-top: 0.1rem;
    font-size: 1rem;
    color: #a0d8d8;
    font-style: italic;
    font-weight: 300;
    max-height: 1.5em;
    overflow: hidden;
    transition: opacity 0.25s ease, max-height 0.25s ease, margin 0.25s ease;
}

/* --- Header nav --- */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #e0f4f4;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.header-nav-link:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 2px 12px rgba(13, 115, 119, 0.25);
}

.header-nav-icon {
    font-size: 0.95rem;
    line-height: 1;
}

/* --- Hero section (landing page) --- */
.hero {
    text-align: center;
    padding: 2.5rem 1rem 0;
    max-width: 640px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #064d50;
    margin-bottom: 0.4rem;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: #666;
    font-weight: 400;
    line-height: 1.5;
}

/* --- Search form --- */
.search-section {
    max-width: 600px;
    margin: 1.5rem auto 2rem;
    padding: 0 1rem;
}

.search-bar {
    display: flex;
    gap: 0.5rem;
}

.search-form input[type="text"] {
    flex: 1;
    padding: 0.85rem 1.2rem;
    font-size: 1.05rem;
    border: 2px solid #dde2e5;
    border-radius: 12px;
    outline: none;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-form input[type="text"]:focus {
    border-color: #0d7377;
    box-shadow: 0 2px 12px rgba(13, 115, 119, 0.18);
    outline: none;
}

.search-form button[type="submit"] {
    padding: 0.85rem 1.8rem;
    font-size: 1.05rem;
    font-weight: 600;
    background: #0d7377;
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(13, 115, 119, 0.2);
}

.search-form button[type="submit"]:hover {
    background: #0a5c5f;
    box-shadow: 0 4px 12px rgba(13, 115, 119, 0.3);
}

/* --- Filter bar (collapsible) --- */
.filter-bar {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
    padding: 0.8rem 1rem;
    background: #fff;
    border: none;
    border-radius: 12px;
    align-items: flex-end;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 120px;
}

.filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-group select {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    border: 1.5px solid #cdd5d8;
    border-radius: 8px;
    background: #fff;
}

.filter-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.8rem;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: #444;
    cursor: pointer;
}

.filter-checkbox input[type="checkbox"] {
    cursor: pointer;
}

/* --- Nutrition filters --- */
.nutrition-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.nutrition-filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.82rem;
    color: #444;
}

.nutrition-filter-item span {
    font-weight: 500;
}

.nutrition-filter-item input[type="number"] {
    width: 90px;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    border: 1.5px solid #cdd5d8;
    border-radius: 8px;
    background: #fff;
}

.nutrition-filter-item input[type="number"]:focus {
    outline: none;
    border-color: #0d7377;
    box-shadow: 0 0 0 2px rgba(13, 115, 119, 0.15);
}

/* --- Loading overlay --- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 249, 250, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.loading-overlay.active {
    display: flex;
}

.loading-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 1.6rem 1.8rem 1.4rem;
    box-shadow: 0 12px 32px rgba(0,0,0,0.1);
    text-align: center;
    min-width: 220px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.loading-chef {
    margin: 0 auto 0.8rem;
    animation: chef-scan 2.5s ease-in-out infinite;
}

.loading-chef svg {
    display: block;
    margin: 0 auto;
}

.loading-text {
    font-weight: 600;
    color: #3a3a3a;
}

.loading-subtext {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: #7a7a7a;
}

@keyframes chef-scan {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-16px) rotate(3deg); }
    75% { transform: translateX(16px) rotate(-3deg); }
}

/* --- Main content --- */
main {
    max-width: 900px;
    margin: 0 auto 2rem;
    padding: 0 1rem;
}

.results-intro {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    color: #555;
    background: #fff;
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    font-size: 0.92rem;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}

/* --- Error / info messages --- */
.message-box {
    background: #fff5f5;
    border: none;
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.8rem;
    color: #8b2020;
    text-align: center;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}

.message-box.info {
    background: #eef8f8;
    color: #0a5c5f;
}

/* --- Recipe card --- */
.recipe-card {
    background: #fff;
    border: none;
    border-radius: 14px;
    padding: 1.8rem;
    margin-bottom: 1.8rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.recipe-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.recipe-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.3rem;
}

.recipe-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0;
    letter-spacing: -0.02em;
}

/* --- Score badge --- */
.score-badge {
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.25rem 0.9rem;
    border-radius: 999px;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.score-green {
    background: #e6f4ea;
    color: #1e7e34;
    border: none;
}

.score-yellow {
    background: #fff8e1;
    color: #b8860b;
    border: none;
}

.score-red {
    background: #fdecea;
    color: #c62828;
    border: none;
}

.recipe-card .source {
    font-size: 0.85rem;
    color: #777;
    word-break: break-all;
    margin-bottom: 1rem;
}

.recipe-card .source a {
    color: #0d7377;
    text-decoration: none;
}

.recipe-card .source a:hover {
    text-decoration: underline;
}

/* --- Recipe image --- */
.recipe-image {
    margin-bottom: 1.2rem;
    border-radius: 10px;
    overflow: hidden;
}

.recipe-image img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
}

/* --- Time badges --- */
.times {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.time-badge {
    background: #eef8f8;
    border-radius: 8px;
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    color: #0a5c5f;
}

/* --- Nutrition bar --- */
.nutrition-bar {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1.2rem;
    padding: 0.6rem 0.8rem;
    background: #f0faf0;
    border: none;
    border-radius: 10px;
    font-size: 0.82rem;
    color: #2d5a2d;
}

.nutrition-item {
    white-space: nowrap;
}

.nutrition-item + .nutrition-item::before {
    content: "\00b7";
    margin-right: 0.6rem;
    color: #8cb88c;
}

.nutrition-serving {
    margin-left: auto;
    font-size: 0.78rem;
    font-style: italic;
    color: #5a8a5a;
}

/* --- Recipe meta (difficulty + dietary) --- */
.recipe-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.difficulty-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.difficulty-beginner {
    background: #e6f4ea;
    color: #1e7e34;
    border: none;
}

.difficulty-intermediate {
    background: #fff8e1;
    color: #b8860b;
    border: none;
}

.difficulty-advanced {
    background: #fdecea;
    color: #c62828;
    border: none;
}

.dietary-tag {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #eef8f8;
    color: #0a5c5f;
    border: none;
}

.method-tag {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #e6f4f4;
    color: #2a6a6a;
    border: none;
}

/* --- Ingredients --- */
.recipe-card h3 {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    color: #333;
    border-left: 3px solid #0d7377;
    padding-left: 0.6rem;
}

.recipe-card ul {
    margin: 0 0 0.4rem 1.4rem;
    color: #444;
}

.recipe-card ul li {
    margin-bottom: 0.25rem;
}

/* --- Instructions --- */
.recipe-card ol {
    margin: 0 0 0.5rem 1.4rem;
    color: #444;
}

.recipe-card ol li {
    margin-bottom: 0.5rem;
}

/* --- Ingredient / instruction toggle --- */
.ingredient-toggle,
.instruction-toggle {
    background: none;
    border: none;
    color: #0d7377;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.2rem 0;
    font-weight: 600;
    margin-bottom: 1.2rem;
    display: block;
}

.ingredient-toggle:hover,
.instruction-toggle:hover {
    color: #08484a;
    text-decoration: underline;
}

/* --- Card actions (save + copy buttons) --- */
.card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid #eaf2f2;
}

.save-btn {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: #0d7377;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.save-btn:hover {
    background: #0a5c5f;
    box-shadow: 0 2px 8px rgba(13, 115, 119, 0.25);
}

.save-btn.saved {
    background: #064d50;
    color: #fff;
}

.save-btn.saved:hover {
    background: #c0392b;
}

.copy-url-btn {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: transparent;
    color: #0d7377;
    border: 1.5px solid #cdd5d8;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-url-btn:hover {
    background: #0d7377;
    color: #fff;
    border-color: #0d7377;
}

.export-pdf-btn {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: transparent;
    color: #c0392b;
    border: 1.5px solid #f0d0cc;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.export-pdf-btn:hover {
    background: #c0392b;
    color: #fff;
    border-color: #c0392b;
}

.export-pdf-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.analysis-btn {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: transparent;
    color: #8b7a2b;
    border: 1.5px solid #e8dca0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.analysis-btn:hover {
    background: #8b7a2b;
    color: #fff;
    border-color: #8b7a2b;
}

.analysis-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* --- Recipe analysis (AI pros/cons) --- */
.recipe-analysis {
    margin-top: 1rem;
    padding: 1rem 1.2rem;
    background: #f8f9fa;
    border: none;
    border-radius: 12px;
    display: flex;
    gap: 2rem;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.04);
}

.analysis-pros, .analysis-cons {
    flex: 1;
}

.analysis-pros h4 {
    font-size: 0.9rem;
    color: #1e7e34;
    margin-bottom: 0.4rem;
}

.analysis-cons h4 {
    font-size: 0.9rem;
    color: #c62828;
    margin-bottom: 0.4rem;
}

.analysis-pros-list, .analysis-cons-list {
    margin: 0 0 0 1.2rem;
    font-size: 0.88rem;
    color: #444;
    line-height: 1.6;
}

.analysis-pros-list li, .analysis-cons-list li {
    margin-bottom: 0.3rem;
}

.truncated-note {
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
}

/* --- Comparison box --- */
.comparison-box {
    margin-bottom: 2rem;
}

.comparison-toggle {
    background: transparent;
    border: 1.5px solid #e8dca0;
    border-radius: 10px;
    color: #8b7a2b;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.4rem 1rem;
    white-space: nowrap;
    transition: all 0.2s;
}

.comparison-toggle:hover {
    background: #8b7a2b;
    color: #fff;
    border-color: #8b7a2b;
}

/* --- Comparison table --- */
.comparison-section {
    margin-top: 1rem;
}

.comparison-table-wrapper {
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: #fff;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.comparison-table th,
.comparison-table td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.comparison-table thead th {
    background: #eef8f8;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #d0e5e5;
}

.comparison-table tbody td:first-child {
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.comparison-table tbody tr:last-child td {
    border-bottom: none;
}

.comparison-table tbody tr:hover {
    background: #eef8f8;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    margin: 2rem 0 1rem;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    background: #fff;
    color: #064d50;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

a.pagination-btn:hover {
    background: #0d7377;
    color: #fff;
    box-shadow: 0 2px 8px rgba(13, 115, 119, 0.25);
}

.pagination-current {
    background: #0d7377;
    color: #fff;
}

/* --- Popular searches --- */
.popular-searches {
    margin-top: 2rem;
}

.popular-heading {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.8rem;
}

.popular-card {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.2rem 1rem;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}

/* Image-backed popular cards */
.popular-card-img {
    position: relative;
    overflow: hidden;
    padding: 0;
    min-height: 140px;
    background: #064d50;
}

.popular-card-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.75;
}

.popular-card-img:hover img {
    transform: scale(1.08);
    opacity: 0.55;
}

.popular-card-label {
    position: relative;
    z-index: 1;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
    padding: 1.2rem 1rem;
    display: flex;
    align-items: flex-end;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 60%);
}

.popular-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* --- How it works strip --- */
.how-it-works {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 640px;
    margin: 0 auto 2rem;
    padding: 0 1rem;
}

.how-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.how-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #0d7377;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.how-text {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    line-height: 1.3;
}

.how-text strong {
    color: #064d50;
}

.how-text span {
    color: #888;
    font-size: 0.78rem;
}

.how-arrow {
    color: #ccc;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* --- Feature highlights --- */
.features {
    max-width: 900px;
    margin: 2.5rem auto 1rem;
    padding: 0 1rem;
}

.features-heading {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #064d50;
    text-align: center;
    margin-bottom: 1.2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.feature-card {
    background: #fff;
    border: none;
    border-radius: 14px;
    padding: 1.4rem 1.2rem;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.feature-icon {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.feature-card strong {
    display: block;
    font-size: 0.92rem;
    color: #064d50;
    margin-bottom: 0.3rem;
}

.feature-card p {
    font-size: 0.82rem;
    color: #777;
    line-height: 1.4;
    margin: 0;
}

/* --- Popular searches (categorized) --- */
.popular-searches .popular-heading {
    margin-top: 1.5rem;
}

.popular-searches .popular-heading:first-child {
    margin-top: 0;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: #aaa;
    font-size: 0.8rem;
    border-top: 1px solid #e8ecec;
    margin-top: 2rem;
}

.footer-disclaimer {
    max-width: 640px;
    margin: 0 auto 0.8rem;
    line-height: 1.5;
    color: #999;
}

.footer-links {
    margin-bottom: 0.6rem;
}

.footer-links a {
    color: #0d7377;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-brand {
    color: #bbb;
}

/* --- Terms of Service page --- */
.terms-page {
    max-width: 720px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.terms-page h2 {
    font-size: 1.6rem;
    color: #064d50;
    margin-bottom: 0.3rem;
}

.terms-updated {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 2rem;
}

.terms-page h3 {
    font-size: 1.05rem;
    color: #333;
    margin: 1.5rem 0 0.4rem;
}

.terms-page p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 0.6rem;
}

/* --- Grocery List: button on recipe cards --- */
.grocery-btn {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: #1e7e34;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.grocery-btn:hover {
    background: #16692a;
    box-shadow: 0 2px 8px rgba(30, 126, 52, 0.25);
}

.grocery-btn.grocery-added {
    background: #e6f4ea;
    color: #1e7e34;
}

.grocery-btn.grocery-confirming {
    background: #1e7e34;
    color: #fff;
}

.grocery-cancel-btn {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: transparent;
    color: #888;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.grocery-cancel-btn:hover {
    color: #c0392b;
    border-color: #c0392b;
}

.grocery-select-cb {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 0.5rem;
    vertical-align: middle;
    flex-shrink: 0;
}

.grocery-selecting .ingredient-list li {
    display: flex !important;
    align-items: center;
    padding: 0.3rem 0;
}

/* --- Grocery badge in header --- */
.grocery-badge {
    display: inline-block;
    background: #c0392b;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.4rem;
    min-width: 1.2rem;
    text-align: center;
    vertical-align: middle;
}

/* --- Grocery List page --- */
.grocery-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.grocery-toolbar button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-checked {
    background: transparent;
    color: #b8860b;
    border: 1.5px solid #f0dca0;
}
.btn-clear-checked:hover {
    background: #b8860b;
    color: #fff;
    border-color: #b8860b;
}

.btn-clear-all {
    background: transparent;
    color: #c0392b;
    border: 1.5px solid #f0d0cc;
}
.btn-clear-all:hover {
    background: #c0392b;
    color: #fff;
    border-color: #c0392b;
}

.btn-print {
    background: #0d7377;
    color: #fff;
    border: none;
}
.btn-print:hover {
    background: #0a5c5f;
    box-shadow: 0 2px 8px rgba(13, 115, 119, 0.25);
}

/* --- Aisle groups --- */
.grocery-aisle {
    background: #fff;
    border: none;
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: box-shadow 0.2s;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.grocery-aisle:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.aisle-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.2rem;
    background: #eef8f8;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #d0e5e5;
    margin: 0;
}

.aisle-count {
    margin-left: auto;
    font-size: 0.8rem;
    font-weight: 400;
    color: #888;
}

.grocery-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.grocery-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-bottom: 1px solid #eaf2f2;
}

.grocery-item:last-child {
    border-bottom: none;
}

.grocery-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    cursor: pointer;
    font-size: 0.92rem;
    color: #333;
}

.grocery-check input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.grocery-item.checked .grocery-text {
    text-decoration: line-through;
    color: #aaa;
}

.grocery-source {
    font-size: 0.75rem;
    color: #999;
    white-space: nowrap;
    font-style: italic;
}

.grocery-remove {
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    line-height: 1;
    transition: color 0.2s;
}

.grocery-remove:hover {
    color: #c0392b;
}

/* --- Filter toggle --- */
.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #fff;
    border: 1.5px solid #cdd5d8;
    border-radius: 10px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.filter-toggle:hover {
    border-color: #0d7377;
    color: #0d7377;
}

.filter-toggle .arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.filter-toggle.open .arrow {
    transform: rotate(180deg);
}

.filter-bar.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    margin-top: 0;
    box-shadow: none;
}

.filter-active-count {
    background: #0d7377;
    color: #fff;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    margin-left: 0.2rem;
}

/* --- Star ratings --- */
.star-rating {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.85rem;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.star-rating .stars {
    color: #f0ad4e;
    letter-spacing: 1px;
    font-size: 0.95rem;
}

.star-rating .rating-num {
    color: #888;
    font-size: 0.8rem;
    margin-left: 0.15rem;
}

.star-rating .rating-count {
    color: #aaa;
    font-size: 0.75rem;
}

/* --- Source domain display --- */
.source-domain {
    font-weight: 500;
}

/* --- Mobile responsive --- */
@media (max-width: 768px) {
    header {
        padding: 0.8rem 1rem;
    }

    .header-inner {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .header-brand {
        width: 100%;
        justify-content: center;
    }

    header h1 {
        font-size: 1.6rem;
    }

    header p {
        font-size: 0.85rem;
    }

    .header-nav {
        gap: 0.4rem;
    }

    .header-nav-link {
        font-size: 0.8rem;
        padding: 0.3rem 0.7rem;
    }

    .search-section {
        margin: 1.2rem auto;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-form button[type="submit"] {
        width: 100%;
    }

    .filter-bar {
        flex-direction: column;
        gap: 0.8rem;
    }

    .recipe-card {
        padding: 1.2rem;
    }

    .recipe-card:hover {
        transform: none;
    }

    .recipe-card h2 {
        font-size: 1.25rem;
    }

    .recipe-card-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .card-actions {
        gap: 0.4rem;
    }

    .save-btn, .copy-url-btn, .export-pdf-btn, .analysis-btn, .grocery-btn, .grocery-cancel-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.78rem;
    }

    .recipe-analysis {
        flex-direction: column;
        gap: 1rem;
    }

    .hero {
        padding: 1.8rem 1rem 0;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .how-it-works {
        flex-direction: column;
        gap: 0.6rem;
        align-items: stretch;
        text-align: center;
    }

    .how-step {
        justify-content: center;
    }

    .how-arrow {
        display: none;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .popular-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .comparison-table-wrapper {
        margin: 0 -1.2rem;
        padding: 0 0.5rem;
    }

    .nutrition-bar {
        font-size: 0.78rem;
        gap: 0.4rem;
        padding: 0.5rem 0.6rem;
    }
}

@media (max-width: 480px) {
    .header-inner {
        flex-direction: column;
        text-align: center;
        gap: 0.4rem;
    }

    .header-brand {
        flex-direction: column;
        gap: 0.3rem;
    }

    .header-text {
        text-align: center;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .header-nav-link {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }

    .hero-title {
        font-size: 1.4rem;
    }

    .hero-subtitle {
        font-size: 0.88rem;
    }

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

    .feature-card {
        padding: 1.1rem 1rem;
    }

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

    .popular-card {
        padding: 0.9rem 0.8rem;
        font-size: 0.88rem;
    }

    .times {
        gap: 0.5rem;
    }

    .star-rating {
        margin-left: 0;
        margin-top: 0.3rem;
    }
}

/* --- Print styles for grocery list --- */
@media print {
    header, footer, .grocery-toolbar, .grocery-remove, .grocery-source {
        display: none !important;
    }
    .grocery-aisle {
        break-inside: avoid;
        border: none;
        box-shadow: none;
    }
    .aisle-heading {
        background: none;
        border-bottom: 2px solid #333;
        padding-left: 0;
    }
    .grocery-item {
        padding-left: 0;
    }
    body {
        background: #fff;
    }
}
