/**
 * REI — CF Calculator modal styles
 * v1.43.0 — Caricato globalmente con il JS cf-calculator.js perché il calcolatore
 * può essere richiamato da qualsiasi pagina con un campo Codice Fiscale.
 */

/* === Bottoncino inline "Calcolalo" === */
.rei-cf-inline-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    padding: 5px 11px;
    background: #E4F6F0;
    border: 1px solid #20A47B;
    border-radius: 999px;
    color: #20A47B;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s ease;
    line-height: 1;
    vertical-align: middle;
}
.rei-cf-inline-trigger:hover {
    background: #20A47B;
    color: #fff;
    box-shadow: 0 4px 10px rgba(32,164,123,0.25);
}
.rei-cf-inline-trigger:active {
    transform: translateY(1px);
}
.rei-cf-inline-trigger svg {
    flex-shrink: 0;
}

/* === Overlay & modal === */
.rei-cf-modal__overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(21,113,85,0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: rei-cf-fade 0.2s ease;
}
.rei-cf-modal__overlay.is-open {
    display: flex;
}
@keyframes rei-cf-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.rei-cf-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 80px rgba(21,113,85,0.45);
    animation: rei-cf-slide 0.25s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@keyframes rei-cf-slide {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.rei-cf-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #eef0f3;
}
.rei-cf-modal__head h3 {
    margin: 0;
    font-size: 18px;
    color: #157155;
    font-weight: 700;
}
.rei-cf-modal__close {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.15s ease;
}
.rei-cf-modal__close:hover {
    background: #f3f4f6;
    color: #157155;
}

.rei-cf-modal__body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.rei-cf-modal__foot {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid #eef0f3;
    background: #fafbfc;
    border-radius: 0 0 16px 16px;
}

/* === Fields === */
.rei-cf-row {
    margin-bottom: 14px;
}
.rei-cf-row--2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 480px) {
    .rei-cf-row--2 { grid-template-columns: 1fr; }
}

.rei-cf-modal input[type="text"],
.rei-cf-modal select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    font-size: 14.5px;
    font-family: inherit;
    color: #157155;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.18s ease;
}
.rei-cf-modal input[type="text"]:focus,
.rei-cf-modal select:focus {
    outline: none;
    border-color: #20A47B;
    box-shadow: 0 0 0 3px rgba(32,164,123,0.12);
}
.rei-cf-modal select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M3 6l5 5 5-5' fill='none' stroke='%2316a300' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
}

.rei-cf-radios {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.rei-cf-radios__label {
    font-weight: 600;
    color: #157155;
    font-size: 14px;
    margin-right: 8px;
}
.rei-cf-radios label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14.5px;
    cursor: pointer;
    color: #157155;
}
.rei-cf-radios input[type="radio"] {
    accent-color: #20A47B;
    cursor: pointer;
}

.rei-cf-small {
    font-size: 12.5px;
    color: #6b7280;
    margin: 6px 0 0;
    line-height: 1.4;
}

/* === Errore === */
.rei-cf-err {
    background: #FEE2E2;
    border: 1px solid #FCA5A5;
    color: #991B1B;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    margin: 10px 0;
}

/* === Risultato === */
.rei-cf-result {
    background: #E4F6F0;
    border: 1.5px solid #20A47B;
    padding: 16px 18px;
    border-radius: 12px;
    margin: 14px 0 10px;
    text-align: center;
}
.rei-cf-result__label {
    display: block;
    font-size: 13px;
    color: #157155;
    margin-bottom: 6px;
}
.rei-cf-result__value {
    display: block;
    font-family: Menlo, Monaco, 'Courier New', monospace;
    font-size: 22px;
    font-weight: 700;
    color: #157155;
    letter-spacing: 1.5px;
    margin-bottom: 14px;
    background: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #D2F0E6;
}
.rei-cf-result .rei-btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s ease;
}

/* === Privacy note === */
.rei-cf-privacy {
    background: #f4f6f8;
    color: #4b5563;
    font-size: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-top: 14px;
    line-height: 1.45;
    text-align: center;
}

/* === Btn === */
.rei-cf-modal .rei-btn,
.rei-cf-modal__foot .rei-btn {
    display: inline-block;
    padding: 10px 22px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s ease;
}
.rei-cf-modal .rei-btn--primary {
    background: #20A47B;
    color: #fff;
}
.rei-cf-modal .rei-btn--primary:hover {
    background: #20A47B;
    box-shadow: 0 6px 14px rgba(32,164,123,0.3);
}
.rei-cf-modal .rei-btn--ghost {
    background: transparent;
    color: #6b7280;
    border: 1.5px solid #E5E7EB;
}
.rei-cf-modal .rei-btn--ghost:hover {
    background: #f3f4f6;
    color: #157155;
    border-color: #d1d5db;
}

/* ===== v1.45.0 — Validazione CF/P.IVA inline ===== */
.rei-cf-field--valid { border-color: #20A47B !important; box-shadow: 0 0 0 1px #20A47B inset; }
.rei-cf-field--invalid { border-color: #D63638 !important; box-shadow: 0 0 0 1px #D63638 inset; }
.rei-cf-validity {
    display: block;
    width: 100%;
    flex-basis: 100%;
    margin-top: 6px;
    font-size: 0.82rem;
    line-height: 1.3;
    min-height: 1em;
}
.rei-cf-validity.is-ok  { color: #20A47B; }
.rei-cf-validity.is-err { color: #D63638; }
.rei-cf-validity.is-ok::before  { content: "\2713\00a0"; font-weight: 700; }
.rei-cf-validity.is-err::before { content: "\2717\00a0"; font-weight: 700; }
