/* ============================================================
   BarberPro — Web App Cliente
   Grafica minimal ed elegante, coerente col brand della landing
   ============================================================ */

:root {
    --bg: #0f0f23;
    --bg-elev: #16162e;
    --bg-card: #1a1a2e;
    --bg-card-hover: #20203a;
    --accent: #e94560;
    --accent-hover: #d63851;
    --accent-soft: rgba(233, 69, 96, 0.12);
    --gold: #d4a574;
    --green: #4ecca3;
    --text: #f2f2f5;
    --text-muted: #9a9ab0;
    --text-faint: #6b6b82;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 22px;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 0 1px var(--accent), 0 8px 30px rgba(233, 69, 96, 0.25);
    --font-head: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --nav-h: 68px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
em { font-style: italic; color: var(--gold); }
small { font-weight: 400; color: var(--text-faint); }

/* ---------- Bottoni ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 26px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    white-space: nowrap;
    background: none;
    color: var(--text);
}
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 10px 26px rgba(233, 69, 96, 0.35); }
.btn--ghost { border-color: var(--border-strong); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--lg { padding: 15px 34px; font-size: 1.02rem; }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 16px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Navbar ---------- */
.nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-h);
    background: rgba(15, 15, 35, 0.85);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
}
.nav__inner {
    max-width: 1120px; margin: 0 auto; height: 100%;
    padding: 0 24px;
    display: flex; align-items: center; gap: 28px;
}

/* Top app bar (solo mobile): logo + titolo della schermata corrente */
.topbar { display: none; }
.topbar__brand {
    display: flex; align-items: center; gap: 7px;
    font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; color: var(--text);
    flex-shrink: 0;
}
.topbar__title {
    font-size: 0.95rem; font-weight: 600; color: var(--text-muted);
    padding-left: 12px; margin-left: 12px; border-left: 1px solid var(--border);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__title:empty { display: none; }
.nav__brand {
    display: flex; align-items: center; gap: 9px;
    font-family: var(--font-head); font-size: 1.3rem; font-weight: 700;
}
.nav__links { display: flex; align-items: center; gap: 6px; margin-left: 12px; }
.nav__link {
    font-size: 0.92rem; font-weight: 500; color: var(--text-muted);
    padding: 8px 14px; border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease);
}
.nav__link:hover { color: var(--text); background: var(--bg-card); }
.nav__link.is-active { color: var(--text); background: var(--accent-soft); }
.nav__actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav__user {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 6px 6px 14px; border-radius: 999px;
    background: var(--bg-card); border: 1px solid var(--border);
}
.nav__user-name { font-size: 0.88rem; font-weight: 500; }
.nav__avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    color: #fff; font-weight: 700; font-size: 0.85rem;
}
/* ---------- Bottom navigation (mobile, stile app) ---------- */
.tabbar { display: none; }
.tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 8px 4px; background: none; border: none; cursor: pointer;
    color: var(--text-faint); font-family: inherit; font-size: 0.68rem; font-weight: 500;
    transition: color 0.2s var(--ease); text-decoration: none;
}
.tab svg { width: 23px; height: 23px; }
.tab.is-active { color: var(--accent); }
.tab[data-tab-logout] { color: var(--text-faint); }
.tab:active { opacity: 0.7; }

/* ---------- Layout viste ---------- */
.app { max-width: 1120px; margin: 0 auto; padding: calc(var(--nav-h) + 40px) 24px 80px; }
.view-enter { animation: fadeUp 0.45s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.section-head { text-align: center; margin-bottom: 36px; }
.section-head--left { display: flex; align-items: center; justify-content: space-between; text-align: left; gap: 20px; flex-wrap: wrap; }
.section-title { font-family: var(--font-head); font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 600; }
.section-sub { color: var(--text-muted); margin-top: 6px; }

/* ---------- Hero (home) ---------- */
.hero {
    text-align: center; padding: 40px 0 64px;
    position: relative;
}
.hero__eyebrow {
    display: inline-block; font-size: 0.8rem; font-weight: 600; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--gold);
    padding: 6px 16px; border: 1px solid var(--border-strong); border-radius: 999px; margin-bottom: 24px;
}
.hero__title { font-family: var(--font-head); font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 700; line-height: 1.1; }
.hero__sub { color: var(--text-muted); font-size: 1.1rem; max-width: 520px; margin: 20px auto 34px; }
.hero__cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- Servizi (griglia card) ---------- */
.services-grid, .choice-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
}
.service-card, .choice {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px;
    transition: all 0.25s var(--ease); cursor: pointer;
    display: flex; flex-direction: column; gap: 8px; text-align: left;
    position: relative;
    color: var(--text); font-family: var(--font-body);
}
.service-card:hover, .choice:hover { border-color: var(--border-strong); background: var(--bg-card-hover); transform: translateY(-3px); }
.choice.is-selected { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.choice.is-selected::after {
    content: '✓'; position: absolute; top: 16px; right: 16px;
    width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff;
    display: grid; place-items: center; font-size: 0.8rem; font-weight: 700;
}
.choice__name { font-size: 1.05rem; font-weight: 600; }
.choice__meta { color: var(--text-muted); font-size: 0.88rem; }
.choice__price { font-family: var(--font-head); font-size: 1.3rem; font-weight: 600; color: var(--gold); margin-top: auto; }
.choice__role { color: var(--text-faint); font-size: 0.85rem; }
.choice__avatar {
    width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--gold)); color: #fff; font-weight: 700; font-size: 1.1rem; margin-bottom: 6px;
}

/* ---------- Auth ---------- */
.auth { display: flex; justify-content: center; padding-top: 10px; }
.auth__card { width: 100%; max-width: 440px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; box-shadow: var(--shadow); }
.auth__tabs { display: flex; background: var(--bg); border-radius: var(--radius); padding: 5px; margin-bottom: 8px; }
.auth__tab { flex: 1; padding: 11px; border: none; background: none; color: var(--text-muted); font-family: inherit; font-size: 0.95rem; font-weight: 600; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s var(--ease); }
.auth__tab.is-active { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow); }
.auth__form { padding: 20px 24px 26px; }
.auth__title { font-family: var(--font-head); font-size: 1.7rem; font-weight: 600; }
.auth__sub { color: var(--text-muted); margin-bottom: 22px; font-size: 0.95rem; }
.auth__status { margin-top: 14px; font-size: 0.9rem; text-align: center; min-height: 1.2em; }
.auth__status.is-error { color: var(--accent); }
.auth__status.is-success { color: var(--green); }
.is-hidden { display: none !important; }

/* ---------- Campi form ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }

/* Vista Account (privacy e dati) */
.account__profile { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.account__avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 1.2rem; }
.account__name { font-size: 1.2rem; font-weight: 600; }
.account__email { color: var(--text-muted); font-size: 0.9rem; }
.account__card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.account__title { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.account__hint { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; margin-bottom: 14px; }
.account__link { display: inline-block; color: var(--accent); text-decoration: underline; font-size: 0.92rem; }
.account__danger { color: var(--accent); border-color: rgba(233,69,96,0.4); }
.account__danger:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Checkbox di consenso (registrazione) */
.consent { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 14px; cursor: pointer; }
.consent input[type="checkbox"] { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.consent span { font-size: 0.85rem; line-height: 1.5; color: var(--text-muted); }
.consent a { color: var(--accent); text-decoration: underline; }
.consent em { color: var(--text-faint); font-style: normal; }
.field > span { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.field input, .field textarea, .field select {
    background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px 14px; color: var(--text); font-family: inherit; font-size: 0.95rem;
    transition: border-color 0.2s var(--ease); width: 100%;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }

/* ---------- Booking stepper ---------- */
.booking__head { margin-bottom: 34px; }
.booking__title { font-family: var(--font-head); font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 600; text-align: center; margin-bottom: 28px; }
.stepper { display: flex; align-items: center; flex-wrap: nowrap; max-width: 620px; margin: 0 auto; }
.stepper__item {
    display: flex; align-items: center; gap: 9px; font-size: 0.9rem; font-weight: 500; color: var(--text-faint);
    flex: 1 1 0; min-width: 0;
}
.stepper__item:last-child { flex: 0 0 auto; }
.stepper__num {
    width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
    background: var(--bg-card); border: 1.5px solid var(--border); font-size: 0.82rem; font-weight: 700; flex-shrink: 0;
    transition: all 0.3s var(--ease);
}
.stepper__label { white-space: nowrap; }
.stepper__item.is-active { color: var(--text); }
.stepper__item.is-active .stepper__num { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper__item.is-done .stepper__num { background: var(--green); border-color: var(--green); color: var(--bg); }
/* Il connettore riempie lo spazio residuo, uniforme fra tutti gli step */
.stepper__item:not(:last-child)::after { content: ''; flex: 1 1 auto; min-width: 14px; height: 1.5px; background: var(--border); margin: 0 12px; }

.step__nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.step__nav .btn:only-child { margin-left: auto; }

/* ---------- Data & ora ---------- */
.datetime { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }
.calendar { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.calendar__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.calendar__month { font-family: var(--font-head); font-size: 1.15rem; font-weight: 600; text-transform: capitalize; }
.calendar__nav { display: flex; gap: 6px; }
.calendar__nav button { width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; font-size: 1rem; transition: all 0.2s var(--ease); }
.calendar__nav button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.calendar__nav button:disabled { opacity: 0.3; cursor: not-allowed; }
.calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar__dow { text-align: center; font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; padding: 6px 0; font-weight: 600; }
.calendar__day {
    aspect-ratio: 1; border: none; background: none; color: var(--text); border-radius: var(--radius-sm);
    cursor: pointer; font-family: inherit; font-size: 0.9rem; transition: all 0.15s var(--ease);
    display: grid; place-items: center;
}
.calendar__day:hover:not(:disabled) { background: var(--bg-card-hover); }
.calendar__day.is-selected { background: var(--accent); color: #fff; font-weight: 700; }
.calendar__day.is-today { box-shadow: inset 0 0 0 1.5px var(--gold); }
.calendar__day:disabled { color: var(--text-faint); opacity: 0.4; cursor: not-allowed; }
.calendar__day.is-empty { visibility: hidden; }

.slots__title { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.slots__hint { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 14px; }
.slots__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot {
    padding: 11px 6px; border: 1.5px solid var(--border); background: var(--bg-card); color: var(--text);
    border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; font-size: 0.9rem; font-weight: 500;
    transition: all 0.15s var(--ease); text-align: center;
}
.slot:hover:not(:disabled) { border-color: var(--accent); }
.slot.is-selected { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.slot:disabled { opacity: 0.3; cursor: not-allowed; text-decoration: line-through; }

/* ---------- Riepilogo ---------- */
.summary { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 22px; margin-bottom: 20px; }
.summary__row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--border); }
.summary__row:last-child { border-bottom: none; }
.summary__label { color: var(--text-muted); font-size: 0.9rem; }
.summary__value { font-weight: 600; text-align: right; }
.summary__value--price { font-family: var(--font-head); font-size: 1.3rem; color: var(--gold); }

/* ---------- I miei appuntamenti ---------- */
.appt-list { display: flex; flex-direction: column; gap: 14px; }
.appt-card {
    display: flex; align-items: center; gap: 20px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px;
    transition: border-color 0.2s var(--ease);
}
.appt-card:hover { border-color: var(--border-strong); }
.appt-card__date {
    text-align: center; flex-shrink: 0; width: 66px; padding-right: 20px; border-right: 1px solid var(--border);
}
.appt-card__day { font-family: var(--font-head); font-size: 1.8rem; font-weight: 700; line-height: 1; }
.appt-card__month { font-size: 0.78rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 1px; margin-top: 4px; }
.appt-card__info { flex: 1; min-width: 0; }
.appt-card__service { font-size: 1.08rem; font-weight: 600; }
.appt-card__meta { color: var(--text-muted); font-size: 0.9rem; margin-top: 3px; }
.appt-card__meta strong { color: var(--text); font-weight: 600; }
.appt-card__side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex-shrink: 0; }
.badge { font-size: 0.75rem; font-weight: 600; padding: 4px 12px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.5px; }
.badge--confirmed { background: rgba(78, 204, 163, 0.15); color: var(--green); }
.badge--completed { background: rgba(154, 154, 176, 0.15); color: var(--text-muted); }
.badge--cancelled { background: rgba(233, 69, 96, 0.15); color: var(--accent); }
.appt-card--past { opacity: 0.62; }

/* ---------- Stati vuoti / skeleton ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty__icon { font-size: 2.4rem; margin-bottom: 12px; }
.empty__title { font-family: var(--font-head); font-size: 1.4rem; color: var(--text); margin-bottom: 8px; }
.skeleton-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); height: 120px; position: relative; overflow: hidden; }
.skeleton-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 10px; align-items: center; width: max-content; max-width: 90vw; }
.toast {
    padding: 13px 22px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 500;
    background: var(--bg-elev); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
    animation: toastIn 0.3s var(--ease); display: flex; align-items: center; gap: 10px;
}
.toast--success { border-color: var(--green); }
.toast--error { border-color: var(--accent); }
.toast__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.toast--success .toast__dot { background: var(--green); }
.toast--error .toast__dot { background: var(--accent); }
.toast--info .toast__dot { background: var(--gold); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Responsive ---------- */
@media (max-width: 780px) {
    .datetime { grid-template-columns: 1fr; }
    .slots__grid { grid-template-columns: repeat(4, 1fr); }

    /* Su mobile: al posto della navbar da sito, una top app bar sottile
       (logo + titolo schermata) in alto e la bottom navigation in basso */
    .nav { display: none; }
    .topbar {
        display: flex; align-items: center;
        position: fixed; top: 0; left: 0; right: 0; z-index: 100;
        height: 54px; padding: 0 16px;
        background: rgba(15, 15, 35, 0.9); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
        border-bottom: 1px solid var(--border);
    }
    .tabbar {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
        background: rgba(15, 15, 35, 0.94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
        border-top: 1px solid var(--border);
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
        justify-content: space-around;
    }
    .app { padding-top: 74px; padding-bottom: 92px; }

    /* I toast restano sopra la bottom navigation */
    .toasts { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

    .stepper__num { width: 28px; height: 28px; }
    .stepper__item { font-size: 0.82rem; }
    /* Sotto i 620px le etichette rischiano di stringersi: mostro solo i numeri */
    .stepper__label { display: none; }
    .stepper__item:not(:last-child)::after { margin: 0 6px; }
}
@media (max-width: 480px) {
    .app { padding: calc(var(--nav-h) + 24px) 16px 60px; }
    .stepper__item { gap: 5px; }
    .appt-card { flex-wrap: wrap; }
    .section-head--left { justify-content: center; }
}
