/* Form: etichetta sopra il campo, colori dal tema (base.css). */

form { display: flex; flex-direction: column; gap: 22px; }

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

.form-group .control-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-strong);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0 16px;
    height: 50px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    color: var(--text-strong);
    font-size: 16px;
    line-height: 1.4;
    transition: border-color 0.2s ease;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--muted); }
.form-group textarea {
    height: 170px;
    padding: 14px 16px;
    line-height: 1.6;
    resize: none;
}
.form-group textarea[readonly] {
    height: 190px;
    font-size: 13px;
    color: var(--text);
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--focus); }

.form-help { font-size: 13px; line-height: 1.5; color: var(--muted); }

.form-group.checkbox { flex-direction: row; align-items: center; gap: 12px; }
.form-group.checkbox input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--btn);
}
.form-group.checkbox label { font-size: 15px; font-weight: 600; color: var(--text-strong); cursor: pointer; }

.has-error input[type="text"],
.has-error input[type="email"],
.has-error input[type="password"],
.has-error textarea { border-color: var(--danger); }
.has-error .control-label,
.has-error .form-help,
.has-error.checkbox label { color: var(--danger); }

.button-container { display: flex; }

.button {
    align-self: flex-start;
    height: 50px;
    min-width: 140px;
    padding: 0 36px;
    background: var(--btn);
    border: 1px solid var(--btn);
    border-radius: 999px;
    color: var(--btn-text);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.button span { color: inherit; font-style: normal; font-weight: inherit; }
.button:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.button.button-ghost {
    background: transparent;
    border-color: var(--ghost-border);
    color: var(--ghost-text);
}
.button.button-ghost:hover { background: var(--surface-2); }
.button:disabled,
.button:disabled:hover {
    background: var(--btn);
    border-color: var(--btn);
    opacity: 0.45;
    cursor: not-allowed;
}
.button.button-ghost:disabled,
.button.button-ghost:disabled:hover { background: transparent; border-color: var(--ghost-border); }

/* Campo con pulsante dentro, a destra (email + Verifica in registrazione): il bordo è del contenitore */
.input-azione {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    height: 50px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    transition: border-color 0.2s ease;
}
.input-azione:focus-within { border-color: var(--focus); }
.form-group .input-azione input[type="email"] {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    outline: none;
}
.input-azione .button {
    min-width: 0;
    height: 48px;
    padding: 0 20px;
    flex-shrink: 0;
    border-radius: 0 12px 12px 0;
    font-size: 15px;
}
.input-azione input[readonly] { color: var(--muted); cursor: default; }
.has-error .input-azione { border-color: var(--danger); }
.form-help.email-verificata { color: var(--accent); font-weight: 700; }
.form-help .link-piccolo {
    margin-left: 6px;
    color: var(--muted);
    font-weight: 400;
    text-decoration: underline;
}
.form-help .link-piccolo:hover { color: var(--text-strong); }

/* Password con il pulsante mostra/nascondi (login): come CampoPassword dell'app (accountpage.css) */
.campo-password { position: relative; }
.form-group .campo-password input { padding-right: 56px; }
.campo-password-occhio {
    position: absolute;
    top: 3px;
    right: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.campo-password-occhio:hover { color: var(--text-strong); }
.campo-password-occhio:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.campo-password-occhio svg[hidden] { display: none; }

/* Finestra del codice di verifica: <dialog> nativo, aperto con showModal() */
.dialog-codice {
    width: min(420px, calc(100vw - 32px));
    padding: 28px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(43, 26, 38, 0.25);
}
.dialog-codice::backdrop { background: rgba(22, 16, 26, 0.55); }
.dialog-codice form { gap: 18px; }
.dialog-codice h2 {
    margin: 0;
    font-family: var(--font-title);
    font-weight: 600;
    font-size: 30px;
    color: var(--text-strong);
}
.dialog-codice p { margin: 0; line-height: 1.5; }
.dialog-codice #codice {
    font-size: 26px;
    letter-spacing: 12px;
    text-align: center;
}
.dialog-codice .form-help:empty { display: none; }
.dialog-azioni { display: flex; justify-content: flex-end; gap: 10px; }
.dialog-azioni .button { min-width: 0; padding: 0 26px; }

@media only screen and (max-width: 900px) {
    .form-row { grid-template-columns: 1fr; }
}
