/**
 * GrantRadar — Auth CSS
 * Stili per le pagine di autenticazione: login, registrazione,
 * recupero password, attivazione account.
 *
 * Usa le variabili CSS definite in fogliostile.css e i colori brand
 * di marketing.css (--gr-orange, ecc.).
 */

/* ============================================================
   LAYOUT PRINCIPALE PAGINA AUTH
   ============================================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
}

/* Header minimale: solo logo centrato */
.auth-header {
    padding: 20px var(--spacing-xl);
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-logo {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.auth-logo img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.auth-logo span {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--gr-orange, #e85520);
    letter-spacing: -0.02em;
    line-height: 1;
}

.auth-logo:hover {
    text-decoration: none;
}

.auth-logo:hover span {
    color: #c94410;
}

/* Area centrale — flex-grow per spingere footer in fondo */
.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-md);
}

/* ============================================================
   CARD AUTH
   ============================================================ */

.auth-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 28px 32px;
    width: 100%;
    max-width: 480px;
    text-align: center;
}

/* Variante più larga per pagine info (activate_register, ecc.) */
.auth-card--wide {
    max-width: 560px;
}

/* ============================================================
   INTESTAZIONE CARD
   ============================================================ */

.auth-icon-wrap {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-lg);
    background: var(--gray-100);
    color: var(--gray-500);
}

.auth-icon-wrap--success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.auth-icon-wrap--orange {
    background: rgba(232, 85, 32, 0.1);
    color: var(--gr-orange, #e85520);
}

.auth-banner-link {
    display: block;
    margin: -28px -32px 16px;
    line-height: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    overflow: hidden;
}

.auth-banner-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    object-position: center center;
    display: block;
    transition: opacity 0.2s ease;
}

.auth-banner-link:hover .auth-banner-img {
    opacity: 0.9;
}

.auth-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gr-orange, #e85520);
    margin-bottom: 16px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    /* Reset fogliostile.css h1 (background, padding, shadow, radius) */
    background: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.auth-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-lg);
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */

.auth-form {
    text-align: left;
    margin-top: var(--spacing-lg);
}

.auth-form-group {
    margin-bottom: var(--spacing-md);
}

.auth-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.auth-form-group input[type="text"],
.auth-form-group input[type="email"],
.auth-form-group input[type="tel"],
.auth-form-group input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
    font-family: var(--font-family);
}

.auth-form-group input:focus {
    border-color: var(--gr-orange, #e85520);
    box-shadow: 0 0 0 3px rgba(232, 85, 32, 0.12);
}

.auth-form-group input.has-error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.auth-field-error {
    font-size: 0.8125rem;
    color: var(--error-color);
    margin-top: 4px;
    display: block;
}

/* ============================================================
   PULSANTI
   ============================================================ */

.btn-auth-primary {
    display: block;
    width: 100%;
    padding: 13px var(--spacing-lg);
    background: var(--gr-orange, #e85520);
    color: var(--white);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
    letter-spacing: 0.01em;
    margin-top: var(--spacing-md);
    font-family: var(--font-family);
}

.btn-auth-primary:hover,
.btn-auth-primary:focus {
    background: var(--gr-orange-dark, #c44214);
    box-shadow: 0 4px 16px rgba(232, 85, 32, 0.3);
    color: var(--white);
    outline: none;
}

/* ============================================================
   MESSAGGI FLASH / AVVISI
   ============================================================ */

.auth-alert {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
    text-align: left;
    border-left: 4px solid transparent;
}

.auth-alert--error {
    background: rgba(239, 68, 68, 0.08);
    border-color: var(--error-color);
    color: #b91c1c;
}

.auth-alert--success {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--success-color);
    color: #065f46;
}

.auth-alert--warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: var(--warning-color);
    color: #92400e;
}

.auth-alert--info {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--info-color);
    color: #1e40af;
}

/* ============================================================
   INFO BOX (activate_register)
   ============================================================ */

.auth-info-box {
    background: rgba(232, 85, 32, 0.06);
    border: 1px solid rgba(232, 85, 32, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    text-align: left;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ============================================================
   PASSI GUIDATI (auth-steps)
   ============================================================ */

.auth-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--spacing-lg);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.auth-step {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    font-size: 0.925rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.auth-step__num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--gr-orange, #e85520);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.auth-step__text strong {
    color: var(--text-primary);
}

/* ============================================================
   NOTE E DIVIDER
   ============================================================ */

.auth-note {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.auth-note a {
    color: var(--gr-orange, #e85520);
    text-decoration: none;
}

.auth-note a:hover {
    text-decoration: underline;
}

.auth-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--spacing-sm) 0;
}

/* ============================================================
   FOOTER LINK (login / registrati / home)
   ============================================================ */

.auth-footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    font-size: 0.875rem;
}

.auth-footer-links a {
    color: var(--gr-orange, #e85520);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer-links a:hover {
    text-decoration: underline;
}

.auth-footer-sep {
    color: var(--gray-400);
}

/* Testo "oppure" sotto submit */
.auth-or {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
    margin: var(--spacing-md) 0;
}

/* Checkbox accetta termini */
.auth-check-group {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.auth-check-group input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--gr-orange, #e85520);
}

.auth-check-group a {
    color: var(--gr-orange, #e85520);
    text-decoration: none;
}

.auth-check-group a:hover {
    text-decoration: underline;
}

/* Link "Password dimenticata?" a destra del campo */
.auth-field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs);
}

.auth-field-row label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.auth-field-row a {
    font-size: 0.8125rem;
    color: var(--gr-orange, #e85520);
    text-decoration: none;
}

.auth-field-row a:hover {
    text-decoration: underline;
}

/* ============================================================
   FOOTER PAGINA AUTH
   ============================================================ */

.auth-footer {
    padding: var(--spacing-md) var(--spacing-xl);
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
    background: var(--white);
}

.auth-footer a {
    color: var(--text-light);
    text-decoration: none;
}

.auth-footer a:hover {
    color: var(--text-secondary);
    text-decoration: underline;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 520px) {
    .auth-main {
        padding: var(--spacing-sm) var(--spacing-sm);
        align-items: flex-start;
    }

    .auth-card {
        padding: 20px 20px;
        border-radius: var(--radius-lg);
        box-shadow: none;
        border: none;
        border-top: 1px solid var(--border-color);
    }

    .auth-banner-link {
        margin: -20px -20px 14px;
    }
}

/* ============================================================
   FORM AGGIORNATO — classi usate in login/registrazione/recupera
   ============================================================ */

/* Pulsante primario moderno (alias di btn-auth-primary + icone) */
.auth-btn {
    display: block;
    width: 100%;
    padding: 13px var(--spacing-lg);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
    letter-spacing: 0.01em;
    margin-top: var(--spacing-md);
    font-family: var(--font-family);
}

.auth-btn--primary {
    background: var(--gr-orange, #e85520);
    color: var(--white);
}

.auth-btn--primary:hover,
.auth-btn--primary:focus {
    background: var(--gr-orange-dark, #c44214);
    box-shadow: 0 4px 16px rgba(232, 85, 32, 0.3);
    color: var(--white);
    outline: none;
}

/* Griglia due colonne per form di registrazione */
.auth-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
}

@media (max-width: 480px) {
    .auth-form-row {
        grid-template-columns: 1fr;
    }
}

/* Input con icona toggle password a destra */
.auth-input-wrap {
    position: relative;
}

.auth-input-wrap input {
    width: 100%;
    padding-right: 44px;
}

.auth-toggle-pw {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    line-height: 1;
    transition: color var(--transition-fast);
}

.auth-toggle-pw:hover {
    color: var(--text-secondary);
}

/* Link "Password dimenticata?" nella label del campo password */
.auth-label-link {
    float: right;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--gr-orange, #e85520);
    text-decoration: none;
}

.auth-label-link:hover {
    text-decoration: underline;
}

/* Hint sotto il campo (testo grigio, non errore) */
.auth-field-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
    display: block;
}

/* Indica campo obbligatorio con asterisco rosso */
.auth-form-group .required,
.required {
    color: var(--error-color, #ef4444);
    margin-left: 2px;
}

/* Gruppo con checkbox (privacy policy) */
.auth-form-group--checkbox {
    text-align: left;
}

.auth-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.55;
    cursor: pointer;
}

.auth-checkbox-label input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--gr-orange, #e85520);
}

.auth-checkbox-label a {
    color: var(--gr-orange, #e85520);
    text-decoration: none;
}

.auth-checkbox-label a:hover {
    text-decoration: underline;
}

/* Riga trust signals sotto il submit */
.auth-trust-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.775rem;
    color: var(--text-light);
    margin-top: var(--spacing-sm);
}

.auth-trust-row span:not(:last-child)::after {
    content: ' ·';
    color: var(--gray-300);
}

/* Campo auth fuori dalla classe .auth-form (usato in login.php senza wrapping .auth-form) */
.auth-card .auth-form-group {
    margin-bottom: var(--spacing-sm);
    text-align: left;
}

.auth-card .auth-form-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.auth-card .auth-form-group input[type="text"],
.auth-card .auth-form-group input[type="email"],
.auth-card .auth-form-group input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
    font-family: var(--font-family);
    box-sizing: border-box;
}

.auth-card .auth-form-group input:focus {
    border-color: var(--gr-orange, #e85520);
    box-shadow: 0 0 0 3px rgba(232, 85, 32, 0.12);
}

.auth-card .auth-form-group.has-error input {
    border-color: var(--error-color, #ef4444);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}
