:root {
    --gh-bg: #ffffff;
    --gh-bg-subtle: #f2f6fc;
    --gh-fg: #142033;
    --gh-fg-muted: #5b6b81;
    --gh-border: #dbe4f0;
    --gh-accent: #0066ff;
    --gh-accent-emphasis: #0050cc;
    --gh-accent-bg: #e6f0ff;
    --gh-accent-border: #b3d1ff;
    --gh-radius: 14px;
    --card-shadow: 0 1px 2px rgba(20, 32, 51, .04), 0 4px 12px rgba(20, 32, 51, .06);
}

* {
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    color: var(--gh-fg);
    background-color: var(--gh-bg);
    font-size: 16px;
}

a {
    color: var(--gh-accent);
}

a:hover {
    color: var(--gh-accent-emphasis);
}

.text-muted {
    color: var(--gh-fg-muted) !important;
}

/* Header */
.navbar {
    border-bottom: 1px solid var(--gh-border);
    background-color: rgba(255, 255, 255, .85) !important;
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    padding-top: .65rem;
    padding-bottom: .65rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-brand {
    font-weight: 800;
    color: var(--gh-accent) !important;
    letter-spacing: -0.02em;
}

.nav-link {
    color: var(--gh-fg) !important;
    font-size: .95rem;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--gh-accent) !important;
}

/* Tab bar: horizontal quick-filter chips under the header, tvfutbol.es-style */
.tab-bar {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding: .75rem 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
    display: none;
}

.tab-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: .4rem .9rem;
    border-radius: 999px;
    border: 1px solid var(--gh-border);
    background-color: var(--gh-bg);
    color: var(--gh-fg);
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.tab-chip:hover {
    border-color: var(--gh-accent);
    color: var(--gh-accent);
}

.tab-chip.active {
    background-color: var(--gh-accent);
    border-color: var(--gh-accent);
    color: #fff;
}

.form-control,
.form-select {
    border-color: var(--gh-border);
    border-radius: var(--gh-radius);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--gh-accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, .18);
}

/* Buttons: rounded, soft, comfortable tap targets (Apple HIG ~44pt) */
.btn {
    border-radius: 980px;
    font-weight: 600;
    font-size: .875rem;
    box-shadow: none !important;
    padding: .55rem 1.1rem;
}

.btn-sm {
    padding: .35rem .85rem;
    border-radius: 980px;
}

.btn-primary {
    background-color: var(--gh-accent);
    border-color: var(--gh-accent);
}

.btn-primary:hover {
    background-color: var(--gh-accent-emphasis);
    border-color: var(--gh-accent-emphasis);
}

.btn-outline-secondary {
    color: var(--gh-fg);
    border-color: var(--gh-border);
    background-color: var(--gh-bg);
}

.btn-outline-secondary:hover {
    background-color: var(--gh-bg-subtle);
    border-color: var(--gh-border);
    color: var(--gh-fg);
}

/* Cards: soft elevation instead of hard borders, generous rounding */
.card {
    border: none;
    border-radius: var(--gh-radius);
    box-shadow: var(--card-shadow) !important;
    overflow: hidden;
}

.recipe-card {
    transition: transform .18s ease, box-shadow .18s ease;
}

.recipe-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(20, 32, 51, .06), 0 8px 20px rgba(20, 32, 51, .1) !important;
}

.recipe-card-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recipe-card img,
.recipe-hero img {
    object-fit: cover;
}

.recipe-hero img {
    width: 100%;
    max-height: 420px;
    border-radius: var(--gh-radius);
}

.recipe-card img {
    width: 100%;
    height: 190px;
}

/* Badges / tags: pill outline like GitHub topics */
.badge {
    font-weight: 500;
    border-radius: 2em;
}

.text-bg-light {
    background-color: var(--gh-bg-subtle) !important;
    color: var(--gh-fg) !important;
    border: 1px solid var(--gh-border);
}

.text-bg-secondary {
    background-color: var(--gh-accent-bg) !important;
    color: var(--gh-accent-emphasis) !important;
    border: 1px solid var(--gh-accent-border);
}

.badge-difficulty {
    text-transform: capitalize;
}

/* Chips: small rounded pill elements used throughout for tags/meta/filters */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .2rem .55rem;
    border-radius: 999px;
    background-color: #eeeeee;
    border: 1px solid #e2e2e2;
    font-size: .7rem;
    line-height: 1.3;
    color: var(--gh-fg);
    text-decoration: none;
    white-space: nowrap;
}

.chip a {
    color: inherit;
    text-decoration: none;
}

a.chip:hover {
    border-color: var(--gh-accent);
    color: var(--gh-accent-emphasis);
    background-color: var(--gh-accent-bg);
}

.chip-accent {
    background-color: var(--gh-accent-bg);
    border-color: var(--gh-accent-border);
    color: var(--gh-accent-emphasis);
    font-weight: 700;
}

.chip-ingredient {
    font-weight: 500;
}

.chip-vegetarian {
    background-color: #e6f7e9;
    border-color: #b8e6c1;
    color: #1e7b34;
    font-weight: 600;
}

.chip-vegan {
    background-color: #e0f5e4;
    border-color: #a8dfb3;
    color: #17662a;
    font-weight: 600;
}

button.chip-btn,
.chip-btn {
    background-color: var(--gh-bg);
    cursor: pointer;
    font-weight: 700;
    min-width: 1.9rem;
    text-align: center;
}

button.chip-btn:hover,
a.chip-btn:hover {
    border-color: var(--gh-accent);
    color: var(--gh-accent-emphasis);
}

.chip-btn.disabled {
    opacity: .4;
    pointer-events: none;
    cursor: default;
}

.pagination-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.pagination-current {
    font-weight: 600;
    white-space: nowrap;
}

/* Mobile-first: comfortable touch targets on small screens without inflating chip size */
@media (max-width: 575.98px) {
    button.chip-btn,
    .chip-btn {
        min-width: 2.1rem;
        padding: .3rem 0;
    }

    h1.h2 {
        font-size: 1.5rem;
    }
}

/* Full-width hero search section with fading recipe-photo background */
.hero-fullwidth {
    position: relative;
    left: 50%;
    right: 50%;
    width: 100vw;
    margin-left: -50vw;
    margin-right: -50vw;
    margin-top: -1.5rem;
    margin-bottom: 2.5rem;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--gh-fg);
}

.hero-fullwidth-fallback {
    background: linear-gradient(135deg, var(--gh-accent), var(--gh-accent-emphasis));
}

.hero-bg-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.4s ease;
}

.hero-bg-slide.active {
    opacity: 1;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 20, 40, .45), rgba(10, 20, 40, .65));
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 640px;
}

.hero-content h1 {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

.hero-country-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .4rem;
    margin-top: 1rem;
}

.chip-hero {
    background-color: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .35);
    color: #fff;
    backdrop-filter: blur(4px);
}

a.chip-hero:hover {
    background-color: rgba(255, 255, 255, .3);
    color: #fff;
    border-color: rgba(255, 255, 255, .5);
}

@media (max-width: 767.98px) {
    .hero-fullwidth {
        min-height: 580px;
    }
}

.search-compound {
    display: flex;
    max-width: 640px;
    border: 1px solid var(--gh-border);
    border-radius: 999px;
    overflow: hidden;
    background-color: var(--gh-bg);
}

.search-type-select {
    border: none;
    background-color: #eeeeee;
    padding: .6rem .75rem;
    font-size: .8rem;
    color: var(--gh-fg);
    border-right: 1px solid var(--gh-border);
    flex-shrink: 0;
    max-width: 40%;
}

.search-type-select:focus {
    outline: none;
}

.search-input {
    flex: 1;
    border: none;
    padding: .6rem .75rem;
    font-size: .95rem;
    min-width: 0;
}

.search-input:focus {
    outline: none;
    box-shadow: none;
}

.search-submit {
    border: none;
    background-color: var(--gh-accent);
    color: #fff;
    padding: .6rem 1.1rem;
    font-weight: 600;
    font-size: .85rem;
}

.search-submit:hover {
    background-color: var(--gh-accent-emphasis);
}

/* Horizontal scrolling carousel for popular recipes */
.scroll-carousel {
    display: flex;
    gap: .9rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.scroll-carousel::-webkit-scrollbar {
    height: 6px;
}

.scroll-carousel::-webkit-scrollbar-thumb {
    background-color: var(--gh-border);
    border-radius: 999px;
}

.scroll-carousel-item {
    scroll-snap-align: start;
    flex: 0 0 200px;
    text-decoration: none;
    color: inherit;
}

/* Breadcrumbs */
.breadcrumb {
    font-size: .875rem;
}

/* List groups: flat borders, no shadow */
.list-group-item {
    border-color: var(--gh-border);
}

/* Pagination */
.page-link {
    color: var(--gh-fg);
    border-color: var(--gh-border);
}

.page-item.active .page-link {
    background-color: var(--gh-accent);
    border-color: var(--gh-accent);
}

/* Footer */
footer {
    border-top: 1px solid var(--gh-border);
    background-color: var(--gh-bg-subtle) !important;
    color: var(--gh-fg-muted) !important;
}

footer a {
    color: var(--gh-fg-muted);
}

footer a:hover {
    color: var(--gh-accent);
}

footer strong {
    color: var(--gh-fg) !important;
}

/* Alerts: flat */
.alert {
    border-radius: var(--gh-radius);
    box-shadow: none;
}

/* Allergy / intolerance exclusion filter */
.allergy-filter-menu {
    width: 300px;
    max-width: calc(100vw - 2rem);
    box-sizing: border-box;
    right: 0;
    left: auto;
    inset-inline-end: 0;
}

.allergy-filter-list {
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--gh-border);
    border-radius: var(--gh-radius);
    padding: .5rem .75rem;
    box-sizing: border-box;
}

.allergy-filter-option {
    padding: .15rem 0;
    display: flex;
    align-items: flex-start;
    gap: .4rem;
}

.allergy-filter-option .form-check-input {
    flex-shrink: 0;
    margin-top: .3rem;
}

.allergy-filter-option .form-check-label {
    white-space: normal;
    word-break: break-word;
    flex: 1;
}

@media (max-width: 575.98px) {
    .allergy-filter-menu {
        width: calc(100vw - 2rem);
    }
}

/* Star ratings */
.star-rating {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    font-size: .85rem;
    color: #f5a623;
    white-space: nowrap;
}

.star-rating .star-empty {
    color: #d9dee5;
}

.star-rating-count {
    color: var(--gh-fg-muted);
    font-size: .75rem;
    margin-left: .15rem;
}

/* Interactive star voting widget */
.recipe-vote {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
}

.star-rating-interactive {
    display: inline-flex;
}

.star-btn {
    background: none;
    border: none;
    padding: 0 .05rem;
    font-size: 1.3rem;
    line-height: 1;
    color: #d9dee5;
    cursor: pointer;
}

.star-btn-filled {
    color: #f5a623;
}

/* Affiliate product cards */
.product-card {
    height: 100%;
}

.product-card img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    background-color: var(--gh-bg-subtle);
    padding: 1rem;
}

.affiliate-disclosure {
    background-color: var(--gh-bg-subtle);
    border-radius: var(--gh-radius);
    padding: .75rem 1rem;
    font-size: .85rem;
    color: var(--gh-fg-muted);
}

/* Cookie consent banner */
.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    background-color: var(--gh-fg);
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transform: translateY(100%);
    transition: transform .3s ease;
}

.cookie-banner-visible {
    transform: translateY(0);
}

.cookie-banner-text {
    flex: 1 1 320px;
    font-size: .85rem;
}

.cookie-banner-text a {
    color: #9cc6ff;
    text-decoration: underline;
}

.cookie-banner-actions {
    flex-shrink: 0;
}

/* Country showcase (home) */
.country-showcase-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 140px;
    gap: 1rem;
}

.country-showcase-card {
    position: relative;
    display: flex;
    align-items: flex-end;
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-color: #e9ecef;
    text-decoration: none;
    transition: opacity 0.5s ease, transform 0.2s ease;
}

.country-showcase-card:hover {
    transform: translateY(-2px);
}

.country-showcase-card.country-showcase-fading {
    opacity: 0;
}

.country-showcase-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.65) 100%);
}

.country-showcase-name {
    position: relative;
    z-index: 1;
    padding: 0.75rem 1rem;
    color: #fff;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

@media (max-width: 991px) {
    .country-showcase-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575px) {
    .country-showcase-grid {
        grid-template-columns: 1fr;
    }
}
