/*
Theme Name: Cuni Winebook
Theme URI: TODO-dominio
Author: Cuni Winebook
Author URI: TODO-dominio
Description: Webapp Cuni Winebook: catalogo vini per cantina, winebook personale, ricerca live e scan QR. Accesso riservato agli utenti registrati.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cuni
*/

/* Design system: token e classi generiche riutilizzabili, poi i componenti
   della webapp. Layout e spaziature restano utility basscss nel markup. */
:root {
    /* Colori (Figma: Red, Text, Background dark/light, text light) */
    --main-color: #8C1C35;
    --axent-color: #5EA064;
    --dark-color: #383838;
    --light-color: #E0DDD1;
    --white-color: #FFF;
    --card-light-color: #E7E4DB;
    --cta-light-color: #EBEBE9;

    /* Derivati */
    --dark-mid-color: #5C5C5B;
    --mid-light-color: #9F9F9F;
    --mid-color: #D6D1C2;
    --shadow-color: #D8D0B9;

    /* Famiglie: Mohave per tutto, come da Figma */
    --font-title: 'Mohave', system-ui, -apple-system, sans-serif;
    --font-body: 'Mohave', system-ui, -apple-system, sans-serif;

    /* Layout app */
    --app-width: 480px;
    --app-gutter: 20px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    /* Spazio occupato dalla tastiera virtuale, aggiornato da app.js */
    --kb-offset: 0px;
}

::selection {
    background-color: var(--main-color);
    color: var(--white-color);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-size: 16px;
    font-family: var(--font-body);
    font-weight: 400;
    font-style: normal;
    background-color: var(--light-color);
    color: var(--dark-color);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

img {
    max-width: 100%;
}

/* L'attributo hidden vince sui display dei componenti */
[hidden] {
    display: none !important;
}

/* Blocca lo scroll della pagina sotto overlay e sheet */
body.is-locked {
    overflow: hidden;
}

/* ===================== SFONDI ===================== */

.bg-main {
    background-color: var(--main-color);
}

.bg-axent {
    background-color: var(--axent-color);
}

.bg-dark {
    background-color: var(--dark-color);
}

.bg-dark-mid {
    background-color: var(--dark-mid-color);
}

.bg-mid {
    background-color: var(--mid-color);
}

.bg-light {
    background-color: var(--light-color);
}

.bg-card-light {
    background-color: var(--card-light-color);
}

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

/* ===================== COLORI TESTO ===================== */

.color-main {
    color: var(--main-color);
}

.color-axent {
    color: var(--axent-color);
}

.color-dark {
    color: var(--dark-color);
}

.color-mid-dark {
    color: var(--dark-mid-color);
}

.color-mid {
    color: var(--mid-color);
}

.color-mid-light {
    color: var(--mid-light-color);
}

.color-light {
    color: var(--light-color);
}

.color-white {
    color: var(--white-color);
}

/* ===================== SCALA TIPOGRAFICA =====================
   Valori Figma (mobile 402px). L'app è mobile-first e resta larga al
   massimo --app-width, quindi niente scala fluida. */

/* Mohave 62 — "WINEBOOK" dello splash */
.size-huge {
    font-family: var(--font-title);
    font-size: 3.875rem;
    font-weight: 500;
    line-height: 1;
    text-transform: uppercase;
}

/* Mohave Bold 32 / lh 32 — titolo del pass, "I tuoi preferiti" */
.size-h1 {
    font-family: var(--font-title);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

/* Mohave Bold 24 / lh 35 — titoli di pagina */
.size-h2 {
    font-family: var(--font-title);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.45;
    text-transform: uppercase;
}

/* Mohave Bold 20 — bottoni, titolo sheet, saluto del pass */
.size-h3 {
    font-family: var(--font-title);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Mohave Regular 20 — campi input */
.size-h4 {
    font-family: var(--font-body);
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.2;
}

/* Mohave SemiBold 18 — nome vino nelle righe */
.size-h5 {
    font-family: var(--font-body);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.2;
    text-transform: uppercase;
}

/* Mohave Regular 16 — testo */
.size-body {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.2;
}

/* Mohave Medium 13 / lh 16 — nome vino nelle card */
.size-caption {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.23;
}

/* Mohave Regular 14 — cantina, località */
.size-small {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.2;
}

/* Mohave Regular 12 / lh 13 — consensi, "oppure" */
.size-smallest {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.1;
}

/* Mohave 11 maiuscolo — etichette navbar */
.size-nav {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
    text-transform: uppercase;
}

/* ===================== PESI E TRASFORMAZIONI ===================== */

.uppercase {
    text-transform: uppercase;
}

.bold {
    font-weight: 700;
}

.semibold {
    font-weight: 600;
}

.medium {
    font-weight: 500;
}

.regular {
    font-weight: 400;
}

.light {
    font-weight: 300;
}

.ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Testo da wysiwyg: spaziatura paragrafi e grassetto */
.rich-text p {
    margin: 0 0 1rem;
}

.rich-text p:last-child {
    margin-bottom: 0;
}

.rich-text strong,
.rich-text b {
    font-weight: 700;
}

/* Solo per screen reader */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ===================== OPACITÀ ===================== */

.opt-04 {
    opacity: 0.4;
}

.opt-05 {
    opacity: 0.5;
}

.opt-06 {
    opacity: 0.6;
}

/* ===================== GAP ===================== */

.gap-small {
    gap: 10px;
}

.gap-medium {
    gap: 20px;
}

.gap-large {
    gap: 30px;
}

.gap,
.gap-xlarge {
    gap: 40px;
}

/* ===================== FORME E VARIE ===================== */

.rounded-5 {
    border-radius: 5px;
}

.rounded-10 {
    border-radius: 10px;
}

.rounded-20 {
    border-radius: 20px;
}

.rounded-pill {
    border-radius: 100px;
}

.shadow-card {
    box-shadow: 0 4px 8px 0 var(--shadow-color);
}

/* Immagine che riempie il contenitore */
.fill {
    object-fit: cover;
    width: 100%;
    height: 100%;
    object-position: center;
}

.contain {
    object-fit: contain;
    width: 100%;
    height: 100%;
    object-position: center;
}

.pointer {
    cursor: pointer;
}

.px-app {
    padding-left: var(--app-gutter);
    padding-right: var(--app-gutter);
}

/* ======================================================================
   WEBAPP
   ====================================================================== */

/* Colonna centrale: su desktop l'app resta larga come uno smartphone */
.app {
    position: relative;
    width: 100%;
    max-width: var(--app-width);
    min-height: 100vh;
    min-height: 100svh;
    margin: 0 auto;
    background-color: var(--light-color);
}

/* Spazio sotto il contenuto per navbar fissa */
.app-main.has-nav {
    padding-bottom: calc(160px + var(--safe-bottom));
}

/* ===================== SPLASH ===================== */

.splash {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background-color: var(--main-color);
    color: var(--card-light-color);
}

.show-splash .splash {
    display: flex;
}

.splash {
    transition: opacity 0.5s ease;
}

.hide-splash .splash {
    opacity: 0;
}

.splash-logo {
    width: 93px;
    height: 93px;
}

/* Lettering "Wine day": largo come il testo in Figma, con i margini laterali
   del layout quando lo schermo è più stretto */
.splash-wordmark {
    width: 276px;
    max-width: calc(100% - (var(--app-gutter) * 4));
    height: auto;
}

/* ===================== HEADER ===================== */

/* Icone a sinistra, logo al centro, pass a destra. Il logo è centrato sulla
   pagina e non fra le due colonne: quelle hanno larghezze diverse. */
.app-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 34px;
    margin-top: calc(var(--safe-top) + 16px);
    padding: 0 var(--app-gutter);
}

.app-header-side {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 34px;
}

.app-logo {
    position: absolute;
    left: 50%;
    top: 7px;
    display: block;
    width: 128px;
    height: 20px;
    transform: translateX(-50%);
}

.app-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Bottone tondo 34px: cerchio bianco e ombra in CSS, dallo svg arriva solo
   il glifo (Figma: cerchio 34, ombra 0 4 8 #D8D0B9). */
.icon-btn {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--white-color);
    box-shadow: 0 4px 8px var(--shadow-color);
    color: var(--dark-color);
}

/* Ogni glifo esce alla sua misura di Figma (7x13, 13x12, 15x15.78): non c'è
   nulla da forzare qui */
.icon-btn svg {
    display: block;
    pointer-events: none;
}

.page-title {
    margin: 50px 0;
    text-align: center;
}

/* ===================== NAVBAR ===================== */

.nav-dock {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 40;
    width: 100%;
    max-width: var(--app-width);
    transform: translateX(-50%);
    padding: 60px var(--app-gutter) calc(var(--safe-bottom) + 20px);
    background: linear-gradient(to bottom, rgba(231, 228, 219, 0) 0%, var(--card-light-color) 60.5%);
    pointer-events: none;
    transition: background 0.3s ease;
}

.search-open .nav-dock {
    background: linear-gradient(to bottom, rgba(56, 56, 56, 0) 0%, var(--dark-color) 60.5%);
}

.nav-bar {
    display: flex;
    align-items: center;
    padding: 5px;
    border-radius: 100px;
    background-color: var(--white-color);
    pointer-events: auto;
}

.nav-item {
    position: relative;
    display: flex;
    flex: 1 0 0;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    gap: 3.5px;
    padding: 10px 0;
    border-radius: 100px;
    color: var(--dark-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.nav-item.is-active {
    background-color: var(--main-color);
    color: var(--white-color);
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 22px;
}

.nav-icon svg {
    display: block;
    width: auto;
    height: 21.4px;
}

/* icon-scan è quadrata 18x18: lasciata alla sua misura il tratto resta 1.5 */
.nav-item[data-nav="scan"] .nav-icon svg {
    height: 18px;
}

/* Contatore winebook */
.nav-badge {
    position: absolute;
    top: 5px;
    left: calc(50% + 7.5px);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border: 1px solid var(--white-color);
    border-radius: 8px;
    background-color: var(--main-color);
    color: var(--white-color);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.nav-badge[data-count="0"] {
    display: none;
}

/* Il contatore compare/cambia con un piccolo scatto */
.nav-badge.is-bump {
    animation: nav-badge-bump 0.35s ease-out;
}

@keyframes nav-badge-bump {
    0% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.35);
    }

    100% {
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-badge.is-bump {
        animation: none;
    }
}

/* ===================== FORM ===================== */

/* Campi impilati: primo e ultimo arrotondati, bordi sovrapposti */
.field-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.field {
    position: relative;
    display: block;
}

.field+.field {
    margin-top: -1px;
}

.field:first-child .field-input {
    border-radius: 10px 10px 0 0;
}

.field:last-child .field-input {
    border-radius: 0 0 10px 10px;
}

.field:only-child .field-input {
    border-radius: 10px;
}

/* Il padding alto lascia il posto all'etichetta quando sale: il testo digitato
   resta dov'è e non salta. Il placeholder è " " (uno spazio): serve solo a far
   funzionare :placeholder-shown, l'etichetta è lo <span> accanto. */
.field-input {
    display: block;
    width: 100%;
    padding: 22px 20px 8px;
    border: 1px solid var(--mid-light-color);
    border-radius: 0;
    background-color: var(--white-color);
    color: var(--dark-color);
    font-family: var(--font-body);
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.2;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.field-input:focus {
    position: relative;
    z-index: 1;
    border-color: var(--dark-color);
}

.field-input.is-invalid {
    position: relative;
    z-index: 1;
    border-color: var(--main-color);
}

/* Etichetta-segnaposto con l'asterisco rosso: al centro finché il campo è
   vuoto e non ha il fuoco, poi rimpicciolisce e sale. */
.field-label {
    position: absolute;
    top: 50%;
    left: 21px;
    z-index: 2;
    transform-origin: left center;
    transform: translateY(-50%);
    color: var(--mid-light-color);
    font-size: 1.25rem;
    line-height: 1.2;
    pointer-events: none;
    transition: transform 0.2s ease, color 0.2s ease;
    will-change: transform;
}

.field-label em {
    font-style: normal;
    color: var(--main-color);
}

/* scale() invece di font-size: si anima sulla GPU e non fa reflow */
.field-input:focus+.field-label,
.field-input:not(:placeholder-shown)+.field-label {
    transform: translateY(calc(-50% - 13px)) scale(0.65);
}

.field-input:focus+.field-label {
    color: var(--dark-mid-color);
}

@media (prefers-reduced-motion: reduce) {
    .field-label {
        transition: none;
    }
}

/* Checkbox consensi */
.check {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #000;
}

.check input {
    flex: none;
    width: 15px;
    height: 15px;
    border: 1px solid var(--dark-color);
    border-radius: 5px;
    background-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.check input:checked {
    border-color: var(--dark-color);
    background: var(--dark-color) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.2l2.6 2.5L12 5.5' fill='none' stroke='%23E0DDD1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat;
}

.check input.is-invalid {
    border-color: var(--main-color);
}

.check a {
    text-decoration: underline;
}

.form-message {
    min-height: 1.2em;
    color: var(--main-color);
    text-align: center;
}

.form-message:empty {
    display: none;
}

/* Honeypot anti-bot */
.field-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ===================== BOTTONI ===================== */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 15px 20px 13px;
    border-radius: 100px;
    font-family: var(--font-title);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
    transition: opacity 0.3s ease;
}

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

.btn-ghost {
    border: 2px solid var(--dark-color);
    padding: 13px 20px 11px;
    color: var(--dark-color);
}

.btn[disabled],
.btn.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

.divider {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--mid-light-color);
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--mid-light-color);
}

/* Aggiungi/rimuovi dal winebook: un solo bottone, due stati. Da vuoto è un
   cerchio col "+", da pieno la spunta rossa. */
.wb-toggle {
    position: relative;
    display: block;
    flex: none;
    width: 28px;
    height: 28px;
}

.wb-toggle .wb-add,
.wb-toggle .wb-remove {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.wb-toggle .wb-add {
    border: 1.5px solid var(--dark-color);
    border-radius: 50%;
    background-color: var(--white-color);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.wb-toggle .wb-add svg {
    display: block;
    width: 11px;
    height: 11px;
}

/* Stato "nei preferiti" sulle card: cuore bianco su cerchio rosso pieno */
.wb-toggle .wb-remove {
    border: 1.5px solid var(--main-color);
    border-radius: 50%;
    background-color: var(--main-color);
    box-shadow: 0 4px 8px var(--shadow-color);
    color: var(--white-color);
}

.wb-toggle .wb-remove svg {
    display: block;
    width: 16px;
    height: auto;
}

/* Stato "nei preferiti" sulle righe: "−" rosso, cerchio solo bordato */
.wb-toggle.is-row .wb-remove {
    background-color: transparent;
    color: var(--main-color);
}

.wb-toggle.is-row .wb-remove svg {
    width: 12.5px;
    stroke-width: 1.5;
}

.wb-toggle .wb-remove,
.wb-toggle.is-in .wb-add {
    opacity: 0;
    transform: scale(0.6);
    pointer-events: none;
}

.wb-toggle.is-in .wb-remove {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.wb-toggle.is-busy {
    pointer-events: none;
}

/* ===================== ACCESSO ===================== */

.auth {
    padding-bottom: calc(var(--safe-bottom) + 40px);
}

.auth-title {
    margin-top: 25px;
    line-height: 26px;
    text-align: center;
}

/* ===================== SHEET E OVERLAY ===================== */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
}

.overlay.is-open {
    display: block;
}

.overlay-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(56, 56, 56, 0.5);
}

.overlay-backdrop.is-blur {
    background-color: rgba(56, 56, 56, 0.7);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.sheet {
    position: absolute;
    left: 50%;
    bottom: var(--kb-offset);
    width: 100%;
    max-width: var(--app-width);
    padding: 20px 0 calc(var(--safe-bottom) + 40px);
    border-radius: 30px 30px 0 0;
    background-color: var(--light-color);
    box-shadow: 0 -4px 20px 0 rgba(0, 0, 0, 0.25);
    transform: translateX(-50%);
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
}

.sheet-title span {
    font-weight: 400;
}

/* Chiusure: stessa croce, cerchio e misure dal CSS. Il tratto non scala con
   l'svg (vector-effect), così resta 2px sulla grande e 1px sulla piccola. */
.close-sm,
.close-lg {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--dark-color);
}

.close-sm {
    width: 34px;
    height: 34px;
    background-color: var(--mid-color);
}

.close-lg {
    width: 59px;
    height: 59px;
    background-color: var(--light-color);
}

/* Nella barra di ricerca il cerchio è bianco, non sabbia */
.close-lg.is-white {
    background-color: var(--white-color);
}

.close-sm svg,
.close-lg svg {
    display: block;
    height: auto;
}

.close-sm svg {
    width: 13px;
    stroke-width: 1;
}

.close-lg svg {
    width: 19px;
    stroke-width: 2;
}

/* ===================== PASS ===================== */

/* Biglietto disegnato da un unico SVG (ui/pass.svg): bordo perforato con
   trattini arrotondati e strappo a metà. Le proporzioni dello SVG fissano
   l'altezza del blocco, i testi stanno in .pass-content sopra. */
.pass {
    position: relative;
    width: 360px;
    max-width: 100%;
    aspect-ratio: 360 / 460;
    margin: 0 auto;
    filter: drop-shadow(0 24px 20px rgba(140, 28, 53, 0.3));
}

.pass.is-dark {
    filter: drop-shadow(0 24px 20px rgba(40, 40, 40, 0.6));
}

/* Forma del biglietto: un solo SVG di fondo (bianco, bordo perforato,
   strappo a metà). I contenuti vivono nel layer sopra. */
.pass-shape {
    display: block;
    width: 100%;
    height: 100%;
}

.pass-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
}

.pass-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex: none;
    height: 21.96%;
    padding: 20px;
}

/* Cerchio verde in CSS, dallo svg arriva la sola spunta bianca */
.pass-check {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--axent-color);
    color: var(--white-color);
}

.pass-check svg {
    display: block;
    stroke-width: 6;
}

.pass-greeting {
    line-height: 20px;
}

.pass-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex: 1;
    min-height: 0;
    padding: 10px 30px 30px;
    text-align: center;
}

/* Dati dell'iscrizione: etichetta chiarissima sopra, valore sotto */
.pass-data {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.pass-data-label {
    margin-bottom: -5px;
    color: var(--light-color);
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 2.13;
}

.pass-data-value {
    color: var(--dark-color);
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.33;
    overflow-wrap: anywhere;
}

.pass-claim {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.04;
    text-align: left;
}

/* A blocco: "e ritira il calice" va a capo da sé, come in Figma */
.pass-claim span {
    width: 160px;
}

.pass-claim b {
    display: block;
    font-weight: 700;
}

.pass-calice {
    display: block;
    flex: none;
    width: 55.5px;
    height: 99px;
}

/* Variante appena registrato: niente dati, il claim sale al centro col calice
   grande sotto (Figma "Registrazione completata") */
.pass.is-welcome .pass-body {
    justify-content: center;
}

.pass.is-welcome .pass-claim {
    flex-direction: column-reverse;
    gap: 20px;
    font-size: 2rem;
    line-height: 1;
    text-align: center;
}

.pass.is-welcome .pass-claim span {
    width: auto;
}

.pass.is-welcome .pass-calice {
    width: 83.5px;
    height: 149px;
}

.pass-modal {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: var(--app-gutter);
}

.pass-logout {
    color: var(--light-color);
    text-decoration: underline;
}

/* ===================== CANTINE ===================== */

.grid-cantine {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    margin-top: 25px;
}

.card-cantina {
    position: relative;
    display: flex;
    flex-direction: column;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 20px;
    background-color: var(--white-color);
    box-shadow: 0 4px 8px 0 var(--shadow-color);
}

.card-cantina.is-in {
    border-color: var(--main-color);
}

.card-cantina-media {
    display: flex;
    flex: 1;
    min-height: 0;
    align-items: center;
    justify-content: center;
}

.card-cantina-logo {
    width: 100%;
    height: 100%;
    padding: 0 12px;
}

.card-cantina-name {
    padding: 0 12px;
    text-align: center;
}

/* Pill in basso, larga quanto il suo contenuto e centrata: 23.4px di altezza
   e 10px dal fondo della card, come in Figma */
.card-cantina-cta {
    display: flex;
    flex: none;
    align-self: center;
    align-items: center;
    gap: 9px;
    height: 23.4px;
    margin-bottom: 10px;
    padding: 2px 12px 0 14px;
    border-radius: 100px;
    background-color: var(--cta-light-color);
    color: var(--dark-color);
}

.card-cantina-cta-label {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.card-cantina-cta svg {
    display: block;
    flex: none;
    stroke-width: 1;
}

/* ===================== SINGOLA CANTINA ===================== */

.cantina-head {
    margin: 50px 0;
    text-align: center;
    text-transform: uppercase;
}

/* Filtro per tipologia: riga che scorre a lato, a filo col bordo schermo.
   I margini negativi annullano il padding di .px-app solo qui. */
.chips-row {
    display: flex;
    gap: 10px;
    margin: 25px calc(var(--app-gutter) * -1) 0;
    padding: 4px var(--app-gutter) 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.chips-row::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: none;
    padding: 10px 20px;
    border-radius: 100px;
    background-color: var(--white-color);
    color: var(--dark-color);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 0.82;
    white-space: nowrap;
    filter: drop-shadow(0 4px 4px var(--shadow-color));
    transition: background-color 0.25s ease, color 0.25s ease;
}

.chip.is-active {
    background-color: var(--main-color);
    color: var(--white-color);
}

/* Mentre l'AJAX lavora la griglia sbiadisce, ma resta cliccabile la riga chips */
[data-vini-grid].is-loading {
    opacity: 0.4;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.grid-vini {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 12px 13px;
    margin-top: 20px;
}

/* È tutta la card ad aggiungere e togliere dai preferiti: il cerchio in alto
   a destra è solo il segno dello stato. */
.card-vino {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border: 1.5px solid transparent;
    border-radius: 20px;
    background-color: var(--white-color);
    box-shadow: 0 4px 8px 0 var(--shadow-color);
    text-align: center;
    transition: border-color 0.25s ease;
}

.card-vino.is-in {
    border-color: var(--main-color);
}

.card-vino-img {
    display: block;
    width: 100%;
    height: 208px;
}

.card-vino-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    width: 100%;
    overflow: hidden;
    text-align: center;
}

.card-vino .wb-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    pointer-events: none;
}

/* ===================== RIGHE VINO (winebook, ricerca) ===================== */

.list-vini {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.row-vino {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 95px;
    padding: 12px;
    border: 1.5px solid transparent;
    border-radius: 20px;
    background-color: var(--white-color);
    transition: border-color 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

.row-vino-thumb {
    flex: none;
    width: 44px;
    height: 71px;
    overflow: hidden;
    border-radius: 4px;
}

.row-vino-text {
    display: flex;
    flex: 1 0 0;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.row-vino.is-leaving {
    opacity: 0;
    transform: translateX(20px);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
    text-align: center;
}

/* ===================== RICERCA ===================== */

/* Niente z-index sul contenitore: senza contesto di impilamento il velo può
   restare sotto il dock (40) e il pannello sopra, così la sfumatura della
   navbar non finisce sul campo di ricerca e sulla sua X. */
.search-overlay {
    z-index: auto;
}

.search-overlay .overlay-backdrop {
    z-index: 30;
}

.search-panel {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    z-index: 41;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--app-width);
    transform: translateX(-50%);
    /* Il pannello copre anche la navbar: i tap passano, li prendono solo i
       suoi due blocchi */
    pointer-events: none;
}

.search-results,
.search-bar {
    pointer-events: auto;
}

.search-results {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: calc(var(--safe-top) + 20px) var(--app-gutter) 60px;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 120px), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 120px), transparent 100%);
}

.search-status {
    color: var(--light-color);
    text-align: center;
}

/* Barra sopra la navbar; con la tastiera aperta sale sopra la tastiera */
.search-bar {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 0 var(--app-gutter);
    /* --nav-height: dal bordo alto della navbar al fondo, calcolata da app.js */
    margin-bottom: max(calc(var(--nav-height, 100px) + 32px), calc(var(--kb-offset) + 20px));
}

.search-field {
    flex: 1;
    min-width: 0;
}

.search-bar .search-field .field-input {
    padding: 15px 25px;
    border-radius: 100px;
}

/* Qui l'etichetta non ha dove salire: nella pill resta un placeholder */
.search-field .field-label {
    left: 26px;
    color: var(--dark-mid-color);
}

.search-field .field-input:focus+.field-label {
    transform: translateY(-50%);
}

.search-field .field-input:not(:placeholder-shown)+.field-label {
    opacity: 0;
}

.search-field .field-input::-webkit-search-cancel-button {
    display: none;
}

/* ===================== SCAN ===================== */

.scan-box {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    margin-top: 38px;
    overflow: hidden;
    border: 3.5px solid var(--main-color);
    border-radius: 20px;
    background-color: var(--dark-color);
}

/* html5-qrcode inserisce il video con misure sue, più basse del riquadro:
   qui riempie il quadrato e si lascia ritagliare, così non resta scoperto */
.scan-box video {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

/* Velo e angoli della libreria: il riquadro rosso fa già da mirino */
.scan-box #qr-shaded-region {
    display: none;
}

.scan-message {
    width: 191px;
    max-width: 100%;
    margin: 20px auto 0;
    text-align: center;
}

/* ===================== PAGINE GENERICHE ===================== */

.page-content {
    margin-top: 25px;
}