/* =======================================================
   NavTools - Previdenza Complementare Style
   ======================================================= */

.tool-container {
    padding-top: 24px;
    padding-bottom: 48px;
}

.back-link {
    display: inline-flex;
    margin-bottom: 20px;
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
    color: var(--primary-dark);
    text-decoration: underline;
}

.tool-header {
    max-width: 760px;
    margin: 0 auto 28px;
    text-align: center;
}

.tool-header .logo {
    width: 96px;
    max-width: 30vw;
    margin: 0 auto 14px;
}

h1 {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: clamp(2rem, 4vw, 2.7rem);
    letter-spacing: 0;
}

.description {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.calculator-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 20px;
    align-items: start;
}

.input-column,
.result-column {
    display: grid;
    gap: 20px;
}

.panel,
.result-card {
    padding: 24px;
}

.panel h2 {
    margin: 0 0 18px;
    color: var(--primary);
    font-size: 1.2rem;
}

label,
legend {
    display: block;
    margin: 16px 0 6px;
    color: #263846;
    font-weight: 700;
}

fieldset {
    margin: 16px 0 0;
    padding: 0;
    border: 0;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cddbd6;
    border-radius: 6px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
}

input:focus,
select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.15);
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 22px;
    margin-top: 8px;
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.radio-group input {
    width: auto;
    min-height: auto;
    cursor: pointer;
}

/* Primary Output Card Details */
.result-card {
    text-align: center;
    border-top: 5px solid var(--accent);
}

#resultTitle {
    margin: 0 0 10px;
    color: var(--muted);
    font-weight: 700;
}

#resultValue {
    min-height: 58px;
    color: var(--primary);
    font-size: clamp(2.1rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.15;
}

.result-details {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #edf2f0;
    text-align: left;
}

.result-detail-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: var(--text);
}

.result-detail-line:last-child {
    margin-bottom: 0;
}

.detail-label {
    color: var(--muted);
}

.detail-val {
    font-weight: 700;
}

.highlight-line {
    display: block;
    text-align: center;
    font-weight: 700;
    color: var(--accent);
    background: #eef7f2;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 12px 0;
}

/* Detail Table Styles */
.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table th {
    padding: 11px 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    border-bottom: 2px solid var(--border);
}

.detail-table th:first-child {
    text-align: left;
}

.detail-table th:not(:first-child) {
    text-align: right;
}

.detail-table td {
    padding: 11px 0;
    vertical-align: middle;
}

.detail-table td:first-child {
    color: var(--muted);
    font-weight: normal;
}

.detail-table td:not(:first-child) {
    text-align: right;
    font-weight: 700;
}

.detail-table td:last-child {
    color: var(--primary);
    font-weight: 800;
}

.detail-table tr:not(:last-child) {
    border-bottom: 1px solid #edf2f0;
}

/* Summary Block */
.summary-block {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px dashed var(--border);
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.summary-line span:first-child {
    color: var(--muted);
}

.summary-line span:last-child {
    font-weight: 700;
}

.summary-line.highlight {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 0;
    margin-top: 12px;
}

.summary-line.highlight span:first-child {
    color: var(--primary);
    font-weight: 700;
}

.summary-line.highlight span:last-child {
    color: var(--accent);
}

/* Warnings and Notes */
.field-note {
    margin: 6px 0 0;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.4;
}

/* Nota informativa inline sulla detrazione per lavoro dipendente
   (visibile solo con versamento in busta paga) */
.info-note-inline {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 16px;
    padding: 10px 14px;
    background: #eef7f2;
    border: 1px solid #c5e0d5;
    border-left: 4px solid var(--accent);
    border-radius: 6px;
    font-size: 0.86rem;
    color: var(--muted);
    line-height: 1.45;
}

.info-note-inline .info-icon {
    flex-shrink: 0;
    font-size: 1rem;
    color: var(--accent);
    line-height: 1.3;
}

/* Testo disclaimer (stile coerente con prestazioni-previdenza) */
.disclaimer-text {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--muted);
    margin: 0;
}

.warning-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #fff2e6;
    border: 1px solid #ffe0cc;
    color: #cc6600;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.warning-box {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    background-color: #fff9f0;
    border: 1px solid #ffeacc;
    color: #b25e00;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

.warning-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.info-note {
    margin: 24px 0 12px;
    padding: 14px 18px;
    background: #edf2f0;
    border-left: 4px solid var(--primary);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5;
}

.info-card {
    margin-top: 20px;
    color: var(--muted);
}

.info-card table {
    width: 100%;
    border-collapse: collapse;
}

.info-card td {
    padding: 11px 0;
    vertical-align: top;
}

.info-card td:first-child {
    color: var(--muted);
}

.info-card td:last-child {
    text-align: right;
    font-weight: 700;
}

.info-card tr:not(:last-child) {
    border-bottom: 1px solid #edf2f0;
}

.error {
    color: var(--danger);
}

[hidden] {
    display: none !important;
}

/* Responsiveness */
@media (max-width: 820px) {
    .calculator-layout {
        grid-template-columns: 1fr;
    }

    .tool-container {
        width: min(100% - 28px, 680px);
        padding-top: 18px;
    }
}

@media (max-width: 560px) {
    .panel,
    .result-card {
        padding: 18px;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    td:last-child {
        padding-left: 12px;
    }
}
