/* --- 1. Variabili Globali e Reset --- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

:root {
    --primary-color: #005A9C;
    --secondary-color: #00A3E0;
    --strategy-property-color: #1a936f;
    --strategy-etf-color: var(--secondary-color);
    
    --background-color: #f4f7f9;
    --text-color: #333;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);

    --status-success: #28a745;
    --status-danger: #dc3545;
    --status-danger-bg: #f8d7da;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 2rem 1rem;
}

/* --- 2. Layout Principale --- */
.simulator {
    max-width: 1100px;
    margin: 0 auto;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.simulator__header {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 2.5rem;
    text-align: center;
}
.simulator__header h1 { margin: 0; font-size: 2.2rem; }
.simulator__header p { margin: 0.5rem 0 0; opacity: 0.9; }

.simulator__main { padding: 2.5rem; }

h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.75rem;
    margin: 0 0 2rem 0;
}

/* --- 3. Form Unificato --- */
.simulator__form fieldset {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.simulator__form legend {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--primary-color);
    padding: 0 0.5rem;
    margin-left: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.form-grid--shared {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}


.form-group label {
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 0.9em;
    display: block;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(0, 163, 224, 0.2);
}

.simulator__button {
    display: block;
    width: 100%;
    max-width: 500px;
    margin: 1rem auto 0;
    padding: 1rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}
.simulator__button:hover:not(:disabled) { background-color: #007bb5; }
.simulator__button:disabled { background-color: #ccc; cursor: not-allowed; }

/* --- 4. Risultati --- */
.simulator__results-section { margin-top: 3rem; }

.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary__card {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 5px solid;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.summary__card--property { border-color: var(--strategy-property-color); }
.summary__card--etf { border-color: var(--strategy-etf-color); }

.summary__card h4 { margin: 0 0 0.5rem; font-size: 1.1em; }
.summary__card .value { font-size: 2.2em; font-weight: bold; margin-bottom: 0.5rem; }
.summary__card .details { font-size: 0.9em; color: #666; }
.summary__card--property .value { color: var(--strategy-property-color); }
.summary__card--etf .value { color: var(--strategy-etf-color); }

.comparison-banner {
    text-align: center;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.1em;
    border: 2px solid;
}
.comparison-banner--property {
    background-color: rgba(26, 147, 111, 0.1);
    border-color: var(--strategy-property-color);
    color: var(--strategy-property-color);
}
.comparison-banner--etf {
    background-color: rgba(0, 163, 224, 0.1);
    border-color: var(--strategy-etf-color);
    color: var(--strategy-etf-color);
}

.chart-container { margin: 3rem 0; position: relative; height: 450px; }
.table-container { overflow-x: auto; }

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9em;
}
.results-table th, .results-table td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    text-align: right;
}
.results-table th { background-color: var(--primary-color); color: white; text-align: center; }
.results-table tbody tr:nth-child(even) { background-color: #f8f9fa; }
.results-table tbody tr:hover { background-color: rgba(0, 163, 224, 0.05); }

.text--positive { color: var(--status-success); font-weight: bold; }
.text--negative { color: var(--status-danger); font-weight: bold; }

/* --- 5. Elementi UI Aggiuntivi --- */
.error-message {
    padding: 1rem;
    background-color: var(--status-danger-bg);
    color: var(--status-danger);
    border: 1px solid var(--status-danger);
    border-radius: 4px;
    margin-top: 1.5rem;
    text-align: center;
}

.simulator__footer-note {
    margin-top: 3rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9em;
    color: #666;
}
.simulator__footer-note ul { padding-left: 20px; }

@media (max-width: 768px) {
    .simulator__main { padding: 1.5rem; }
    .chart-container { height: 350px; }
}