/* ==========================================================================
   WC Recesso – Frontend form styles
   Prefisso .wc-recesso per evitare conflitti con temi e Elementor.
   Nessuna dipendenza da Bootstrap, Foundation o altri framework.
   ========================================================================== */

/* ── Container ───────────────────────────────────────────────────────────── */

.wc-recesso {
    max-width: 600px;
    font-family: inherit;
    font-size: 1rem;
    color: inherit;
    line-height: 1.6;
}

.wc-recesso__step { display: block; }
.wc-recesso__step[hidden] { display: none; }

/* ── Intro ───────────────────────────────────────────────────────────────── */

.wc-recesso__intro {
    margin: 0 0 1.5rem;
    color: #555;
    font-size: .95rem;
}

/* ── Form ────────────────────────────────────────────────────────────────── */

.wc-recesso__form { margin: 0; }

.wc-recesso__field {
    margin-bottom: 1.25rem;
}

.wc-recesso__label {
    display: block;
    margin-bottom: .35rem;
    font-weight: 600;
    font-size: .9rem;
}

.wc-recesso__required {
    color: #c0392b;
    margin-left: .2em;
}

.wc-recesso__input {
    display: block;
    width: 100%;
    padding: .6rem .85rem;
    border: 1.5px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    color: inherit;
    transition: border-color .15s ease;
    box-sizing: border-box;
}

.wc-recesso__input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, .2);
}

.wc-recesso__input[aria-invalid="true"] {
    border-color: #c0392b;
}

/* ── Errori campo ────────────────────────────────────────────────────────── */

.wc-recesso__field-error {
    display: block;
    margin-top: .35rem;
    font-size: .85rem;
    color: #c0392b;
    min-height: 1.2em;
}

.wc-recesso__field-error:empty { display: none; }

/* ── Notice ──────────────────────────────────────────────────────────────── */

.wc-recesso__notice {
    padding: .75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: .9rem;
    border: 1px solid transparent;
}

.wc-recesso__notice[hidden] { display: none; }

.wc-recesso__notice--error {
    background: #fdf3f2;
    border-color: #e8b4b0;
    color: #8b1a10;
}

.wc-recesso__notice--success {
    background: #edfaf1;
    border-color: #a9dfba;
    color: #1a6b35;
}

/* ── Bottoni ─────────────────────────────────────────────────────────────── */

.wc-recesso__actions {
    margin-top: 1.25rem;
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: center;
}

.wc-recesso__btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.4rem;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background .15s, border-color .15s, opacity .15s;
    text-decoration: none;
}

.wc-recesso__btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.wc-recesso__btn--primary {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.wc-recesso__btn--primary:hover:not(:disabled) {
    background: #005177;
    border-color: #005177;
}

.wc-recesso__btn--secondary {
    background: transparent;
    color: #0073aa;
    border-color: #0073aa;
}

.wc-recesso__btn--secondary:hover:not(:disabled) {
    background: #f0f8ff;
}

/* ── Riepilogo ordine (Step B) ───────────────────────────────────────────── */

.wc-recesso__order-summary {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.wc-recesso__summary-title {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1d2327;
}

.wc-recesso__summary-dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .4rem 1.5rem;
    margin: 0;
}

.wc-recesso__summary-dl dt {
    font-weight: 600;
    color: #6c757d;
    font-size: .875rem;
    white-space: nowrap;
}

.wc-recesso__summary-dl dd {
    margin: 0;
    font-size: .875rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

/* ── Badge ───────────────────────────────────────────────────────────────── */

.wc-recesso__badge {
    display: inline-block;
    padding: .15rem .6rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.6;
}

.wc-recesso__badge--ok {
    background: #d1fae5;
    color: #065f46;
}

.wc-recesso__badge--warn {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Tabella articoli ────────────────────────────────────────────────────── */

.wc-recesso__items-wrap {
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.wc-recesso__items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.wc-recesso__items-table th,
.wc-recesso__items-table td {
    padding: .6rem .75rem;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

.wc-recesso__items-table thead th {
    background: #f8f9fa;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.wc-recesso__items-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.wc-recesso__cell--center { text-align: center; }
.wc-recesso__cell--right  { text-align: right; white-space: nowrap; }

/* ── Textarea ────────────────────────────────────────────────────────────── */

.wc-recesso__textarea {
    resize: vertical;
    min-height: 80px;
}

/* ── Checkbox campo (privacy) ────────────────────────────────────────────── */

.wc-recesso__field--checkbox { margin-top: 1.5rem; }

.wc-recesso__check-label {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    cursor: pointer;
    font-size: .9rem;
    line-height: 1.5;
}

.wc-recesso__checkbox {
    flex-shrink: 0;
    margin-top: .2rem;
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
    accent-color: #0073aa;
}

.wc-recesso__check-text { flex: 1; }
.wc-recesso__check-text a { color: #0073aa; }

/* ── Articoli esclusi / non rimborsabili ─────────────────────────────────── */

.wc-recesso__item-row--excluded {
    opacity: .6;
    background: #fafafa;
}

.wc-recesso__exclusion {
    display: block;
    font-size: .78rem;
    color: #8b1a10;
    margin-top: .15rem;
}

/* ── Quantity input nella tabella ────────────────────────────────────────── */

.wc-recesso__qty-input {
    width: 70px;
    padding: .3rem .5rem;
    border: 1.5px solid #ccc;
    border-radius: 4px;
    font-size: .9rem;
    font-family: inherit;
    text-align: center;
    box-sizing: border-box;
}

.wc-recesso__qty-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, .15);
}

.wc-recesso__qty-input:disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* ── Errore sopra il form (articoli non selezionati) ─────────────────────── */

.wc-recesso__field-error--items {
    display: block;
    margin-bottom: 1rem;
    font-size: .9rem;
}

/* ── Pannello di successo ────────────────────────────────────────────────── */

.wc-recesso__success-panel {
    margin: 1.5rem 0;
    font-size: 1rem;
}

.wc-recesso__success-panel p { margin: .5rem 0 0; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .wc-recesso__summary-dl {
        grid-template-columns: 1fr;
        gap: .15rem;
    }

    .wc-recesso__summary-dl dt {
        margin-top: .5rem;
    }

    .wc-recesso__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .wc-recesso__btn {
        justify-content: center;
    }
}
