/* =========================================================
   DATA SECTION
   ========================================================= */

.data-section {
    background: repeating-linear-gradient(
        0deg,
        #07175a,
        #07175a 2px,
        #0b267d 3px
    );

    background-size: 2px 2px;

    box-shadow:
        0px 0px 9px 2.25px rgba(0, 0, 0, 0.5),
        inset 0px 50px 60px 0px rgba(0, 0, 0, 0.5),
        inset 0px 0px 21px 0px rgba(255, 255, 255, 0.13);

    color: white;
    font-family: "Jersey 25", sans-serif;
    padding: 18px;
    margin:0;
}

.data-section h1 {
    color: #ffd21f;
    margin: 0 0 14px 0;
    padding: 0;
    font-size: 2rem;
    font-weight: normal;
    line-height: 1.1;
}

.data-section p {
    margin: 0 0 10px 0;

    font-size: 1.1rem;
    line-height: 1.35;
}

.data-section h3 {
    margin: 16px 0 8px 0;
    font-size: 1.45rem;
    font-weight: normal;
    line-height: 1.15;
}

.data-section a {
    color: #ffd21f;
}

.data-section a:hover {
    text-decoration: underline;
}

/* =========================================================
   WHITE SECTION
   ========================================================= */

.white-section {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 18px;
    background: #ffffff;
    box-shadow:
        0px 0px 9px 2.25px rgba(0, 0, 0, 0.30);
    color: #222222;
    font-family: "Exo 2", sans-serif;
}

.white-section h2 {
    margin: 0 0 16px 0;
    padding: 0;

    color: #07175a;
    font-family: "Jersey 25", sans-serif;
    font-size: 2rem;
    font-weight: normal;
    line-height: 1.1;
}

.white-section p {
    margin: 0 0 12px 0;
    padding: 0;

    color: #222222;
    font-family: "Exo 2", sans-serif;
    font-size: 1rem;
    line-height: 1.5;
}

.white-section h3 {
    margin: 20px 0 9px 0;
    padding: 0;

    color: #07175a;
    font-family: "Jersey 25", sans-serif;
    font-size: 1.45rem;
    font-weight: normal;
    line-height: 1.15;
}

.white-section h4 {
    margin: 16px 0 7px 0;
    padding: 0;

    color: #07175a;
    font-family: "Jersey 25", sans-serif;
    font-size: 1.2rem;
    font-weight: normal;
    line-height: 1.2;
}

.white-section a {
    color: #07175a;
    text-decoration: none;
}

.white-section a:hover {
    text-decoration: underline;
}

.white-section ul,
.white-section ol {
    /*margin: 0 0 14px 22px;*/
    padding: 0;
    font-family: "Exo 2", sans-serif;
    font-size: 1rem;
}

.white-section li {
    margin-bottom: 4px;
}

.white-section img {
    max-width: 100%;
    height: auto;
}

/* =========================================================
   ELEMENTI DI PAGINA
   ========================================================= */
   
.page-header {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    font-family: "Exo 2", sans-serif;
}

.page-header h3 {
    margin: 0; font-size: 18px; font-weight: 700; color: #1e293b;
    } 

.page-header p {
    margin: 5px 0 0 0; font-size: 12px; color: #64748b;
    }

/* =========================================================
   TABELLA A STRISCE BLU
   ========================================================= */
table.tabella-azzurra {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background: #0088ce;
    color: white;
    box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
    text-shadow: 1px 1px 1px #000;
    font-family: "Exo 2";
}

table.tabella-azzurra th, table.tabella-azzurra td {
    padding: 4px 6px;
    border-bottom: 1px solid #D3D3D3;
    text-align: left;
    vertical-align: middle;
}

table.tabella-azzurra th {
    background: #2b3990;
    opacity: 0.8;
    background-size: 2px 2px;
    background-image: repeating-linear-gradient(0deg, #05056c, #05056c 1px, #2b3990 1px, #2b3990);
    text-align:left;
    color: #fff;
    cursor:pointer;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
}

table.tabella-azzurra tr:nth-child(2n) {
    background-color: rgba(255,255,255,0.2);
}

table.tabella-azzurra td:first-child {
font-weight: bold;
}

table.tabella-azzurra td:nth-child(2) {
    color: #FFBF00;
}

table.tabella-azzurra td {
    font-size: 12px;
}


/* =========================================================
   OBS
   ========================================================= */
.records-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
}
.records-item {
    padding: 5px 6px;
    background: #fff;
    border: 1px solid #c5d4df;
    text-align: center;
}

/* schede select parametri */
.tabs {
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:0px 8px 8px;
}
.tab-group {
    display:flex;
    gap:5px;
}
.tab {
    display:inline-block;
    padding:4px;
    margin-right:5px;
    border-radius:5px;
    cursor:pointer;
}
.tab:hover {
    border-bottom:1px solid #fff;
}
.tab.active {
    color:#ffd21f;
    border-bottom:1px solid #ffd21f;
}

.hidden {
    display:none;
}
.update-btn {
    padding:10px;
    border:none;
    border-radius:6px;
    background:#0FFF50;
    color:black;
    cursor:pointer;
    font-size:0.875rem;
    font-family: "Jersey 25", sans-serif;
}
.update-btn:hover {
    opacity:0.85;
}

/* tabella dati download csv */
.stazione-name small {
    color: #64748b;
    display: block;
    font-weight: normal;
    margin-top: 2px;
}

.btn-table {
    display: inline-block;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
a.btn-tmax,
a.btn-tmax:visited { background-color: #fff1f2; color: #e11d48; border-color: #ffe4e6; }
a.btn-tmax:hover { background-color: #e11d48; color: #ffffff; }

a.btn-tmin,
a.btn-tmin:visited { background-color: #eff6ff; color: #2563eb; border-color: #dbeafe; }
a.btn-tmin:hover { background-color: #2563eb; color: #ffffff; }

a.btn-rain,
a.btn-rain:visited { background-color: #c6f4ff; color: #007a99; border-color: #00a1c9; }
a.btn-rain:hover { background-color: #007a99; color: #fff; }

a.btn-muto {
    background-color: #f1f5f9;
    color: #94a3b8;
    pointer-events: none;
    cursor: default;
}

/* ==================================
   SAT
   ================================== */
.viewer{
    position:relative;
    text-align:center;
    padding: 15px;
}

.comandi-sat {
    border-bottom:1px solid #ddd;
    margin-bottom:3px;
    font-size:small;
}

.viewer-toolbar{
    display:flex;
    justify-content: center; /* Centra in orizzontale */
    align-items: center;     /* Centra in verticale */
    gap:16px;
    margin:10px;
}

.viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    margin: 12px 0;
    padding: 10px 12px;
    background: linear-gradient(180deg, #102b49 0%, #071a30 100%);
    border: 1px solid #294968;
    border-radius: 6px;
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    box-sizing: border-box;
}

.viewer-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(150, 190, 225, 0.16);
    border-radius: 4px;
    box-sizing: border-box;
}

.viewer-control + .viewer-control {
    margin-left: 2px;
}

.viewer-control-label {
    color: #e4edf7;
    font-family: "Exo 2", sans-serif;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.viewer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 32px;
    padding: 0;
    color: #d8eaff;
    background: #173b60;
    border: 1px solid #37638b;
    border-radius: 4px;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
    box-sizing: border-box;
}
.viewer-btn:hover {
    color: #ffffff;
    background: #245783;
    border-color: #65a9df;
}
.viewer-btn:active {
    transform: translateY(1px);
    background: #0d2945;
}
.viewer-btn:focus-visible {
    outline: 2px solid #ffd21f;
    outline-offset: 2px;
}
.viewer-btn-action {
    color: #ffd21f;
    background: #203d59;
    border-color: #6b7890;
}
.viewer-btn-action:hover {
    color: #ffffff;
    background: #315c80;
    border-color: #ffd21f;
}
/* ----------------------------------------
   WEBCAMS
   ---------------------------------------- */

.webcam-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 20px 2px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.webcam-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.webcam-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.webcam-card:hover {
    transform: translateY(-4px);
    border-color: #2b3990; /* Il tuo blu principale */
    box-shadow: 0 10px 15px -3px rgba(43, 57, 144, 0.12);
}

.webcam-info {
    padding: 16px;
}

.webcam-info h3 {
    margin: 0 0 6px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #05056c; /* Il tuo blu scuro profondo */
}

.webcam-info p {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.webcam-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 66.66%; /* Blocca le proporzioni a 3:2 evitando sbalzi di layout */
    background-color: #f1f5f9;
    overflow: hidden;
}

.webcam-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-menu-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 35px;
    padding: 10px 0;
}

.gallery-filters {
    display: inline-flex;
    background-color: #f1f5f9; /* Sfondo grigio chiaro stile iOS/Pillola */
    padding: 6px;
    border-radius: 40px;
    gap: 4px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    color: #e4edf7;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(150, 190, 225, 0.16);
    border-radius: 4px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.filter-btn:hover:not(.active) {
    background: #173b60;
    border: 1px solid #37638b;
}

.filter-btn.active {
    color: #ffffff;
    background: #245783;
    border-color: #65a9df;
}

#webcam-dynamic-container {
    transition: opacity 0.25s ease-in-out; /* Sfumatura fluida al cambio galleria */
    min-height: 300px; /* Previene il collasso della pagina durante il caricamento */
}

.error-msg {
    text-align: center;
    padding: 40px;
    color: #ef4444;
    font-weight: 500;
    font-family: sans-serif;
}

.webcam-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    border-radius: 4px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    z-index: 2;
}

.webcam-badge.live {
    background-color: #ef4444; /* Rosso vivo */
}

.webcam-badge.offline {
    background-color: #64748b; /* Grigio ardesia */
}


/* ----------------------------------------
   VARIE
   ---------------------------------------- */
   
.copyright {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #1d4ed8;
  text-transform: uppercase;
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #bfdbfe;
  margin-top: 6px;
}

.badge-pioggia {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    border: 1px solid #bfdbfe;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

/* ---------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------- */

@media (max-width: 760px) {
    
    .data-section {
        padding: 14px;
    }
    
    .data-section-title {
        font-size: 1.7rem;
        margin-bottom: 12px;
    }

    .data-section p {
        font-size: 1rem;
        line-height: 1.35;
    }

    .data-section h3 {
        font-size: 1.3rem;
    }
    
    .white-section {
        padding: 16px;
    }

    .white-section h2 {
        font-size: 1.7rem;
        margin-bottom: 13px;
    }

    .white-section h3 {
        font-size: 1.3rem;
        margin-top: 17px;
    }

    .white-section h4 {
        font-size: 1.15rem;
    }

    .white-section p,
    .white-section ul,
    .white-section ol {
        font-size: 0.95rem;
        line-height: 1.45;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .records-grid {
        gap: 4px;
    }
    
    table.tabella-azzurra th {
        font-size: 12px;
    }
    .tabella-azzurra td, .tabella-azzurra th {
        padding: 1px;
    }
    .tab-group {
        gap:1px;
    }
    .tabs, .tab {
        padding:2px;
    }    
    .update-btn {
        padding:2px;
    }
    /* Table CSV 7 day CFD */
    /* Nascondiamo l'intestazione classica della tabella */
    .cfdTable thead { display: none; }
    .cfdTable tr { 
        display: block; 
        border-bottom: 3px solid #cbd5e1; 
        padding: 15px 5px;
    }
    .cfdTable td { 
        display: flex; 
        justify-content: space-between; 
        align-items: center;
        border-bottom: 1px solid #f1f5f9;
        padding: 8px 10px;
        text-align: right;
    }
    .cfdTable td::before {
        content: attr(data-label); /* Genera un'etichetta descrittiva a sinistra */
        font-weight: bold;
        color: #05056c;
        float: left;
    }
    .stazione-name { 
        background-color: #f1f5f9; 
        justify-content: center !important; 
        text-align: center;
    }
    
    .btn-table { 
        width: 50%;
        text-align: center;
    }
    
    .gallery-filters {
        width: 100%;
        flex-direction: column;
        border-radius: 16px;
        padding: 8px;
    }
    .filter-btn {
        width: 100%;
        text-align: center;
        padding: 12px;
    }
    .badge-pioggia {
        padding: 2px 5px;
        border-radius: 12px;
        font-size: 11px;
    }
    .viewer-toolbar {
        gap: 7px;
        padding: 8px;
    }
    .viewer-control {
        gap: 6px;
        padding: 4px 7px;
    }
    .viewer-control-label {
        font-size: 12px;
    }
    .viewer-btn {
        width: 32px;
        height: 30px;
        font-size: 16px;
    }
} 

@media (max-width: 520px) {
    
    .data-section {
        padding: 11px;
    }

    .data-section-title {
        font-size: 1.5rem;
    }

    .data-section p {
        font-size: 12px;
    }

    .data-section h3 {
        font-size: 15px;
    }
    
    .white-section {
        padding: 12px;
    }

    .white-section h2 {
        font-size: 1.5rem;
        margin-bottom: 11px;
    }

    .white-section h3 {
        font-size: 1.2rem;
    }

    .white-section h4 {
        font-size: 1.05rem;
    }

    .white-section p,
    .white-section ul,
    .white-section ol {
        font-size: 0.9rem;
    }
    
    table.tabella-azzurra th,
    table.tabella-azzurra td {
        font-size: 10px;
    }
    
    .viewer-toolbar {
        justify-content: space-between;
        gap: 6px;
    }
    .viewer-control {
        flex: 1 1 auto;
        gap: 5px;
        padding: 4px 5px;
    }
    .viewer-control-label {
        font-size: 11px;
    }

    .webcam-gallery {
        grid-template-columns: 1fr; /* Colonna singola */
        gap: 16px;
    }
}