@import 'design-system.css';

/* =========================================================
   APP CHECKIN OSPITI — style.css
   Mobile-first, ottimizzato per smartphone
   ========================================================= */

html {
    overflow-x: hidden;
}

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

:root {
    --bg:           #0f1117;
    --bg-card:      #1a1d27;
    --bg-sezione:   #222536;
    --accent:       #4f8ef7;
    --accent-light: #7aaeff;
    --testo:        #e8eaf0;
    --testo-muted:  #8b90a0;
    --bordo:        #2e3248;
    --errore:       #e05c5c;
    --ok:           #4caf82;
    --raggio:       12px;
    --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    background: var(--bg);
    color: var(--testo);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
}

/* ---- LAYOUT ---- */

.app {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--bordo);
    padding: 14px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    color: var(--accent);
    font-size: 20px;
}

.header-nome {
    font-size: 15px;
    font-weight: 600;
    color: var(--testo);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--testo);
    cursor: pointer;
}

.header-brand-icon {
    color: var(--accent);
    font-size: 18px;
}

.header-brand-name {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.3px;
}

/* User Dropdown */
.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    background: var(--bg-sezione);
    border: 1px solid var(--bordo);
    border-radius: 10px;
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--testo);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.user-dropdown-btn:hover {
    border-color: var(--accent);
    background: var(--bg-card);
}

.user-avatar {
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.user-name {
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-arrow {
    font-size: 10px;
    color: var(--testo-muted);
}

.user-dropdown-menu {
    position: absolute;
    right: 0;
    top: 44px;
    background: var(--bg-card);
    border: 1px solid var(--bordo);
    border-radius: 10px;
    padding: 6px 0;
    z-index: 999;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    animation: fadeInDropdown 0.15s ease-out;
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
    padding: 10px 14px;
}

.user-full-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--testo);
    line-height: 1.3;
}

.user-email-sub {
    font-size: 11px;
    color: var(--testo-muted);
    margin-top: 2px;
    word-break: break-all;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--bordo);
    margin: 6px 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    color: var(--testo);
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.user-dropdown-item:hover {
    background: var(--bg-sezione);
}

.user-dropdown-item i {
    font-size: 15px;
    color: var(--testo-muted);
}

.user-dropdown-item.danger {
    color: var(--errore);
}

.user-dropdown-item.danger i {
    color: var(--errore);
}


.main {
    flex: 1;
    padding: 20px 16px 40px;
}

.footer {
    text-align: center;
    font-size: 11px;
    color: var(--testo-muted);
    padding: 16px;
    border-top: 1px solid var(--bordo);
}

/* ---- CARD ---- */

.card {
    background: var(--bg-card);
    border-radius: var(--raggio);
    border: 1px solid var(--bordo);
    padding: 24px 20px;
}

.card-center {
    text-align: center;
}

/* ---- TIPOGRAFIA ---- */

.step-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}

.titolo {
    font-size: 24px;
    font-weight: 700;
    color: var(--testo);
    margin-bottom: 8px;
    line-height: 1.2;
}

.sottotitolo {
    font-size: 14px;
    color: var(--testo-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

.nota {
    font-size: 13px;
    color: var(--testo-muted);
    margin-top: 16px;
    text-align: center;
}

/* ---- SEZIONI FORM ---- */

.sezione {
    margin-bottom: 24px;
}

.sezione-titolo {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-light);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bordo);
}

/* ---- CAMPI ---- */

.campo {
    margin-bottom: 16px;
}

.campo label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--testo-muted);
    margin-bottom: 6px;
}

.campo input,
.campo select {
    width: 100%;
    background: var(--bg);
    border: 1.5px solid var(--bordo);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 16px;
    color: var(--testo);
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.campo input:focus,
.campo select:focus {
    border-color: var(--accent);
}

.campo select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b90a0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.campo-errore input,
.campo-errore select {
    border-color: var(--errore);
}

.errore-msg {
    font-size: 12px;
    color: var(--errore);
    margin-top: 4px;
}

.obbligatorio {
    color: var(--accent);
    margin-left: 2px;
}

/* ---- FOTO ---- */

.campo-foto {
    margin-bottom: 16px;
    background: var(--bg);
    border: 1.5px dashed var(--bordo);
    border-radius: 8px;
    padding: 16px;
}

.label-foto {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--testo-muted);
    margin-bottom: 8px;
}

.campo-foto input[type="file"] {
    width: 100%;
    font-size: 14px;
    color: var(--testo);
}

.foto-hint {
    font-size: 11px;
    color: var(--testo-muted);
    margin-top: 6px;
}

/* ---- BOTTONI ---- */

.btn-primary {
    display: block;
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
    -webkit-appearance: none;
}

.btn-primary:active {
    background: var(--accent-light);
}

/* ---- INDEX — lista strutture ---- */

.lista-strutture {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.btn-struttura {
    display: block;
    background: var(--bg-sezione);
    border: 1.5px solid var(--bordo);
    border-radius: 10px;
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--testo);
    text-decoration: none;
    transition: border-color 0.2s;
}

.btn-struttura:active {
    border-color: var(--accent);
}

/* ---- RADIO CARD (scelta membri) ---- */

.scelta-gruppo {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.radio-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg);
    border: 1.5px solid var(--bordo);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
}

.radio-card input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.radio-card input[type="radio"]:checked + .radio-box {
    color: var(--testo);
}

.radio-box {
    display: flex;
    flex-direction: column;
}

.radio-titolo {
    font-size: 15px;
    font-weight: 600;
    color: var(--testo);
}

.radio-desc {
    font-size: 13px;
    color: var(--testo-muted);
}

.campo-num-membri {
    margin-bottom: 20px;
}

.campo-num-membri label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--testo-muted);
    margin-bottom: 6px;
}

.campo-num-membri input {
    width: 100%;
    background: var(--bg);
    border: 1.5px solid var(--bordo);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 16px;
    color: var(--testo);
    outline: none;
}

/* ---- ICONA OK (pagina grazie) ---- */

.icona-ok {
    width: 64px;
    height: 64px;
    background: var(--ok);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    margin: 0 auto 20px;
}

/* ---- RIEPILOGO BOX (pagina grazie) ---- */

.riepilogo-box {
    background: var(--bg);
    border: 1px solid var(--bordo);
    border-radius: 10px;
    padding: 16px;
    margin: 20px 0;
    text-align: left;
}

.riepilogo-riga {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--bordo);
}

.riepilogo-riga:last-child {
    border-bottom: none;
}

.riepilogo-riga .label {
    font-size: 13px;
    color: var(--testo-muted);
}

.riepilogo-riga .valore {
    font-size: 14px;
    font-weight: 600;
    color: var(--testo);
}

/* ---- ADMIN ---- */

.form-cerca {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.input-cerca {
    flex: 1;
    background: var(--bg);
    border: 1.5px solid var(--bordo);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 15px;
    color: var(--testo);
    outline: none;
}

.input-cerca:focus {
    border-color: var(--accent);
}

.btn-cerca {
    background: var(--accent);
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 18px;
    cursor: pointer;
}

.tabella-wrapper {
    overflow-x: auto;
    margin-bottom: 12px;
}

.tabella {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tabella th {
    background: var(--bg-sezione);
    color: var(--testo-muted);
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
}

.tabella td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--bordo);
    color: var(--testo);
    white-space: nowrap;
}

.tabella tr:hover td {
    background: var(--bg-sezione);
}

/* ---- REGISTRAZIONE OK ---- */
.registrazione-ok {
    background: #1a2e1e;
    border: 1px solid var(--ok);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--ok);
    margin-bottom: 16px;
}

.sottotitolo-avviso {
    font-size: 13px;
    color: var(--testo-muted);
    margin-bottom: 20px;
    padding: 10px 14px;
    background: var(--bg-sezione);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

/* ---- INFO BOX ---- */
.info-box {
    background: #1a2535;
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--testo-muted);
    margin: 16px 0;
    line-height: 1.6;
}

/* ---- BADGE GEMINI ---- */
.badge-ai {
    display: inline-block;
    background: #1a2e1e;
    border: 1px solid var(--ok);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 11px;
    color: var(--ok);
    margin-bottom: 16px;
}

/* ---- PRIVACY POLICY ---- */
.privacy-box {
    background: var(--bg);
    border: 1px solid var(--bordo);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.privacy-sezione {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bordo);
}

.privacy-sezione:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.privacy-titolo {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 6px;
}

.privacy-sezione p {
    font-size: 13px;
    color: var(--testo-muted);
    line-height: 1.6;
}

/* ---- CHECKBOX CARD ---- */
.checkbox-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg);
    border: 1.5px solid var(--bordo);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
}

.checkbox-card input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox-testo {
    font-size: 13px;
    color: var(--testo);
    line-height: 1.6;
}

/* ---- SPINNER ---- */
.spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--bordo);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- PROGRESS BAR ---- */
.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 10px 20px 6px;
}

.progress-step {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bordo);
    color: var(--testo-muted);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.3s, color 0.3s;
}

.progress-step.attivo {
    background: var(--accent);
    color: #fff;
}

.progress-linea {
    flex: 1;
    height: 2px;
    background: var(--bordo);
    max-width: 60px;
    transition: background 0.3s;
}

.progress-linea.attiva {
    background: var(--accent);
}
