/* ============================================================
   A.S.D. PROGETTO GIOVANI — style.css
   Mobile-first. Brand: navy #13315c / blu #1b4b8f / azzurro #6fa8d6
   ============================================================ */

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

:root {
    --navy:     #13315c;
    --blu:      #1b4b8f;
    --azzurro:  #6fa8d6;
    --az-light: #aecbe8;
    --bianco:   #ffffff;
    --grigio:   #f4f6f9;
    --testo:    #1c2733;
    --errore:   #c0392b;
    --ok:       #1e8449;
    --r:        8px;
    --ombra:    0 2px 10px rgba(0,0,0,.11);
}

/* ── Base ───────────────────────────────────────────────────── */
html   { font-size: 16px; scroll-behavior: smooth; }
body   {
    font-family: system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
    background: var(--grigio);
    color: var(--testo);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a      { color: var(--blu); }
a:hover{ color: var(--navy); }
img    { max-width: 100%; height: auto; display: block; }
small  { font-size: .8em; font-weight: 400; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
    background: var(--navy);
    color: var(--bianco);
    padding: .65rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    text-decoration: none;
    color: var(--bianco);
    flex-shrink: 0;
}
.topbar-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 3px; }
.topbar-name {
    font-size: .9rem;
    font-weight: 700;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
}
.topbar-name span { font-size: .7rem; font-weight: 400; opacity: .75; }

.topbar-spacer { flex: 1; }

/* Hamburger toggle (CSS-only) */
#nav-toggle { display: none; }

.nav-toggle-label {
    display: none;
    cursor: pointer;
    font-size: 1.55rem;
    color: var(--bianco);
    line-height: 1;
    padding: .15rem .4rem;
    border-radius: 4px;
    user-select: none;
}
.nav-toggle-label:hover { background: rgba(255,255,255,.12); }

.topbar-nav { display: flex; align-items: center; gap: .2rem; }
.topbar-nav a {
    color: var(--az-light);
    text-decoration: none;
    padding: .38rem .7rem;
    border-radius: var(--r);
    font-size: .88rem;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.topbar-nav a:hover { background: rgba(255,255,255,.13); color: var(--bianco); }
.topbar-nav a.nav-logout {
    border: 1px solid rgba(255,255,255,.28);
    margin-left: .35rem;
}
.topbar-nav a.nav-logout:hover { background: rgba(255,255,255,.18); }

/* ── Hero (pagine auth) ─────────────────────────────────────── */
.hero {
    background: linear-gradient(155deg, var(--navy) 0%, var(--blu) 100%);
    color: var(--bianco);
    text-align: center;
    padding: 2.5rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .85rem;
}
.hero-logo {
    width: 110px;
    height: 110px;
    object-fit: contain;
    filter: drop-shadow(0 4px 14px rgba(0,0,0,.45));
}
.hero h1  { font-size: 1.45rem; font-weight: 800; letter-spacing: .02em; }
.hero p   { font-size: .9rem; opacity: .8; }

/* ── Contenitore principale ─────────────────────────────────── */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; flex: 1; }

/* ── Intestazione pagina ────────────────────────────────────── */
.page-header           { margin-bottom: 1.25rem; }
.page-header h1        { color: var(--navy); font-size: 1.45rem; }
.page-header p         { color: #555; font-size: .88rem; margin-top: .2rem; }

/* ── Card grid ──────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1rem;
}
.card {
    background: var(--bianco);
    border: 1.5px solid var(--az-light);
    border-radius: var(--r);
    padding: 1.25rem 1rem;
    text-decoration: none;
    color: var(--testo);
    box-shadow: var(--ombra);
    display: block;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,.14);
    border-color: var(--azzurro);
    color: var(--navy);
}
.card h3 { color: var(--blu); font-size: 1rem; margin-bottom: .3rem; }
.card p  { font-size: .83rem; color: #5a6472; margin: 0; }

/* ── Form card ──────────────────────────────────────────────── */
.form-card {
    background: var(--bianco);
    border-radius: var(--r);
    box-shadow: var(--ombra);
    padding: 1.75rem 1.25rem;
    max-width: 480px;
    margin: 1.5rem auto;
    width: 100%;
}
.form-card h2 { color: var(--navy); font-size: 1.2rem; margin-bottom: 1.1rem; }

label {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    color: var(--testo);
    margin-bottom: .9rem;
}
label small { display: block; font-weight: 400; color: #666; margin-top: .1rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="tel"],
input[type="datetime-local"],
input[type="time"],
select,
textarea {
    display: block;
    width: 100%;
    padding: .55rem .75rem;
    margin-top: .3rem;
    border: 1.5px solid var(--az-light);
    border-radius: var(--r);
    font-size: .95rem;
    font-family: inherit;
    color: var(--testo);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--azzurro);
    box-shadow: 0 0 0 3px rgba(111,168,214,.22);
}
input[type="file"] {
    margin-top: .3rem;
    font-size: .88rem;
}

/* ── Bottoni ─────────────────────────────────────────────────── */
.btn, input[type="submit"] {
    display: inline-block;
    background: var(--blu);
    color: var(--bianco);
    border: none;
    border-radius: var(--r);
    padding: .6rem 1.5rem;
    font-size: .95rem;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .1s;
    margin-top: .5rem;
}
.btn:hover, input[type="submit"]:hover {
    background: var(--navy);
    transform: translateY(-1px);
    color: var(--bianco);
}

/* ── Alert ───────────────────────────────────────────────────── */
.alert, .alert-error, .alert-ok, .alert-success, .alert-warning {
    padding: .65rem 1rem;
    border-radius: var(--r);
    margin-bottom: 1rem;
    font-size: .9rem;
}
.alert-error   { background: #fdecea; color: var(--errore); border: 1px solid #f5c6c2; }
.alert-ok,
.alert-success { background: #eafaf1; color: var(--ok);     border: 1px solid #a9dfb5; }
.alert-warning { background: #fef5e4; color: #d35400;       border: 1px solid #f0b27a; }

/* ── Tabelle ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r); }
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bianco);
    box-shadow: var(--ombra);
    border-radius: var(--r);
    overflow: hidden;
    font-size: .88rem;
    min-width: 480px; /* forza scroll su mobile */
}
th {
    background: var(--blu);
    color: var(--bianco);
    padding: .65rem .9rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
td {
    padding: .6rem .9rem;
    border-bottom: 1px solid var(--az-light);
    color: var(--testo);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(111,168,214,.07); }

/* ── Pagina ordini — prodotto con maglia ─────────────────────── */
.prodotto-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: flex-start;
    margin-top: 1rem;
}
.prodotto-img {
    width: 100%;
    max-width: 300px;
    border-radius: var(--r);
    box-shadow: var(--ombra);
    object-fit: cover;
}
.prodotto-form       { flex: 1; min-width: 220px; }
.prodotto-form h2    { color: var(--navy); margin-bottom: .6rem; font-size: 1.1rem; }
.prodotto-form p     { font-size: .88rem; color: #555; margin-bottom: 1rem; }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
    background: var(--navy);
    color: rgba(255,255,255,.6);
    text-align: center;
    padding: .9rem 1rem;
    font-size: .78rem;
    margin-top: auto;
}
.site-footer a { color: var(--az-light); text-decoration: none; }

/* ── Link helper ─────────────────────────────────────────────── */
.link-back { display: inline-block; margin-top: 1rem; font-size: .88rem; }

/* ── Varianti bottone ────────────────────────────────────────── */
.btn.btn-danger  { background: var(--errore); }
.btn.btn-danger:hover  { background: #922b21; transform: translateY(-1px); color: var(--bianco); }
.btn.btn-success { background: var(--ok); }
.btn.btn-success:hover { background: #196f3d; transform: translateY(-1px); color: var(--bianco); }
.btn-sm, .btn.btn-sm { padding: .35rem .8rem; font-size: .8rem; }

/* ── Utility layout ──────────────────────────────────────────── */
.form-inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .4rem; }
.checkbox-label { display: flex; align-items: center; gap: .3rem; font-weight: normal; margin-bottom: 0; }

/* ── Utility spacing ─────────────────────────────────────────── */
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }

/* ── Utility testo ───────────────────────────────────────────── */
.text-uppercase { text-transform: uppercase; }
.text-muted     { color: #777; }
.text-center    { text-align: center; }
.text-sm        { font-size: .88rem; }
.text-warning   { color: #d35400; }
.form-footer    { margin-top: 1rem; font-size: .88rem; }
.form-text      { font-size: .9rem; margin-bottom: .9rem; }
.select-sm      { font-size: .8rem; margin-top: 0; }

/* ── Input speciali ──────────────────────────────────────────── */
.input-otp { letter-spacing: .3em; font-size: 1.4rem; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — hamburger < 640px
═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
    .nav-toggle-label { display: flex; align-items: center; }

    .topbar { flex-wrap: wrap; }

    /* Apertura menu: #nav-toggle è fratello precedente di .topbar-nav */
    #nav-toggle:checked ~ .topbar-nav {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        padding: .4rem 0 .3rem;
        border-top: 1px solid rgba(255,255,255,.14);
        margin-top: .3rem;
        gap: 0;
    }
    /* Di default su mobile il nav è nascosto */
    .topbar-nav {
        display: none;
    }

    .topbar-nav a { width: 100%; padding: .55rem .6rem; border-radius: 0; }
    .topbar-nav a.nav-logout { margin-left: 0; border: none; border-top: 1px solid rgba(255,255,255,.1); }

    /* Form */
    .form-card { padding: 1.4rem 1rem; margin: 1rem .5rem; }

    /* Prodotto */
    .prodotto-wrap { flex-direction: column; }
    .prodotto-img  { max-width: 100%; }

    /* Hero */
    .hero-logo { width: 85px; height: 85px; }
    .hero h1   { font-size: 1.2rem; }
}

/* ── Desktop ottimizzazioni ──────────────────────────────────── */
@media (min-width: 960px) {
    .dashboard-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .form-card      { padding: 2.25rem 2rem; }
    .hero-logo      { width: 130px; height: 130px; }
}
