.page-home {
    background:
        linear-gradient(180deg, #ffffff 0%, #f7fafc 42%, #eef4f7 100%);
}

.page-home .main-content {
    width: 100%;
}

.page-home #toast {
    bottom: 9rem;
}

.home-banner {
    width: 100%;
    background: var(--muted);
}

.home-banner__image {
    width: 100%;
    height: 13rem;
    object-fit: cover;
    object-position: center;
}

.home-screen {
    width: min(100%, 78rem);
    margin: 0 auto;
    padding: 0 1.3rem 0;
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
}

.home-map-section,
.home-list-section,
.home-info__card {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-md);
}

.home-map-section,
.home-list-section {
    padding: 1.25rem;
}

.home-list-section {
    background: transparent;
    backdrop-filter: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.home-map-section {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 1rem 0 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
}

.home-map-filter {
    display: flex;
    justify-content: center;
    gap: 1.8rem;
    padding: 0 1rem 1rem;
    overflow-x: auto;
}

.home-map-filter__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.5rem 0.8rem;
    border: 1px solid #d7dfe5;
    border-radius: 1rem;
    background: #ffffff;
    color: #444444;
    font-size: 0.8rem;
    font-weight: 700;

    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.home-map-filter__button.is-active {
    background: #003968;
    color: var(--primary-foreground);
    border-color: #003968;
   
}

.home-map-filter__button i {
    font-size: 1rem;
}

.home-section-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(23, 70, 99, 0.12);
    position: relative;
}

.home-section-heading::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 4.5rem;
    height: 3px;
    border-radius: 999px;
    background: #2f6f9f;
}

.home-section-heading__eyebrow {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-foreground);
}

.home-section-heading h1,
.home-section-heading h2 {
    margin: 0;
    color: #003968;
    font-size: clamp(1.6rem, 3vw, 1.8rem);
}

.home-section-heading__text {
    color: var(--muted-foreground);
    max-width: 40rem;
}

.home-map {
    width: 100%;
    height: 600px;
    border-radius: 0;
    overflow: hidden;
    border: 0;
    background:
        radial-gradient(circle at top right, rgba(85, 140, 183, 0.1), transparent 34%),
        linear-gradient(180deg, #edf4f7 0%, #dce9ef 100%);
}

.home-map-empty,
.home-empty-state {
    padding: 1rem 0 0;
    color: var(--muted-foreground);
}

.home-logos-footer {
    width: 100vw;
    margin-top: 0;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-bottom: 0;
    padding: 3.75rem 1.5rem 4rem;
    background: #ffffff;
}

.home-logos-footer__inner {
    width: min(100%, 54rem);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.2rem;
}

.home-logos-footer__title {
    margin: 0;
    color: #111111;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    letter-spacing: 0.1rem;
}

.home-logos-footer__grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, auto);
    align-items: center;
    justify-content: center;
    justify-items: center;
    column-gap: 0;
    row-gap: 2rem;
}

.home-logos-footer__logo {
    display: block;
    width: auto;
    max-width: 100%;
    height: 5rem;
    object-fit: contain;
}

.home-logos-footer__logo--ajuntament {
    height: 5rem;
}

.home-logos-footer__logo--celler {
    height: 5rem;
}

.home-logos-footer__logo--figueras {
    height: 5rem;
}

.home-logos-footer__logo--sanmiguel {
    height: 5rem;
}

@media (max-width: 767px) {
    .home-logos-footer {
        padding: 2.75rem 1.25rem 6.75rem;
    }

    .home-logos-footer__inner {
        width: min(100%, 22rem);
        gap: 1.7rem;
    }

    .home-logos-footer__title {
        font-size: 15px;
    }

    .home-logos-footer__grid {
        grid-template-columns: repeat(4, auto);
        justify-content: center;
        column-gap: 0;
        row-gap: 1.6rem;
    }

    .home-logos-footer__logo {
        height: 5rem;
    }

    .home-logos-footer__logo--ajuntament {
        height: 5rem;
    }

    .home-logos-footer__logo--celler {
        height: 5rem;
    }

    .home-logos-footer__logo--figueras {
        height: 5rem;
    }

    .home-logos-footer__logo--sanmiguel {
        height: 5rem;
    }
}

@media (min-width: 768px) {
    .home-logos-footer__grid {
        grid-template-columns: repeat(4, auto);
        justify-content: center;
        column-gap: 0;
        row-gap: 0;
    }
}

.tapas-grid {
    display: grid;
    gap: 1.25rem;
}

.tapa-card {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: 1rem;
    background: #ffffff;
    border: 1px solid rgba(23, 70, 99, 0.08);
    border-radius: 0.3rem;
    box-shadow: 0 10px 24px rgba(23, 70, 99, 0.08);
    color: inherit;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.tapa-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(23, 70, 99, 0.12);
}

.tapa-card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 0.3rem;
    overflow: hidden;
    background: var(--muted);
}

.tapa-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tapa-card__image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary);
}

.tapa-card__status {
    position: absolute;
    top: 0.875rem;
    left: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #003968;
    font-size: 0.8125rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.tapa-card__status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--success);
}

.tapa-card__content {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.tapa-card__copy {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.tapa-card__title {
    margin: 0;
    color: #003968;
    font-size: 1.4rem;
}

.tapa-card__restaurant {
    color: #009993;
    font-weight: 700;
}

.tapa-card__description {
    color: var(--foreground);
    line-height: 1.6;
}

.tapa-card__alergens {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.alergen-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem 0.4rem 0.45rem;
    background: var(--secondary);
    color: #003968;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
}

.alergen-chip i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--radius-sm);
    background: #ffffff;
}

.floating-vote-button {
    position: fixed;
    right: 1rem;
    bottom: 5.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-radius: 999px;
    background: #003968;
    color: var(--primary-foreground);
    font-weight: 800;
    box-shadow: 0 16px 32px rgba(0, 57, 104, 0.34);
    z-index: 1001;
}

/* Amagar botó flotant quan el dropdown d'idiomes està obert */
body.lang-dropdown-open .floating-vote-button {
    visibility: hidden;
}

.bottom-nav {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 4.75rem;
    padding-bottom: 0;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 18px rgba(15, 37, 50, 0.08);
    z-index: 1000;
}

@supports (-webkit-touch-callout: none) {
    .bottom-nav {
        height: calc(4.75rem + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
    }
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    height: 100%;
    min-width: 0;
    color: var(--muted-foreground);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.bottom-nav__item i {
    font-size: 1.3rem;
    line-height: 1;
}

.bottom-nav__item span {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
}

.bottom-nav__item--active {
    color: #003968;
}

@media (hover: hover) and (pointer: fine) {
    .bottom-nav__item:hover {
        color: #003968;
    }
}

/* Dropdown d'idiomes mòbil */
.bottom-nav__lang-dropdown {
    position: relative;
    flex: 1;
}

.bottom-nav__lang-toggle {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: none;
    border: none;
    color: var(--muted-foreground);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.bottom-nav__lang-toggle:hover,
.bottom-nav__lang-toggle:focus {
    color: var(--foreground);
    outline: none;
}

.bottom-nav__lang-toggle i {
    font-size: 1.25rem;
}

.bottom-nav__lang-menu {
    position: absolute;
    bottom: 100%;
    right: 0.5rem;
    margin-bottom: 0.5rem;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    padding: 0.5rem 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity var(--transition-fast),
                transform var(--transition-fast),
                visibility var(--transition-fast);
    z-index: 1001;
}

.bottom-nav__lang-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bottom-nav__lang-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: var(--foreground);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    text-transform: none;
    transition: background var(--transition-fast);
}

.bottom-nav__lang-option:hover {
    background: rgba(85, 140, 183, 0.08);
}

.bottom-nav__lang-option.is-active {
    color: #003968;
    font-weight: 600;
}

.bottom-nav__lang-option i {
    font-size: 0.9em;
    color: #003968;
}

body.has-home-modal {
    overflow: hidden;
}

/* Amagar botó flotant quan el modal home està obert */
body.has-home-modal .floating-vote-button {
    visibility: hidden;
}

.home-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.home-modal[hidden] {
    display: none;
}

.home-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.48);
}

.home-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 22rem);
    padding: 1.5rem;
    background: var(--background);
    border-radius: 1rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
    text-align: center;
}

.home-modal__dialog--scanner {
    width: min(100%, 20rem);
    padding: 1rem;
}

.home-modal__title {
    margin: 0 0 0.5rem;
    color: var(--foreground);
    font-size: 1rem;
    font-weight: 700;
}

.home-modal__text {
    margin: 0 0 0.75rem;
    color: var(--muted-foreground);
    line-height: 1.4;
    font-size: 0.85rem;
}

.home-modal__close {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 1rem;
    font-weight: 700;
}

.home-modal__actions {
    display: flex;
    gap: 0.5rem;
}

.home-modal__primary,
.home-modal__secondary {
    flex: 1;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
}

.home-modal__primary {
    border: 0;
    background: var(--primary);
    color: var(--primary-foreground);
}

.home-modal__secondary {
    border: 1px solid var(--border);
    background: var(--secondary);
    color: #003968;
}

.qr-scanner {
    position: relative;
    margin-bottom: 0.75rem;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #0f172a;
    aspect-ratio: 1 / 1;
    max-height: 20rem;
}

.qr-scanner__reader {
    width: 100%;
    height: 100%;
    display: block;
    background: #0f172a;
}

.qr-scanner__reader video,
.qr-scanner__reader canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
}

.qr-scanner__empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    color: rgba(255, 255, 255, 0.88);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.92));
    font-size: 0.85rem;
}

.qr-scanner__empty[hidden] {
    display: none !important;
}

.qr-scanner__empty i {
    font-size: 1.5rem;
}

.qr-scanner__message {
    margin: 0 0 0.5rem;
    color: var(--muted-foreground);
    font-size: 0.8rem;
    line-height: 1.4;
}

.qr-scanner__message.is-error {
    color: var(--destructive);
    font-weight: 700;
}

.qr-scanner__file {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.85rem;
    font-size: 0.8rem;
    padding: 0.85rem 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--secondary);
    color: #003968;
    font-size: 0.95rem;
    font-weight: 700;
}

.home-map-marker {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: 0 8px 18px rgba(23, 70, 99, 0.16);
}

.home-map-marker.is-open {
    background: var(--primary);
    color: #ffffff;
}

.home-map .leaflet-popup-content-wrapper {
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    padding: 0;
}

.home-map .leaflet-popup-content {
    margin: 0;
    width: 14rem;
}

.home-map .leaflet-popup-tip {
    box-shadow: none;
}

.home-map .gm-style .gm-style-iw-ch {
    padding-top: 0 !important;
}

.home-map-popup {
    display: flex;
    flex-direction: column;
    color: inherit;
    padding: 0.2rem 0.5rem 0.75rem;
}

.home-map-popup__media {
    display: block;
    width: 100px;
    height: 100px;
    margin: 0 auto;
    overflow: hidden;
    background: var(--muted);
    border-radius: 0;
    text-decoration: none;
    border: 0;
    outline: none;
    box-shadow: none;
}

.home-map-popup__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.home-map-popup__body {
    padding: 0.65rem 0.4rem 0;
}

.home-map-popup__title {
    display: block;
    font-family: var(--font-family-heading);
    font-weight: 700;
    color: #003968;
    text-decoration: none;
    outline: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

.home-map-popup__title:focus,
.home-map-popup__title:focus-visible,
.home-map-popup__title:active {
    outline: none;
    box-shadow: none;
}

.home-map-popup__restaurant {
    display: block;
    margin-top: 0.2rem;
    color: #009993;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.home-map-popup__cta {
    display: inline-block;
    margin-top: 0.65rem;
    color: var(--muted-foreground);
    font-size: 0.85rem;
    text-decoration: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (min-width: 768px) {
    .home-screen {
        padding: 0 1.5rem 0;
        gap: 1.75rem;
    }

    .home-logos-footer {
        margin-bottom: 2rem;
        padding-top: 4.5rem;
        padding-bottom: 4.75rem;
    }

    .home-map-section,
    .home-list-section,
    .home-info__card {
        border-radius: 1.75rem;
    }

    .tapas-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }

    .bottom-nav {
        left: 50%;
        bottom: 1rem;
        width: min(38rem, calc(100% - 2rem));
        height: 5rem;
        border: 1px solid rgba(255, 255, 255, 0.9);
        border-radius: 1.5rem;
        transform: translateX(-50%);
    }

    .floating-vote-button {
        right: max(1.5rem, calc((100vw - 78rem) / 2 + 1.5rem));
        bottom: 7rem;
    }
}

@media (min-width: 1100px) {
    .home-banner {
        width: 100%;
        margin: 0;
        border-radius: 0;
        overflow: hidden;
        box-shadow: none;
        background: #169b9b;
    }

    .home-banner__image {
        display: block;
        width: 100%;
        height: auto;
        max-height: 24rem;
        object-fit: cover;
        object-position: center;
    }

    .home-screen {
        width: 100%;
        max-width: none;
        min-height: auto;
        padding: 1.75rem 0 0;
        display: flex;
        flex-direction: column;
        gap: 2.5rem;
    }

    .home-map-filter {
        justify-content: center;
        gap: 0.9rem;
        padding: 0 2rem 1rem;
    }

    .home-map-section {
        display: flex;
        flex-direction: column;
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        padding: 0;
        border-radius: 0;
        border: 0;
        background: transparent;
        backdrop-filter: none;
        box-shadow: none;
        overflow: hidden;
    }

    .home-list-section {
        width: min(100%, 80rem);
        margin: 0 auto;
        padding: 0 3rem;
        background: transparent;
        backdrop-filter: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .home-logos-footer {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        margin-bottom: 0;
        padding: 4.75rem 3rem 5.25rem;
    }

    .home-map {
        height: 500px;
        border-radius: 0;
    }

    .home-map .leaflet-popup-content {
        width: 18rem;
    }

    .home-map-popup {
        flex-direction: row;
        align-items: center;
        gap: 0.85rem;
        padding: 0.2rem 0.75rem 0.5rem;
    }

    .home-map-popup__media {
        flex: 0 0 100px;
        width: 100px;
        height: 100px;
        margin: 0;
        aspect-ratio: auto;
        border-radius: 0;
    }

    .home-map-popup__body {
        flex: 1 1 auto;
        min-width: 0;
        padding: 0;
    }

    .tapas-grid {
        max-height: none;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        overflow: visible;
        padding-right: 0;
        gap: 1.25rem;
    }

    .tapa-card {
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .tapa-card__media {
        aspect-ratio: 1.15 / 1;
    }

    .tapa-card__status {
        top: 0.7rem;
        left: 0.7rem;
        padding: 0.4rem 0.7rem;
        font-size: 0.75rem;
    }

    .tapa-card__content {
        gap: 0.7rem;
    }

    .tapa-card__copy {
        gap: 0.25rem;
    }

    .tapa-card__title {
        font-size: 1.15rem;
    }

    .tapa-card__restaurant {
        font-size: 0.92rem;
    }

    .tapa-card__description {
        font-size: 0.92rem;
        line-height: 1.45;
    }

    .tapa-card__alergens {
        gap: 0.45rem;
    }

    .alergen-chip {
        gap: 0.4rem;
        padding: 0.3rem 0.6rem 0.3rem 0.35rem;
        font-size: 0.8rem;
    }

    .alergen-chip i {
        width: 1.3rem;
        height: 1.3rem;
    }

    .bottom-nav {
        display: none;
    }

    .floating-vote-button {
        right: max(2rem, calc((100vw - 88rem) / 2 + 2rem));
        bottom: 2rem;
    }
}

/* Pantalles molt petites */
@media (max-width: 380px) {
    .home-modal {
        padding: 0.75rem;
    }

    .home-modal__dialog--scanner {
        width: 100%;
        padding: 0.85rem;
    }

    .home-modal__title {
        font-size: 0.95rem;
    }

    .home-modal__text {
        font-size: 0.8rem;
    }

    .qr-scanner {
        aspect-ratio: 1 / 1;
        max-height: 16rem;
        margin-bottom: 0.5rem;
    }

    .qr-scanner__empty {
        font-size: 0.75rem;
        padding: 0.75rem;
    }

    .qr-scanner__empty i {
        font-size: 1.25rem;
    }

    .qr-scanner__message {
        font-size: 0.75rem;
        margin-bottom: 0.4rem;
    }

    .qr-scanner__file {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .home-modal__actions {
        gap: 0.4rem;
    }

    .home-modal__primary,
    .home-modal__secondary {
        padding: 0.55rem 0.75rem;
        font-size: 0.85rem;
    }
}
