/* ============================================================
   public.css — pagine pubbliche Mediterranea Logistica
   Pattern di contrasto = identico al DEM (sfondo scuro pieno,
   testo bianco, accenti forti) — palette Mediterranea (navy/azzurro/sabbia)
   ============================================================ */

body.public-home,
body.public-track {
    background: var(--sfondo);
    color: var(--nero);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   HOMEPAGE (form ricerca codice)
   Sfondo navy SCURO pieno + testo bianco
   ============================================================ */
body.public-home {
    background: linear-gradient(160deg, #0d5286 0%, #0a3d62 55%, #083253 100%);
    color: #ffffff;
}
.hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
    background-image: url('/assets/img/hero-truck.svg');
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: min(1100px, 130%) auto;
}
.hero-inner {
    max-width: 480px;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* ---------- LOGO BIANCO ---------- */
.brand-mark {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}
.brand-mark .brand-text {
    font-size: 2.8rem;
    color: #ffffff;
}
.brand-mark .brand-text .brand-wave { color: #3c91e6; }
.brand-mark .brand-text .brand-sub  { color: #f4a261; font-size: 0.8rem; letter-spacing: 0.22em; }

/* ---------- TITOLO + SOTTOTITOLO ---------- */
.hero-titolo {
    font-family: var(--font-display);
    font-size: 2rem;
    color: #ffffff;
    margin: 0 0 0.5rem;
    letter-spacing: 0.03em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.hero-sotto {
    color: #d1d5db;
    font-size: 1rem;
    margin: 0 0 2rem;
}

/* ---------- FORM RICERCA ---------- */
.form-track {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    width: 100%;
}
.input-track {
    width: 100%;
    padding: 1rem 1.2rem;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: center;
    text-transform: uppercase;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
    border: 2px solid rgba(255, 255, 255, 0.30);
    border-radius: var(--r-md);
    backdrop-filter: blur(8px);
    transition: border-color 0.15s, background 0.15s;
}
.input-track::placeholder {
    color: rgba(255, 255, 255, 0.55);
}
.input-track:focus {
    outline: 0;
    border-color: #f4a261;
    background: rgba(255, 255, 255, 0.18);
}
.btn-track {
    padding: 1rem 1.2rem;
    background: #f4a261;
    color: #0a3d62;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.1rem;
    border: 0;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background 0.15s;
    min-height: 56px;
}
.btn-track:hover { background: #e08a44; }

/* ---------- HINT ---------- */
.hint-format {
    margin-top: 1.2rem;
    font-size: 0.88rem;
    color: #cbd5e1;
}
.hint-format code {
    background: rgba(255, 255, 255, 0.18);
    padding: 0.15em 0.5em;
    border-radius: 4px;
    color: #ffffff;
    font-weight: 600;
}

/* ---------- ALERT ERRORE ---------- */
.alert-errore-public {
    background: rgba(220, 38, 38, 0.25);
    border: 1px solid #fca5a5;
    color: #ffeaea;
    padding: 0.7rem 1rem;
    border-radius: var(--r-md);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* ---------- 404 ---------- */
.not-found-icon { font-size: 4rem; margin-bottom: 1rem; }
.codice-tracking-inline {
    background: rgba(255, 255, 255, 0.18);
    padding: 0.2em 0.55em;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, monospace;
    color: #ffffff;
    font-weight: 600;
}

/* ============================================================
   PAGINA TRACKING (track.php)
   Header navy + corpo chiaro con card bianche
   ============================================================ */
.public-track { background: var(--sfondo); color: var(--nero); }

.track-header {
    background: #0a3d62;
    color: #ffffff;
    padding: 1rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 12px rgba(10, 61, 98, 0.35);
}
.brand-mark-mini {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}
.brand-mark-mini:hover { text-decoration: none; }
.brand-mark-mini .brand-text { font-size: 1.3rem; color: #ffffff; }
.brand-mark-mini .brand-text .brand-wave { color: #3c91e6; }
.brand-mark-mini .brand-text .brand-sub  { display: none; }

.link-cerca {
    color: #d1d5db;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}
.link-cerca:hover { color: #ffffff; text-decoration: underline; }

.track-main {
    flex: 1;
    max-width: 820px;
    margin: 0 auto;
    padding: 1rem;
    width: 100%;
}

/* ---------- BANNER STATO ---------- */
.stato-banner {
    color: #ffffff;
    padding: 2rem 1.5rem;
    border-radius: var(--r-lg);
    text-align: center;
    margin-bottom: 1rem;
    box-shadow: var(--ombra-md);
}
.codice-tracking {
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    opacity: 0.92;
    margin-bottom: 0.5rem;
    color: #ffffff;
}
.stato-icona { font-size: 3rem; margin-bottom: 0.3rem; line-height: 1; }
.stato-label {
    font-family: var(--font-display);
    font-size: 2rem;
    margin: 0;
    letter-spacing: 0.03em;
    color: #ffffff;
}
.stato-data {
    margin-top: 0.7rem;
    font-size: 0.9rem;
    color: #ffffff;
    opacity: 0.95;
}

/* ---------- CONSEGNA PREVISTA (sabbia → navy) ---------- */
.consegna-prevista {
    background: linear-gradient(135deg, #f4a261 0%, #e08a44 100%);
    color: #0a3d62;
    border-radius: var(--r-lg);
    padding: 1.2rem 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--ombra-sm);
}
.cp-icon { font-size: 2.2rem; line-height: 1; }
.cp-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #0a3d62;
}
.cp-data {
    font-family: var(--font-display);
    font-size: 1.5rem;
    letter-spacing: 0.03em;
    line-height: 1.1;
    text-transform: capitalize;
    margin-top: 0.2rem;
    color: #0a3d62;
}

/* ---------- CARD PUBLIC ---------- */
.card-public {
    background: #ffffff;
    border-radius: var(--r-lg);
    box-shadow: var(--ombra-sm);
    padding: 1.2rem;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    color: #1e293b;
}
.card-public h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    letter-spacing: 0.03em;
    margin: 0 0 1rem;
    color: #0a3d62;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f4a261;
}

/* ---------- MAPPA ---------- */
#mappa {
    width: 100%;
    height: 360px;
    border-radius: var(--r-md);
    overflow: hidden;
    background: #eef2f7;
    position: relative;
}
.mappa-loading, .mappa-errore {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-style: italic;
}
.mappa-errore { color: var(--rosso); }

/* ---------- TIMELINE PUBLIC ---------- */
.timeline-public {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
    color: #1e293b;
}
.timeline-public::before {
    content: '';
    position: absolute;
    left: 10px; top: 8px; bottom: 8px;
    width: 2px;
    background: #e2e8f0;
}
.timeline-public .tl-item { position: relative; padding: 0 0 1rem 2rem; }
.timeline-public .tl-dot {
    position: absolute;
    left: 4px; top: 5px;
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #e2e8f0;
}
.timeline-public .tl-item:first-child .tl-dot {
    box-shadow: 0 0 0 2px #f4a261;
    transform: scale(1.15);
}
.timeline-public .tl-titolo { font-size: 1rem; color: #0f172a; }
.timeline-public .tl-data    { font-size: 0.88rem; color: #475569; margin-top: 0.15rem; }
.timeline-public .tl-filiale { font-size: 0.9rem;  color: #1e293b; margin-top: 0.2rem; }
.timeline-public .tl-nota {
    margin-top: 0.4rem;
    padding: 0.5rem 0.7rem;
    background: #f1f5f9;
    border-left: 3px solid #f4a261;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    font-size: 0.9rem;
    color: #1e293b;
}

/* ---------- DATI PACCO ---------- */
.dati-grid {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.5rem 1.2rem;
    font-size: 0.95rem;
    color: #1e293b;
}
.dati-grid dt {
    color: #475569;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    align-self: center;
}
.dati-grid dd { margin: 0; font-weight: 500; color: #0f172a; }

/* ---------- WHATSAPP AIUTO (solo pagina tracking) ---------- */
.btn-aiuto-wa {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: var(--whatsapp);
    color: #ffffff;
    padding: 1rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
    z-index: 30;
    transition: background 0.15s;
    min-height: 56px;
}
.btn-aiuto-wa:hover { background: #1ea854; color: #ffffff; text-decoration: none; }
.btn-aiuto-wa svg { flex-shrink: 0; }
.track-main { padding-bottom: 6rem; }

/* ---------- FOOTER ---------- */
.footer-public {
    text-align: center;
    padding: 1.5rem 1rem;
    color: #475569;
    font-size: 0.88rem;
}
.public-home .footer-public { color: #cbd5e1; }
.public-home .footer-public a { color: #ffffff; text-decoration: underline; }
.public-home .footer-public a:hover { color: #f4a261; }

/* ============================================================
   DESKTOP (≥ 640px)
   ============================================================ */
@media (min-width: 640px) {
    .hero-titolo  { font-size: 2.4rem; }
    .stato-banner { padding: 2.5rem 2rem; }
    .stato-icona  { font-size: 4rem; }
    .stato-label  { font-size: 2.4rem; }
    .cp-data      { font-size: 1.8rem; }
    #mappa        { height: 460px; }

    .btn-aiuto-wa {
        position: static;
        margin: 1rem auto 0;
        max-width: 280px;
        border-radius: var(--r-md);
        box-shadow: var(--ombra-md);
    }
    .track-main { padding-bottom: 1rem; }

    .form-track   { flex-direction: row; }
    .input-track  { flex: 1; }
    .btn-track    { white-space: nowrap; padding: 1rem 2rem; }
}
