/* --- Stili CSS per Calcolatore D.Lgs. 231/2001 (Allineato al Design System CalcuLegal) --- */

#calc-231-wrapper {
	margin: 0;
	font-family: 'Lato', sans-serif;	
	font-weight: 500;
	padding: 10px;
	background: transparent;
	color: var(--navy);
}

#calc-231-wrapper label,
#calc-231-wrapper input,
#calc-231-wrapper button,
#calc-231-wrapper select,
#calc-231-wrapper textarea {
	display: block;
	width: 100%;
	border: none;
	outline: none;
	box-sizing: border-box;
	font-family: 'Lato', sans-serif;
}

#calc-231-wrapper label {
	margin-bottom: 6px;
	text-align: left;
	color: var(--navy);
	font-size: 14px;
	font-weight: 600;
	margin-top: 15px;
}

#calc-231-wrapper *:not(legend) > label:first-of-type {
	 margin-top: 0;
}

#calc-231-wrapper input::placeholder {
	color: var(--muted);
	font-weight: 400;
	opacity: 0.7;
}

#calc-231-wrapper input[type="text"],
#calc-231-wrapper input[type="number"],
#calc-231-wrapper input[type="email"],
#calc-231-wrapper input[type="tel"],
#calc-231-wrapper select {
	background: var(--card);
	padding: 12px 18px;
	height: 50px;
	font-size: 16px;
	font-weight: 500;
	border-radius: 8px;
	margin-bottom: 10px;
	color: var(--navy);
	border: 1px solid var(--border);
	transition: all 0.2s ease-in-out;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#calc-231-wrapper input:focus,
#calc-231-wrapper select:focus {
	 border-color: var(--red);
	 box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
}

#calc-231-wrapper select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%231d3557%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 15px top 50%;
    background-size: 12px auto;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

#calc-231-wrapper button[type="submit"], 
#calc-231-wrapper .btn-submit {
	color: #ffffff;
	margin-top: 20px;
	background: var(--red);
	height: 55px;	
	border-radius: 10px;
	cursor: pointer;
	font-weight: 700;
	font-size: 1.15em;
	box-shadow: 0 4px 12px rgba(230, 57, 70, 0.2);
	transition: all 0.2s ease-in-out;
	letter-spacing: 0.5px;	
	border: none;
	text-shadow: none;
    min-width: 300px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

#calc-231-wrapper button[type="submit"]:hover:not(:disabled),
#calc-231-wrapper .btn-submit:hover:not(:disabled) {	
	background: #d62828; 
	box-shadow: 0 8px 20px rgba(230, 57, 70, 0.35);
	transform: translateY(-3px);
}

#calc-231-wrapper button[type="submit"]:disabled,
#calc-231-wrapper .btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#calc-231-wrapper legend {
	font-family: 'Playfair Display', serif;
	font-weight: 900;
	font-size: 1.3rem;
	color: #fff;
	background-color: var(--navy);
	padding: 10px 22px;
	border-radius: 8px;
	box-shadow: 0 4px 10px rgba(29, 53, 87, 0.2);
	display: inline-block;
	width: auto;
	margin-left: 0;
	position: relative;
	top: 0px;
}

/* --- Layout Grid --- */
#calc-231-wrapper fieldset {
	border: 1px solid var(--border);
	padding: 25px;
	margin-bottom: 30px;
	border-radius: 12px;
	background: var(--card);
	box-shadow: var(--sh-md);
	position: relative;
}

#calc-231-wrapper .row { display: flex; flex-wrap: wrap; margin-left: -10px; margin-right: -10px; }
#calc-231-wrapper .col-half, #calc-231-wrapper .col-third, #calc-231-wrapper .col-quarter, #calc-231-wrapper .col-full { padding: 0 10px; box-sizing: border-box; margin-bottom: 10px; }
#calc-231-wrapper .col-full { flex: 1 1 100%; max-width: 100%; }
#calc-231-wrapper .col-half { flex: 1 1 50%; max-width: 50%; }
#calc-231-wrapper .col-third { flex: 1 1 33.333%; max-width: 33.333%; }
#calc-231-wrapper .col-quarter { flex: 1 1 25%; max-width: 25%; }

/* --- Elementi Specifici 231 (Fase Form) --- */
#calc-231-wrapper .nota-teaser {
	padding: 15px 20px; 
    border-radius: 8px; 
    border-left: 5px solid var(--navy-light);
	background: var(--bg-soft); 
    margin-top: 15px; 
    font-size: 0.95em; 
    line-height: 1.5; 
    color: var(--muted);
}
#calc-231-wrapper .nota-teaser strong { color: var(--navy); }
#calc-231-wrapper .nota-teaser h4 { margin: 0 0 8px 0; color: var(--navy); font-size: 1.1em; }


/* =========================================================================
   INIZIO STILI OUTPUT "A SCHEDE" (Design System Pulito e Color-Coded) 
   ========================================================================= */

/* 1. Togliamo il box contenitore e rendiamo visibile solo il titolo centrato */
#calc-231-wrapper .result-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}
#calc-231-wrapper .result-card h3 {
    color: var(--navy) !important;
    margin-bottom: 25px !important;
    margin-top: 25px !important;
    font-size: 1.8rem;
}

/* 2. Schede base a colore pieno, niente bordi laterali per disclaimer e box risultati interni */
#calc-231-wrapper .disclaimer-strong,
#calc-231-wrapper .result-card > div {
    border: none !important;
    padding: 25px !important;
    margin-top: 30px !important;
    border-radius: 12px !important;
    box-shadow: var(--sh-md) !important;
    background-color: var(--navy) !important; /* Colore base (Navy) per Forbice e SWOT */
}

/* 2.b COLORI SPECIFICI: I box Alert diventano Rossi/Verdi */
#calc-231-wrapper .disclaimer-strong {
    background-color: #d32f2f !important; /* Rosso per il Disclaimer Legale */
}

/* Box Interdittive dinamico (Intercetta gli stili JS per cambiare in colore pieno) */
#calc-231-wrapper #box-interdittive[style*="fff1f2"],
#calc-231-wrapper #box-interdittive[style*="255, 241, 242"] {
    background-color: #d32f2f !important; /* Rosso per Rischio Interdittive */
}
#calc-231-wrapper #box-interdittive[style*="ecfdf5"],
#calc-231-wrapper #box-interdittive[style*="236, 253, 245"] {
    background-color: #10b981 !important; /* Verde per Esimente */
}
#calc-231-wrapper #box-interdittive[style*="f8fafc"],
#calc-231-wrapper #box-interdittive[style*="248, 250, 252"] {
    background-color: var(--navy-light) !important; /* Blu-Grigio per "Nessun Rischio/N/D" */
}

/* 3. Forza testi e icone al BIANCO per superare i vecchi stili JS inline */
#calc-231-wrapper .disclaimer-strong,
#calc-231-wrapper .disclaimer-strong *,
#calc-231-wrapper .result-card > div,
#calc-231-wrapper .result-card > div * {
    color: #ffffff !important;
}

/* 4. Formattazione dell'importo Sanzione */
#calc-231-wrapper .valore-sanzione {
    font-size: 2.5em;
    font-weight: 900;
    text-align: center;
    margin: 15px 0;
    letter-spacing: -0.5px;
    color: #ffffff !important;
}

/* 5. Sotto-box "Confisca Obbligatoria" (Alert all'interno del box Forbice) */
#calc-231-wrapper .result-card > div div[style*="background"] {
    background-color: #d32f2f !important; /* Sfondo Rosso Alert */
    border: 1px solid #b71c1c !important; /* Bordo Rosso più scuro */
    border-radius: 8px !important;
    color: #ffffff !important;
    padding: 15px !important;
}
#calc-231-wrapper .result-card > div div[style*="background"] * {
    color: #ffffff !important;
}

/* =========================================================================
   FINE STILI OUTPUT A SCHEDE
   ========================================================================= */


/* --- Tooltips --- */
.label-with-tooltip {
	display: flex;
	align-items: center;
	gap: 8px;
}
.tooltip-icon {
	display: inline-block;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background-color: var(--bg-soft);
	color: var(--muted);
	border: 1px solid var(--border);
	font-weight: 700;
	font-size: 12px;
	text-align: center;
	line-height: 16px;
	cursor: help;
	position: relative;
	flex-shrink: 0;
	margin-bottom: 5px;
}
.tooltip-icon::before {
	content: attr(data-tooltip);
	position: absolute;
	bottom: 140%;
	left: 50%;
	transform: translateX(-50%);
	background-color: var(--navy);
	color: #fff;
	padding: 10px 15px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	width: 280px;
	text-align: left;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
	z-index: 10;
	box-shadow: var(--sh-lg);
}
.tooltip-icon:hover::before,
.tooltip-icon:focus::before {
	opacity: 1;
	visibility: visible;
}

/* --- LEAD GENERATION BOX --- */
#calc-231-wrapper .rc-styled-box-lite-leadgen {
	background-color: var(--bg-soft);
	border: 2px solid var(--red);
    padding: 25px 30px;
	margin-top: 40px;
	margin-bottom: 40px;
	border-radius: 15px;
	text-align: left;
	box-shadow: var(--sh-lg);
}
#calc-231-wrapper .rc-styled-box-lite-leadgen h3 { color: var(--navy); margin-top: 0; }
#calc-231-wrapper .rc-styled-box-lite-leadgen p { color: var(--muted); }
#calc-231-wrapper #lead-gen-container label { color: var(--navy); font-weight: 600; }
#calc-231-wrapper #lead-gen-container #lead_consent a { color: var(--red); font-weight: 600; }
#calc-231-wrapper #lead-gen-feedback { margin-top: 15px; font-weight: 600; min-height: 20px; text-align: center; }
#calc-231-wrapper input[type="checkbox"],
#calc-231-wrapper input[type="radio"] { height: 1.2em; width: 1.2em; margin-right: 10px; accent-color: var(--red); flex-shrink: 0; }
#calc-231-wrapper label.inline-label { display: flex; align-items: center; font-weight: 500; cursor: pointer; font-size: 1em; color: var(--navy); width: 100%; margin-top: 0; }

/* --- Stili per il Bottone Fluttuante (CTA) --- */
#calc-231-wrapper #calc231-floating-cta-button {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%); 
    z-index: 1000;
    width: auto;
    max-width: 90%;
    height: 55px;
    background-color: var(--red);
    color: #ffffff;
    font-family: 'Lato', sans-serif;
    font-size: 16px;
    font-weight: 700;
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.35);
    cursor: pointer;
    display: inline-flex; 
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease; 
}

#calc-231-wrapper #calc231-floating-cta-button.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px); 
}

#calc-231-wrapper #calc231-floating-cta-button:hover {
    transform: translateX(-50%) translateY(-3px); 
    box-shadow: 0 8px 20px rgba(230, 57, 70, 0.45);
    background-color: #d62828;
}

/* --- TOC STICKY (Indice laterale) --- */
.sticky-toc {
    position: sticky;
    top: 90px;
    margin-top: 30px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--sh-md);
    padding: 15px;
}
.toc-list { list-style: none; padding-left: 0; margin: 0; }
.toc-list li { margin-bottom: 8px; border-bottom: 1px dashed var(--border); padding-bottom:8px; }
.toc-list li:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.toc-list a { display: block; text-decoration: none; color: var(--navy); transition: all 0.2s ease; }
.toc-list a:hover, .toc-list a.active { transform: translateX(4px); }
.toc-list a.active .toc-step-title { color: var(--red); }
.toc-badge { display: inline-block; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 6px; border-radius: 4px; margin-bottom: 2px; background: var(--bg-soft); color: var(--muted); }
.toc-badge.req { background: rgba(230, 57, 70, 0.1); color: var(--red); }
.toc-badge.core { background: rgba(29, 53, 87, 0.1); color: var(--navy); }
.toc-badge.eco { background: rgba(16, 185, 129, 0.1); color: #065f46; }
.toc-step-title { font-weight: 700; font-size: 0.88rem; margin-bottom: 1px; }

/* --- MODALE PRIVACY --- */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(13, 31, 51, 0.85); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 9999; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; padding: 1rem; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content { background: var(--card); width: 100%; max-width: 600px; border-radius: 16px; padding: 2rem; position: relative; transform: translateY(20px); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: var(--sh-lg); max-height: 90vh; overflow-y: auto; }
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-close { position: absolute; top: 1.25rem; right: 1.25rem; background: var(--bg-soft); border: none; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; transition: all 0.2s; }
.modal-close:hover { background: var(--border); color: var(--navy); transform: rotate(90deg); }

/* Policy Styles base */
.policy-header { border-bottom: 3px solid var(--navy); padding-bottom: 1.5rem; margin-bottom: 2rem; }
.policy-studio-name { font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 900; color: var(--navy); line-height: 1.2; }
.policy-meta { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.titolare-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px; padding: 1.25rem; margin: .9rem 0; }
.titolare-row { display: flex; align-items: flex-start; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.titolare-row:last-child { border-bottom: none; padding-bottom: 0; }
.titolare-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: .1rem; }
.titolare-value { color: var(--navy); font-size: .88rem; font-weight:700;}


/* --- Modificatori Fase 4 --- */
#calc-231-wrapper .cw-231-modifiers {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

#calc-231-wrapper .cw-mod-label {
    display: flex;
    flex-direction: row !important; /* Forza l'affiancamento orizzontale */
    align-items: flex-start !important; /* Allinea in alto, perfetto se il testo va a capo */
    gap: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    padding: 14px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--sh-sm);
    margin-bottom: 0;
    margin-top: 0 !important;
}

#calc-231-wrapper .cw-mod-label:hover {
    border-color: var(--navy-light);
    transform: translateY(-1px);
}

#calc-231-wrapper .cw-mod-label input[type="checkbox"] {
    display: inline-block !important; /* Disinnesca il "display: block" globale */
    width: 20px !important; /* Disinnesca il "width: 100%" globale */
    height: 20px !important;
    accent-color: var(--red);
    cursor: pointer;
    flex-shrink: 0;
    margin: 0 !important;
    margin-top: 2px !important; /* Lo abbassa di 2px per allinearlo al centro della primissima riga di testo */
}

#calc-231-wrapper .cw-mod-text {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.4;
    margin: 0 !important;
}


/* --- Fix Allineamento Liste (es. Misure Interdittive) --- */
#calc-231-wrapper .result-card > div ul {
    padding-left: 15px !important; /* Rientra i punti elenco per allinearli al testo */
    margin-top: 15px !important;
    margin-bottom: 15px !important;
}

#calc-231-wrapper .result-card > div ul li {
    margin-bottom: 8px !important; /* Dà respiro verticale tra le singole voci */
    line-height: 1.5 !important;
    list-style-type: disc !important; /* Assicura che i pallini siano visibili */
}


/* --- RESPONSIVE --- */
@media (max-width: 768px) {
	#calc-231-wrapper .row { margin-left: 0; margin-right: 0; }
	#calc-231-wrapper .col-half, #calc-231-wrapper .col-third, #calc-231-wrapper .col-quarter, #calc-231-wrapper .col-full { padding-left: 0; padding-right: 0; flex-basis: 100%; max-width: 100%; }
    .tooltip-icon::before { transform: none; left: auto; right: 0; bottom: 125%; max-width: 400px; }
    .label-with-tooltip label { width: auto; flex-grow: 1; margin-bottom: 0; }
    
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-content { border-radius: 28px 28px 0 0; padding: 2.5rem 1.5rem 3.5rem; transform: translateY(100%); max-height: 90vh; width: 100%; }
    
    #calc-231-wrapper fieldset, #calc-231-wrapper #lead-gen-container,
    #calc-231-wrapper .result-card > div,
    #calc-231-wrapper .disclaimer-strong {
        margin-left: -10px !important; margin-right: -10px !important; padding: 25px 20px !important;
    }

    @media (max-width: 576px) {
        #calc-231-wrapper #calc231-floating-cta-button {
            font-size: 15px;
            padding: 12px 20px;
        }
    }
}