/**
 * SITVI - Header minimal del portale
 *
 * Stili condivisi per l'header globale (header.php) e per l'header
 * del viewer WebGIS (page-webgis.php). Mantiene l'identita' rossa
 * del portale (#a61f3a) con un look moderno minimal/glass.
 *
 * Classi principali:
 *   .sitvi-viewer-header--minimal   - barra header
 *   .sitvi-vh-brand                 - blocco brand "SitVI 3.0 | Vicenza"
 *   .sitvi-vh-titlewrap             - blocco titolo mappa (solo webgis)
 *   .sitvi-vh-spacer                - riempimento per spingere azioni a dx
 *   .sitvi-vh-actions               - blocco bottoni a destra
 *   .sitvi-vh-btn / --icon / --accent - bottoni dell'header
 *   .sitvi-vh-chip / --pri / --grp / --layers - chip metadati mappa
 *
 * @package SITVI
 */

:root {
    --sitvi-brand: #a61f3a;
    --sitvi-brand-dark: #7e1a2c;
    --sitvi-brand-soft: rgba(166, 31, 58, 0.08);
}

/* ===== Barra header =====
   L'outer (sitvi-viewer-header--minimal) e' full-width per lo sfondo
   glass + border-bottom. L'inner (sitvi-vh-inner) usa .container Bootstrap
   per centrare e limitare la larghezza del contenuto.
   La doppia classe alza la specificita' per battere webgis-viewer.css
   (che imposta padding: 10px 16px su .sitvi-viewer-header). */
.sitvi-viewer-header--minimal,
.sitvi-viewer-header.sitvi-viewer-header--minimal {
    padding: 10px 0;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02), 0 6px 18px rgba(15, 23, 42, 0.04);
}

.sitvi-vh-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Background morbido sul container del viewer webgis */
.sitvi-viewer-skin-minimal {
    background: linear-gradient(180deg, #eef2f6 0%, #f8fafc 100%);
}

/* ===== Brand SitVI (ex header_rosso integrato) ===== */
.sitvi-vh-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--sitvi-brand);
    flex: 0 0 auto;
    padding: 4px 10px 4px 0;
    transition: opacity 0.15s, color 0.15s;
}
.sitvi-vh-brand:hover,
.sitvi-vh-brand:focus,
.sitvi-vh-brand:visited {
    text-decoration: none;
    color: var(--sitvi-brand-dark);
    opacity: 0.92;
}
.sitvi-vh-brand-mark {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.02em;
    color: var(--sitvi-brand);
    line-height: 1;
}
.sitvi-vh-brand-version {
    font-weight: 500;
    font-size: 13px;
    color: var(--sitvi-brand-dark);
    margin-left: 2px;
    vertical-align: 1px;
}
.sitvi-vh-brand-sep {
    width: 1px;
    height: 24px;
    background: linear-gradient(180deg, transparent, rgba(15,23,42,0.18), transparent);
    flex: 0 0 1px;
}
.sitvi-vh-brand-city {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    white-space: nowrap;
}
.sitvi-vh-brand-city img {
    width: 28px;
    height: auto;
}

/* ===== Blocco titolo mappa (solo nel viewer webgis) ===== */
.sitvi-vh-titlewrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}
.sitvi-vh-textcol {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sitvi-vh-titlerow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}
.sitvi-vh-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.2;
    color: #0f172a;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.sitvi-vh-desc {
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Spacer usato nell'header globale (senza titolo mappa) per spingere le
   azioni a destra. */
.sitvi-vh-spacer {
    flex: 1 1 auto;
}

/* ===== Chip metadati mappa ===== */
.sitvi-vh-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sitvi-vh-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
    background: rgba(15, 23, 42, 0.04);
    color: #475569;
    border: 1px solid rgba(15, 23, 42, 0.06);
}
.sitvi-vh-chip i { font-size: 12px; }
.sitvi-vh-chip--pub    { background: #ecfdf5; color: #047857; border-color: rgba(4, 120, 87, 0.18); }
.sitvi-vh-chip--pri    { background: #fef2f2; color: #b91c1c; border-color: rgba(185, 28, 28, 0.18); }
.sitvi-vh-chip--grp    { background: #eff6ff; color: #1d4ed8; border-color: rgba(29, 78, 216, 0.18); }
.sitvi-vh-chip--layers { background: #f1f5f9; color: #334155; border-color: rgba(51, 65, 85, 0.12); }

/* ===== Azioni a destra (bottoni) ===== */
.sitvi-vh-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.sitvi-vh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: #334155;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: background 0.15s, box-shadow 0.15s, transform 0.15s, color 0.15s;
}
.sitvi-vh-btn:hover {
    background: #f8fafc;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
    text-decoration: none;
}
.sitvi-vh-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.sitvi-vh-btn:visited { color: #334155; }
.sitvi-vh-btn--icon { padding: 6px 10px; }
.sitvi-vh-btn i { font-size: 14px; }

/* Variante "accent" (rosso brand) per login/logout */
.sitvi-vh-btn--accent {
    background: var(--sitvi-brand);
    border-color: var(--sitvi-brand);
    color: #fff;
    box-shadow: 0 1px 2px rgba(166, 31, 58, 0.25);
}
.sitvi-vh-btn--accent:hover,
.sitvi-vh-btn--accent:focus,
.sitvi-vh-btn--accent:visited {
    background: var(--sitvi-brand-dark);
    border-color: var(--sitvi-brand-dark);
    color: #fff;
    box-shadow: 0 2px 8px rgba(166, 31, 58, 0.35);
}

/* ===== Responsive ===== */
/* Schermi medi: il "Citta' di Vicenza" si comprime a sola icona */
@media (max-width: 980px) {
    .sitvi-vh-brand-city span { display: none; }
}

/* Schermi stretti: nascondi etichette testuali, riduci il brand */
@media (max-width: 640px) {
    .sitvi-viewer-header--minimal { padding: 10px 0; }
    .sitvi-vh-inner { gap: 10px; }
    .sitvi-vh-title { font-size: 15px; }
    .sitvi-vh-btn-label { display: none; }
    .sitvi-vh-btn { padding: 6px 10px; }
    .sitvi-vh-desc { display: none; }
    .sitvi-vh-brand-version { display: none; }
    .sitvi-vh-brand-sep { display: none; }
    .sitvi-vh-brand-city { display: none; }
    .sitvi-vh-brand-mark { font-size: 16px; }
}

/* =====================================================
   BASEMAP SWITCHER — widget condiviso da TUTTE le mappe.
   Pillola in basso a sinistra: al passaggio del mouse si
   espande verso destra mostrando le thumbnail delle mappe
   di base disponibili (OSM, ortofoto, CTR, "nessuna").
   Altezza FISSA per evitare il salto verticale.
   ===================================================== */
.sitvi-basemap-switcher {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 10;
    height: 36px;
    padding: 5px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.10);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    cursor: pointer;
    transition: gap 0.25s ease, box-shadow 0.15s;
}
.sitvi-basemap-switcher:hover {
    gap: 5px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
}
.sitvi-basemap-switcher > i {
    font-size: 18px;
    line-height: 1;
    color: #475569;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.sitvi-basemap-switcher-item {
    /* Niente border: il bordo (anche trasparente) occupa 2px di layout
       anche con width:0, e con 4 item creava ~8px di spinta a destra del
       globe rendendo il bottone chiuso non quadrato. Per evidenziare hover
       e stato attivo usiamo solo box-shadow. */
    box-sizing: border-box;
    opacity: 0;
    transform: scale(0);
    width: 0;
    height: 26px;            /* altezza FISSA: non cambia tra collassato/espanso */
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    object-fit: cover;       /* le immagini riempiono 26x26 senza distorsione */
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    flex: 0 0 auto;
    transition: opacity 0.25s ease, transform 0.25s ease, width 0.25s ease, margin 0.25s ease, box-shadow 0.15s, outline-color 0.15s;
}
.sitvi-basemap-switcher:hover .sitvi-basemap-switcher-item {
    opacity: 1;
    transform: scale(1);
    width: 26px;
}
.sitvi-basemap-switcher-item:hover {
    opacity: 0.85 !important;
    box-shadow: 0 0 0 2px rgba(166, 31, 58, 0.30);
}
.sitvi-basemap-switcher-item.active {
    box-shadow: 0 0 0 2px #a61f3a;
    opacity: 1 !important;
}
/* Variante "Nessuna mappa di sfondo" (icona dentro al box invece di un'immagine).
   Uso outline al posto di border: outline non occupa spazio di layout e quindi
   non spinge il globe quando l'item e' collassato a width:0. */
button.sitvi-basemap-switcher-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    outline: 1px dashed transparent;
    outline-offset: -1px;
    background: #f8fafc;
    font-size: 13px;
}
.sitvi-basemap-switcher:hover button.sitvi-basemap-switcher-item {
    outline-color: #94a3b8;
}
button.sitvi-basemap-switcher-item i { line-height: 1; }
