/* =========================================================
   STYLE SPECIFICO: PROGETTO FOTOVOLTAICO (FULL RESPONSIVE)
   ========================================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* --- HEADER BANNER STILE HOME PAGE (BLU COMPLETO) --- */
.pv-hero-header {
    background: linear-gradient(135deg, #0d47a1 0%, #1976d2 100%);
    color: #ffffff;
    padding: 35px 20px 40px 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 100%;
}

.pv-hero-content {
    max-width: 1350px;
    margin: 0 auto;
}

/* Pulsante Torna alla Home integrato nel Banner */
.pv-hero-header .back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.35);
    margin-bottom: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.pv-hero-header .back-home:hover {
    background: #ffffff;
    color: #0d47a1;
    border-color: #ffffff;
    transform: translateY(-2px);
}

.pv-hero-header h1 {
    font-size: 2.3rem;
    margin: 0 0 12px 0;
    color: #ffffff !important;
    font-weight: 700;
    line-height: 1.25;
}

.pv-hero-header .tagline {
    font-size: 1.1rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.92) !important;
    line-height: 1.5;
    max-width: 950px;
}

/* --- CONTENITORE E CARD --- */
.pv-container {
    width: 100%;
    max-width: 1350px;
    margin: 0 auto;
    padding: 0 20px 40px 20px;
}

.card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 25px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.card h2 {
    color: #1a1a1a;
    font-size: 1.45rem;
    border-bottom: 2px solid #1976d2;
    padding-bottom: 10px;
    margin-top: 0;
}

/* Tabella Specifiche */
.spec-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.spec-table th,
.spec-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    color: #333;
}

.spec-table th {
    color: #0d47a1;
    width: 25%;
}

/* Passaggi e Cablaggi */
.schema-step {
    background: #f8f9fa;
    border-left: 4px solid #1976d2;
    padding: 18px;
    margin-bottom: 15px;
    border-radius: 0 8px 8px 0;
    border: 1px solid #e9ecef;
    border-left-width: 4px;
}

.schema-step h3 {
    margin-top: 0;
    color: #212529;
    font-size: 1.1rem;
}

/* Badge Cavi */
.cable-badge {
    display: inline-block;
    background: #0d47a1;
    color: #ffffff;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    margin-top: 6px;
}

/* --- GRIGLIA COMPONENTI HARDWARE (IN ALTO) --- */
.visual-schema {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.schema-node {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px 12px;
    text-align: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.schema-node:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
    border-color: #1976d2;
}

.schema-node img {
    width: 85px;
    height: 85px;
    object-fit: contain;
    background: #ffffff;
    border-radius: 6px;
    padding: 4px;
    margin-bottom: 8px;
    border: 1px solid #eee;
}

.schema-node h4 {
    color: #212529;
    margin: 6px 0 3px 0;
    font-size: 0.98rem;
}

.schema-node p {
    color: #6c757d;
    margin: 0;
    font-size: 0.82rem;
}

/* --- SCHEMA LOGICO DI COLLEGAMENTO (IN BASSO) --- */
.pv-schema-wrapper {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.pv-schema-wrapper h3 {
    text-align: center;
    color: #1a1a1a;
    margin-bottom: 25px;
    font-size: 1.35rem;
}

.flow-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.flow-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    width: 100%;
    flex-wrap: wrap;
}

.flow-node {
    background: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 12px;
    width: 175px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
}

.flow-node:hover {
    border-color: #1976d2;
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(25, 118, 210, 0.15);
}

.flow-node img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    margin-bottom: 6px;
    background: #fff;
    border-radius: 6px;
    padding: 2px;
    border: 1px solid #eee;
}

.flow-node h5 {
    margin: 4px 0 2px 0;
    font-size: 0.9rem;
    color: #212529;
}

.flow-node span {
    font-size: 0.74rem;
    color: #6c757d;
    display: block;
}

/* Connettori Verticali */
.flow-connector-v {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 28px;
    justify-content: center;
}

.line-v {
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #dc3545, #212529);
    position: relative;
}

.line-v::after {
    content: '▼';
    position: absolute;
    bottom: -6px;
    left: -4px;
    font-size: 10px;
    color: #212529;
}

/* --- ADATTAMENTO MOBILE (SMARTPHONE & TABLET) --- */
@media (max-width: 768px) {
    .pv-hero-header {
        padding: 25px 15px 30px 15px;
    }

    .pv-hero-header h1 {
        font-size: 1.7rem !important;
    }

    .pv-hero-header .tagline {
        font-size: 0.98rem !important;
    }

    .pv-container {
        padding: 0 10px 30px 10px;
    }

    .card {
        padding: 16px;
    }

    .spec-table,
    .spec-table tbody,
    .spec-table tr,
    .spec-table th,
    .spec-table td {
        display: block;
        width: 100% !important;
    }

    .spec-table tr {
        margin-bottom: 12px;
        border-bottom: 2px solid #e9ecef;
    }

    .spec-table th {
        padding-bottom: 2px;
    }

    .visual-schema {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .flow-node {
        width: 47%;
        min-width: 135px;
    }
}

@media (max-width: 480px) {
    .visual-schema {
        grid-template-columns: 1fr;
    }

    .flow-node {
        width: 100%;
    }
}

/* Badge Prezzo nei Componenti Hardware */
.price-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #0d47a1;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-top: 6px;
    border: 1px solid #bbdefb;
}

/* --- STILI AGGIORNATI PER IL MODALE / DIALOG DELL'INVERTER --- */
dialog.inverter-modal {
    border: none;
    border-radius: 12px;
    padding: 0;
    width: 90vw;
    max-width: 1200px;
    height: 85vh;
    max-height: 900px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
    background: #ffffff;
    overflow: hidden;
    margin: auto;
}

dialog.inverter-modal::backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.modal-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.modal-body-iframe {
    flex-grow: 1;
    padding: 0;
    background: #fff;
}

/* L'iframe si prende tutto lo spazio disponibile senza bordi brutti */
.modal-body-iframe iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Corpo della modale predisposto per contenere l'iframe o il contenuto caricato */
.modal-body {
    padding: 0;
    /* A zero se carichi una pagina intera, o metti il padding se carichi solo del testo */
    overflow-y: auto;
    height: calc(85vh - 70px);
    /* Sottrae lo spazio dell'header */
}

.modal-header {
    background: #134074;
    color: #ffffff;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

/* Uniformato con .close-btn del blocco precedente */
.close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    font-weight: bold;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: #3a86ff;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(85vh - 140px);
    /* Calcolato per lasciare spazio a header e footer */
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    color: #222;
}

/* Sezione Footer della modale */
.modal-footer {
    padding: 12px 25px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    text-align: right;
}

.btn-primary {
    background-color: #134074;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background-color: #0d47a1;
}

.clickable-inverter {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.clickable-inverter:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 123, 255, 0.25) !important;
}

.inverter-spec-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    text-align: left;
}

.inverter-spec-table th,
.inverter-spec-table td {
    padding: 10px 12px;
    border: 1px solid #dcdcdc;
    font-size: 0.9rem;
}

.inverter-spec-table th {
    background-color: #134074;
    color: #ffffff;
}

.inverter-spec-table tr:nth-child(even) {
    background-color: #f1f5f9;
}

.inverter-highlight {
    background-color: #eef4ff;
    border-left: 4px solid #3a86ff;
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 0 6px 6px 0;
    font-size: 0.95rem;
}