/* ==== Homepage CARDS ==== */

/* ==== Section ALERT ==== */
.alert-card{
    width:100%;
    margin:auto;
    padding:5px;
    background: repeating-linear-gradient(0deg, #05056c,#05056c 25%,#2b3990 50%,#2b3990 100%);
    background-size: 100% 2px;
    border:3px solid #ffd21f;
    border-radius:6px;
    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;
    display: flex;
    flex-direction: column;
}
.alert-header{
    display: flex;
    justify-content: space-between;
    align-items:center;
    width:100%;
}
.alert-row{
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    align-items:center;
    gap:10px;
}
.alert-row > *:first-child {
    justify-self: start;
    text-align: left;
}
.alert-row > *:not(:first-child) {
    justify-self: center;
    text-align: center;
}
.alert-switch{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:12px;
    margin:12px 0 18px;
    font-size:.95rem;
    font-weight:600;
}
.alert-switch span{
    color:#D3D3D3;
    transition:.25s;
}
.alert-switch span.active{
    color:#0088ce;
    font-weight:700;
}
/* SWITCH */
.switch{
    position:relative;
    width:48px;
    height:24px;
}
.switch input{ display:none;}

.slider{
    position:absolute;
    inset:0;
    cursor:pointer;
    background:#cfd5db;
    border-radius:30px;
    transition:.25s;
}
.slider:before{
    content:"";
    position:absolute;
    width:18px;
    height:18px;
    left:3px;
    top:3px;
    background:white;
    border-radius:50%;
    transition:.25s;
    box-shadow:0 1px 4px rgba(0,0,0,.35);
}
.switch input:checked + .slider{
    background:#0088ce;
}
.switch input:checked + .slider:before{
    transform:translateX(24px);
}
.alert-icon{
    font-size:20px;
    transition:.3s;
}
.alert-icon.green{
    color:#2ecc71;
}
.alert-icon.yellow{
    color:#ffd400;
    text-shadow:
        0 0 6px rgba(255,212,0,.7);
}
.alert-icon.orange{
    color:#ff7b00;
    text-shadow:
        0 0 8px rgba(255,123,0,.8);
}
.alert-icon.red{
    color:#d90429;
    text-shadow:
        0 0 10px rgba(217,4,41,.9);
}
.alert-footer{
    margin-top:3px;
    text-align:center;
}
.alert-footer a{
    text-decoration:none;
    color:#ffd21f;
    font-weight:600;
}
@keyframes pulseAlert{
    0%{
        transform:scale(1);
    }
    50%{
        transform:scale(1.15);
    }
    100%{
        transform:scale(1);
    }
}
.alert-icon{
    animation:pulseAlert 2.4s infinite;
}
.alert-icon.red {
    animation:pulseAlert .8s infinite;
}
.alert-validity {
    padding:5px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
}
#alertStatus{
    margin-left:12px;
    font-size:13px;
    font-weight:600;
    color:#666;
}
.update-alert-btn {
    float:right;
    padding:6px;
    border:none;
    border-radius:6px;
    color:black;
    cursor:pointer;
    font-size:0.6rem;
}
.update-alert-btn.loading{
    pointer-events:none;
}
.update-alert-btn.loading i{
    animation:spin 1s linear infinite;
}
@keyframes spin{
    from{
        transform:rotate(0deg);
    }
    to{
        transform:rotate(360deg);
    }
}

.alert-map-btn{
    color:black;
}

/* ---------- MODAL MAPPA ---------- */

.alert-modal{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.65);
    display:flex;
    justify-content:center;
    align-items:center;
    opacity:0;
    visibility:hidden;
    transition:.25s;
    z-index:99999;
    backdrop-filter:blur(3px);
}

.alert-modal.show{
    opacity:1;
    visibility:visible;
}

.alert-modal-content{
    width:min(95vw,1100px);
    height:min(90vh,900px);
    background:#ffffff;
    border-radius:18px;
    overflow:hidden;
    position:relative;
    box-shadow:0 25px 70px rgba(0,0,0,.45);
    transform:scale(.92);
    transition:.25s;
}

.alert-modal.show .alert-modal-content{
    transform:scale(1);
}

#alertMapContainer{
    width:100%;
    height:100%;
    overflow:auto;
}

.loading-map{
    height:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:12px;
    font-size:18px;
}

.alert-modal-close{
    position:absolute;
    right:12px;
    top:12px;
    width:42px;
    height:42px;
    border:none;
    border-radius:50%;
    background:#ffffff;
    cursor:pointer;
    font-size:20px;
    z-index:100;
    box-shadow:0 3px 12px rgba(0,0,0,.25);
}

.alert-modal-close:hover{
    background:#f0f0f0;
}
/* ==== MAPPA ALLERTE ==== */
.alert-map {
    margin:0;
    background:
    repeating-linear-gradient(
        0deg,
        #07175a,
        #07175a 2px,
        #0b267d 3px
    );
    border:3px solid #ffd21f;
    border-radius:6px;
    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;
}
.alert-map .wrapper{
    width:100%;
    max-width:500px;
    margin:auto;
    padding:20px;
}
.alert-map .info{
    text-align:center;
    font-size:18px;
    font-weight:700;
    margin:12px 0;
    color:#ffd21f;
}

.alert-map svg{
    width:100%;
    height:auto;
}

.alert-map .zone{
    stroke:#444;
    stroke-width:1.2;
    cursor:pointer;
    transition:.2s;
}

.alert-map .zone:hover{
    stroke:#ffffff;
    stroke-width:3;
    filter:brightness(115%);
}

.alert-map .label{
    fill:#ffffff;
    font-size:18px;
    font-weight:bold;
    text-anchor:middle;
    dominant-baseline:middle;
    pointer-events:none;
    paint-order:stroke;
    stroke:#000;
    stroke-width:2;
}

.alert-map .legend{
    display:flex;
    gap:15px;
    margin:5px 0;
    justify-content:center;
    flex-wrap:wrap;
    background:rgba(255,255,255,0.2);
    border: 1px solid #ddd;
    border-radius:3px;
}

.alert-map .legend span{
    display:flex;
    align-items:center;
    gap:6px;
}

.alert-map .box{
    width:18px;
    height:18px;
    border-radius:3px;
    border:1px solid #666;
}
.alert-map .map-footer {
    text-align:center;
}

#tooltip{
    position:fixed;
    display:none;
    background:#222;
    color:#fff;
    padding:1px;
    border-radius:8px;
    font-size:13px;
    line-height:1.4;
    box-shadow:0 4px 18px rgba(0,0,0,.35);
    pointer-events:none;
    z-index:9999;
    white-space:pre-line;
}

.tooltip-title{
    font-weight:700;
    margin:0 auto;
    text-align:center;
    font-size:15px;
    color:#ffd21f;
}

.tooltip-table{
    border-collapse:collapse;
    padding:0;
}

.tooltip-table td{
    padding:4px 8px;
    font-size:13px;
}

.tooltip-table td:first-child{
    font-weight:600;
    white-space:nowrap;
}

.alert-green{ color:#a3ec06;}
.alert-yellow{ color:#ffea00;}
.alert-orange{ color:#ff9000;}
.alert-red{ color:#db1414;}


/* ==== Section RECORDS ==== */
.records-wrapper {
    height: 100%;
    display: flex;
    margin:0 10px ;
    background: #fff;
    box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
}
.records-table {
    width: 95%;
    height: 100%; /* Forza la tabella a riempire l'altezza del wrapper */
    border-collapse: separate;
    border-spacing: 0;
    color:#333;
    border-radius: 2px;
    overflow: hidden;
    text-align:justify;
    font-size: 16px;
    margin: 0 auto;
}
.records-table td {
    padding: 2px;
    vertical-align: middle;
    border-bottom: 1px dotted #333;
}
/* Rimuove il bordo dall'ultima riga per non sovrapporsi al raggio del bordo del contenitore */
.records-table tr:last-child td {
    border-bottom: none;
}

/* Organizzazione dei testi dentro la cella della località */
.record-label {
    display: block;
    font-weight:bold;
    text-transform: uppercase;
}
.value-hot { color: #c0392b; }
.value-cold { color: #2980b9; }

/* ==== Section CARDS ==== */
.cards-wrapper {
    display: flex;
    gap: 20px; /* Spazio tra la prima e la seconda card */
    height: 100%;
}
/* Forza le tue due card a dividersi equamente lo spazio verticale disponibile */
.cards-wrapper > div {
    flex: 1; 
}
.station-card {
    width:100%;
    max-width:330px;
    min-height:190px;
    margin:auto;
    padding:12px;
    background:
    repeating-linear-gradient(
        0deg,
        #07175a,
        #07175a 2px,
        #0b267d 3px
    );
    border:3px solid #273cff;
    border-radius:6px;
    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;
}
.header-card {
    display:flex;
    justify-content:space-between;
    font-size:16px;
    font-weight:bold;
    text-transform:uppercase;
    text-shadow: 2px 2px #000;
}
.station-name {
  text-shadow: 0px 1px 2.34px rgba(11, 43, 42, 0.004);
}

.station-alt{
    display:flex;
    align-items:center;
    background-image: -moz-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(241,242,249) 0%, rgb(255,255,255) 100%);
    background-image: -webkit-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(241,242,249) 0%, rgb(255,255,255) 100%);
    background-image: -ms-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(241,242,249) 0%, rgb(255,255,255) 100%);
    color:black;
    border: 1px solid #949494;
    box-shadow: inset 0px 3px 3.96px 0.04px rgba(107, 107, 107, 0.35);
    text-shadow:none;
    text-transform:none;
    padding:2px;
}
.main-card {
    margin-top:20px;
    display:flex;
    justify-content:space-between;
    align-items:center;
}
.temperature {
    display:flex;
    align-items:center;
}
.temperature .icon {
    font-size:34px;
}
.temperature .value {
    font-size:42px;
    font-weight:bold;
}
.humidity {
    font-size:22px;
    color:#fff;
}
.temp-range{
    display:flex;
    gap:20px;
    margin-top:5px;
    margin-bottom:12px;
    font-size:15px;
}
.temp-range .tmax{
    color:#ff7b54;
}
.temp-range .tmin{
    color:#3fa9f5;
}
.rain-data {
    margin-top:15px;
    border-top:1px solid #536cff;
    padding-top:8px;
    display:flex;
    justify-content:space-between;
    font-size:14px;
}
.rain-data strong {
    display:block;
    color:#7fffd4;
    font-size:16px;
}
.rain-row {
    text-align:center;
}
/* Colori a seconda del valore della temperatura */
.temp-freezing{
    color:#b9dfff;
    text-shadow:0 0 6px #6ab7ff,0 0 16px #6ab7ff;
}

.temp-cold{
    color:#dff8ff;
    text-shadow:0 0 6px #5ec8ff,0 0 16px #5ec8ff;
}

.temp-cool{
    color:#ffffff;
    text-shadow:0 0 6px #66ffff,0 0 16px #66ffff;
}

.temp-mild{
    color:#d9fff7;
    text-shadow:0 0 6px #43ffd1,0 0 16px #43ffd1;
}

.temp-warm{
    color:#fff7c8;
    text-shadow:0 0 6px #ffd54a,0 0 16px #ffd54a;
}

.temp-hot{
    color:#ffd8a8;
    text-shadow:0 0 6px #ff8c00,0 0 18px #ff8c00;
}

.temp-veryhot{
    color:#ffb3b3;
    text-shadow:0 0 7px #ff2b2b,0 0 22px #ff2b2b;
}

.temp-extreme{
    color:#ffffff;
    text-shadow:0 0 8px #ff00ff,0 0 24px #ff00ff;
}
/* Icone */
.icon-altitude,
.icon-temp,
.icon-humidity,
.icon-rain{
    position:relative;
}
.icon-humidity{ display:flex; align-items:center;}

.icon-altitude::before,
.icon-temp::before,
.icon-humidity::before,
.icon-tmax::before,
.icon-tmin::before,
.icon-rain::before{
    content:"";
    display:inline-block;
    width:16px;
    height:16px;
    margin-right:6px;
    background-repeat:no-repeat;
    background-position:center;
    vertical-align:middle;
}
.icon-temp::before { background-image:url('/icons/temp.png');
    width:42px; height:42px; margin-right:10px;}
/*.icon-humidity::before { background-image:url('/icons/humidity.png');
    width:18px; height:18px;}*/
.icon-tmax::before { background-image:url('/icons/tmax.gif');}
.icon-tmin::before { background-image:url('/icons/tmin.gif');}
.icon-rain::before { background-image:url('/icons/rain.png'); }
.icon-altitude::before { background-image:url('/icons/mountain.png'); }

@media (min-width: 768px) and (max-width: 1060px) {
    .records-table {
        font-size: 14px;
    }
    .temperature .value {
        font-size: 32px;
    }
    .homepage-meteo_attuale {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}
@media (max-width:768px){
    .homepage-meteo_attuale {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .cards-wrapper {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    .temperature .value {
        font-size: 42px;
    }
    .station-name {
        font-size: 24px;
    }
    .station-alt {
        margin:0;
        padding:1px;
    }

}