/*
 * ihc-form.css
 * Stile del form multi-step di affiliazione Italian Hybrid Community.
 *
 * Palette:
 *   Primario (testo, bordi attivi, bottoni): #2d2d2d  (grigio antracite scuro)
 *   Sfondo form:                             #ffffff
 *   Bordi campo:                             #e0e0e0
 *   Errori:                                  #dc3545  (rosso — accento puntuale)
 *   Successo:                                #28a745  (verde — accento puntuale)
 *   Verde tricolore (accento logo):          #008C45  (usato con parsimonia)
 *   Rosso tricolore (accento logo):          #CD212A  (usato con parsimonia)
 *
 * Nessuna dipendenza esterna. Font ereditato dal tema WordPress.
 */

/* ═══════════════════════════════════════════════════════════════
   WRAPPER GENERALE
   ═══════════════════════════════════════════════════════════════ */

.ihc-form-wrapper {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 24px 48px;
    background: #ffffff;
    color: #2d2d2d;
    font-size: 16px;
    line-height: 1.6;
    box-sizing: border-box;
}

.ihc-form-wrapper *,
.ihc-form-wrapper *::before,
.ihc-form-wrapper *::after {
    box-sizing: inherit;
}

/* ═══════════════════════════════════════════════════════════════
   BARRA DI PROGRESSO
   ═══════════════════════════════════════════════════════════════ */

.ihc-progress-bar-wrapper {
    margin-bottom: 40px;
}

/* Indicatori numerici degli step */
.ihc-progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 4px;
}

.ihc-step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #888888;
    font-size: 12px;
    font-weight: 700;
    transition: background 0.25s, color 0.25s;
    user-select: none;
}

.ihc-step-indicator--active {
    background: #2d2d2d;
    color: #ffffff;
}

.ihc-step-indicator--done {
    /* Accento verde tricolore per step completati — uso puntuale */
    background: #008C45;
    color: #ffffff;
}

/* Barra riempimento */
.ihc-progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.ihc-progress-fill {
    height: 100%;
    background: #2d2d2d;
    border-radius: 3px;
    width: 12.5%; /* Step 1 di 8 come default */
    transition: width 0.35s ease;
}

.ihc-progress-label {
    font-size: 13px;
    color: #666666;
    margin: 0;
    text-align: right;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ═══════════════════════════════════════════════════════════════
   STEP: VISIBILITÀ
   ═══════════════════════════════════════════════════════════════ */

.ihc-step {
    display: none;
}

.ihc-step--active {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════
   TITOLI STEP — stile condensato IHC
   ═══════════════════════════════════════════════════════════════ */

.ihc-step-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    font-size: 1.4em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #2d2d2d;
    margin: 0 0 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid #2d2d2d;
    line-height: 1.2;
}

.ihc-step-number {
    font-size: 0.75em;
    font-weight: 700;
    color: #888888;
    flex-shrink: 0;
}

.ihc-step-description {
    font-size: 14px;
    color: #666666;
    margin: 0 0 28px;
}

/* ═══════════════════════════════════════════════════════════════
   SOTTOSEZIONI (step 8: contatti + descrizione)
   ═══════════════════════════════════════════════════════════════ */

.ihc-subsection {
    margin-bottom: 32px;
}

.ihc-subsection:last-of-type {
    margin-bottom: 0;
}

.ihc-subsection-title {
    font-size: 1em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #2d2d2d;
    margin: 0 0 20px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
}

/* ═══════════════════════════════════════════════════════════════
   CAMPI
   ═══════════════════════════════════════════════════════════════ */

.ihc-field {
    margin-bottom: 20px;
}

.ihc-field:last-child {
    margin-bottom: 0;
}

/* Label */
.ihc-field > label,
.ihc-fieldset-legend {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: #2d2d2d;
    font-size: 15px;
}

/* Asterisco obbligatorio — accento rosso puntuale */
.ihc-required {
    color: #CD212A;
    margin-left: 2px;
    font-weight: 700;
}

/* Input testo, email, tel, url, number */
.ihc-form-wrapper input[type="text"],
.ihc-form-wrapper input[type="email"],
.ihc-form-wrapper input[type="tel"],
.ihc-form-wrapper input[type="url"],
.ihc-form-wrapper input[type="number"] {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 16px;
    color: #2d2d2d;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.ihc-form-wrapper input[type="text"]:focus,
.ihc-form-wrapper input[type="email"]:focus,
.ihc-form-wrapper input[type="tel"]:focus,
.ihc-form-wrapper input[type="url"]:focus,
.ihc-form-wrapper input[type="number"]:focus {
    border-color: #2d2d2d;
    box-shadow: 0 0 0 3px rgba(45, 45, 45, 0.12);
}

/* Textarea */
.ihc-form-wrapper textarea {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 16px;
    color: #2d2d2d;
    background: #ffffff;
    min-height: 100px;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    line-height: 1.5;
}

.ihc-form-wrapper textarea:focus {
    border-color: #2d2d2d;
    box-shadow: 0 0 0 3px rgba(45, 45, 45, 0.12);
}

/* Select */
.ihc-form-wrapper select {
    display: block;
    width: 100%;
    padding: 12px 40px 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 16px;
    color: #2d2d2d;
    background: #ffffff 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='%232d2d2d' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.ihc-form-wrapper select:focus {
    border-color: #2d2d2d;
    box-shadow: 0 0 0 3px rgba(45, 45, 45, 0.12);
}

/* Placeholder */
.ihc-form-wrapper input::placeholder,
.ihc-form-wrapper textarea::placeholder {
    color: #aaaaaa;
    font-size: 15px;
}

/* ─── Contatore caratteri textarea ─── */

.ihc-char-counter {
    display: block;
    text-align: right;
    font-size: 0.8em;
    color: #999999;
    margin-top: 4px;
}

.ihc-char-counter--warn {
    color: #dc3545;
    font-weight: 600;
}

/* ─── Campi errore ─── */

.ihc-field--error input[type="text"],
.ihc-field--error input[type="email"],
.ihc-field--error input[type="tel"],
.ihc-field--error input[type="url"],
.ihc-field--error input[type="number"],
.ihc-field--error textarea,
.ihc-field--error select {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12);
}

.ihc-field--error input:focus,
.ihc-field--error textarea:focus,
.ihc-field--error select:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.18);
}

/* Messaggio errore per campo */
.ihc-error-message {
    display: block;
    color: #dc3545;
    font-size: 0.85em;
    margin-top: 4px;
    min-height: 1.2em;
    font-weight: 500;
}

/* ── Checkbox privacy ── */
.ihc-field--privacy {
    margin-top: 24px;
    margin-bottom: 8px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
}

.ihc-privacy-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9em;
    line-height: 1.5;
    cursor: pointer;
}

.ihc-privacy-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin-top: 2px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    accent-color: #2d2d2d;
}

.ihc-privacy-label a {
    color: #2d2d2d;
    text-decoration: underline;
}

.ihc-field--privacy.ihc-field--error {
    border-color: #dc3545;
}

.ihc-required {
    color: #dc3545;
}

/* ═══════════════════════════════════════════════════════════════
   CHECKBOX
   ═══════════════════════════════════════════════════════════════ */

.ihc-field--checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ihc-field--checkbox:last-child {
    margin-bottom: 0;
}

.ihc-field--checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 3px;
    appearance: none;
    -webkit-appearance: none;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    outline: none;
}

.ihc-field--checkbox input[type="checkbox"]:focus {
    border-color: #2d2d2d;
    box-shadow: 0 0 0 3px rgba(45, 45, 45, 0.12);
}

.ihc-field--checkbox input[type="checkbox"]:checked {
    background: #2d2d2d;
    border-color: #2d2d2d;
}

.ihc-field--checkbox input[type="checkbox"]:checked::after {
    content: '';
    display: block;
    position: absolute;
    top: 2px;
    left: 5px;
    width: 6px;
    height: 10px;
    border: 2px solid #ffffff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.ihc-field--checkbox > label {
    display: inline;
    font-weight: 400;
    margin-bottom: 0;
    cursor: pointer;
    font-size: 15px;
    color: #2d2d2d;
}

/* ═══════════════════════════════════════════════════════════════
   FIELDSET
   ═══════════════════════════════════════════════════════════════ */

.ihc-fieldset {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 16px 20px;
    margin: 0 0 20px;
}

.ihc-fieldset-legend {
    padding: 0 6px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #555555;
}

/* ═══════════════════════════════════════════════════════════════
   GRID SOCIAL (step 8)
   ═══════════════════════════════════════════════════════════════ */

.ihc-social-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

.ihc-social-grid .ihc-field {
    margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   BOTTONI
   ═══════════════════════════════════════════════════════════════ */

.ihc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 32px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
    text-decoration: none;
    border: 2px solid transparent;
    outline: none;
}

.ihc-btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(45, 45, 45, 0.2);
}

/* Bottone primario */
.ihc-btn--primary {
    background: #2d2d2d;
    color: #ffffff;
    border-color: #2d2d2d;
}

.ihc-btn--primary:hover:not(:disabled) {
    background: #484848;
    border-color: #484848;
}

.ihc-btn--primary:active:not(:disabled) {
    background: #1a1a1a;
    border-color: #1a1a1a;
}

/* Bottone secondario */
.ihc-btn--secondary {
    background: transparent;
    color: #2d2d2d;
    border-color: #2d2d2d;
}

.ihc-btn--secondary:hover:not(:disabled) {
    background: #f5f5f5;
}

.ihc-btn--secondary:active:not(:disabled) {
    background: #ebebeb;
}

/* Stato disabilitato */
.ihc-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Bottone submit con spinner */
.ihc-btn--submit {
    min-width: 260px;
}

/* ─── Spinner loading CSS-only ─── */

.ihc-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: ihc-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.ihc-btn--loading .ihc-spinner {
    display: block;
}

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

/* ═══════════════════════════════════════════════════════════════
   NAVIGAZIONE STEP
   ═══════════════════════════════════════════════════════════════ */

.ihc-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 32px;
    gap: 16px;
}

.ihc-nav--last {
    border-top: 1px solid #e0e0e0;
    padding-top: 28px;
    margin-top: 28px;
}

/* ═══════════════════════════════════════════════════════════════
   MESSAGGI GLOBALI
   ═══════════════════════════════════════════════════════════════ */

.ihc-message-area {
    display: none;
    padding: 14px 18px;
    border-radius: 4px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
}

.ihc-message-area--error {
    background: #fff5f5;
    border: 1px solid #dc3545;
    color: #b02030;
}

.ihc-message-area--success {
    background: #f0fff4;
    border: 1px solid #28a745;
    color: #1a7a32;
}

/* ═══════════════════════════════════════════════════════════════
   MESSAGGIO DI SUCCESSO FINALE
   ═══════════════════════════════════════════════════════════════ */

.ihc-success-message {
    padding: 40px 32px;
    background: #f0fff4;
    border: 1px solid #28a745;
    border-radius: 8px;
    text-align: center;
    outline: none;
}

.ihc-success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: #28a745;
    color: #ffffff;
    border-radius: 50%;
    font-size: 28px;
    font-weight: 700;
    margin: 0 auto 20px;
    line-height: 1;
}

.ihc-success-title {
    font-size: 1.4em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #2d2d2d;
    margin: 0 0 12px;
}

.ihc-success-message p {
    color: #2d2d2d;
    margin: 0 0 10px;
    font-size: 15px;
}

.ihc-success-note {
    font-size: 13px;
    color: #666666;
    margin-top: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — tablet e mobile
   ═══════════════════════════════════════════════════════════════ */

@media ( max-width: 768px ) {

    .ihc-form-wrapper {
        padding: 24px 16px 40px;
    }

    /* Indicatori step: ridotti su mobile */
    .ihc-step-indicator {
        width: 26px;
        height: 26px;
        min-width: 26px;
        font-size: 11px;
    }

    .ihc-step-title {
        font-size: 1.15em;
    }

    /* Grid social: colonna singola */
    .ihc-social-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* Bottoni: larghezza piena su mobile */
    .ihc-nav {
        flex-direction: column-reverse;
        gap: 12px;
    }

    .ihc-btn {
        width: 100%;
        justify-content: center;
    }

    .ihc-btn--submit {
        min-width: unset;
    }

    .ihc-success-message {
        padding: 28px 20px;
    }
}

@media ( max-width: 480px ) {

    /* Nascondi label step indicatori su schermi molto piccoli */
    .ihc-progress-steps {
        gap: 2px;
    }

    .ihc-step-indicator {
        width: 22px;
        height: 22px;
        min-width: 22px;
        font-size: 10px;
    }

    .ihc-fieldset {
        padding: 12px 14px;
    }

    .ihc-progress-label {
        font-size: 12px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   PRINT — nascondi il form in stampa
   ═══════════════════════════════════════════════════════════════ */

@media print {
    .ihc-form-wrapper {
        display: none;
    }
}
