html, body {
    height: 100%;
    margin: 0;
}

.geoportale-app {
    height: 100vh;
    width: 100vw;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ===== Layout generale (fedele a Default.aspx del geoportale legacy) ===== */

.geoportale-shell {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

.geoportale-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}

.gp-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: 1rem;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.gp-icon-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.gp-icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ===== Banner superiore ===== */

.gp-banner {
    display: flex;
    align-items: center;
    background: #58595b;
    color: #fff;
    height: 44px;
    padding: 0 12px;
    gap: 12px;
    flex: none;
    z-index: 20;
}

.gp-banner-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.gp-ente-name {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gp-banner-tools {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    justify-content: center;
}

.gp-banner-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gp-brand {
    font-weight: 600;
    white-space: nowrap;
}

.gp-icon-btn.active {
    background: rgba(255, 255, 255, 0.25);
}

/* ===== Menù laterale (burger) ===== */

.gp-sidemenu {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    background: #fff;
    color: #333;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.25);
    z-index: 30;
    overflow-y: auto;
}

.gp-sidemenu-header {
    display: flex;
    justify-content: flex-end;
    padding: 4px;
    color: #333;
}

.gp-sidemenu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
}

.gp-sidemenu-item:hover:not(.gp-disabled) {
    background: #f0f0f0;
}

.gp-sidemenu-item.gp-disabled {
    color: #aaa;
    cursor: not-allowed;
}

.gp-sidemenu-item i {
    width: 18px;
    text-align: center;
}

/* ===== Pannello legenda "Elenco Layer" (sidebar destra, come nel geoportale legacy) ===== */

.legend-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    background: #fff;
    color: #333;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.25);
    z-index: 30;
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.legend-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
}

.legend-panel-header span {
    flex: 1 1 auto;
}

.legend-panel-header .gp-icon-btn {
    color: #333;
}

.legend-panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px 0;
}

.legend-empty {
    padding: 8px 12px;
    color: #666;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    white-space: nowrap;
}

.legend-expand {
    cursor: pointer;
    width: 14px;
    font-size: 0.7rem;
    display: inline-block;
    text-align: center;
    user-select: none;
    color: #666;
}

.legend-expand-spacer {
    width: 14px;
    display: inline-block;
}

.legend-eye {
    cursor: pointer;
    width: 16px;
    text-align: center;
    color: #999;
}

.legend-eye.legend-eye-on {
    color: #1a73e8;
}

.legend-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.legend-group .legend-name {
    font-weight: 600;
}

/* Cursore "Visualizza informazioni" attivo — wrapper CSS condizionale su .esri-view-surface, non un
   parametro su MapView (SetCursor() viene resettato da ArcGIS JS, stesso gotcha già noto per altri widget). */
.geoportale-body.identify-active .esri-view-surface {
    cursor: help;
}

/* ===== Pannello "Visualizza informazioni" (identify al click) ===== */

.identify-module-title {
    font-weight: 600;
    padding: 10px 12px 4px;
    border-top: 1px solid #e0e0e0;
}

.identify-node-text {
    overflow-wrap: anywhere;
    white-space: normal;
}

.identify-geopos-btn {
    cursor: pointer;
    color: #999;
    width: 16px;
    text-align: center;
    flex: none;
}

.identify-geopos-btn:hover {
    color: #1a73e8;
}

/* ===== Pannello "Misura" (Distanza/Area/Cancella) ===== */

.measurement-toolbar {
    position: absolute;
    top: 60px;
    right: 10px;
    z-index: 25;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    gap: 2px;
    padding: 4px;
}

.measurement-toolbar .measurement-btn {
    color: #333;
}

/* Specificità maggiore di .gp-icon-btn:hover/.gp-icon-btn.active (pensate per il banner scuro) —
   altrimenti su un pannello chiaro un pulsante attivo/hover diventa bianco su bianco, invisibile
   (bug reale osservato: il pulsante "Distanza" attivo spariva del tutto). */
.measurement-toolbar .measurement-btn:hover:not(:disabled) {
    background: #e8f0fe;
}

.measurement-toolbar .measurement-btn.active,
.measurement-toolbar .measurement-btn.active:hover {
    background: #1a73e8;
    color: #fff;
}

/* ===== Pannello "Google Street View" ===== */

.streetview-panel {
    width: 420px;
}

.streetview-pano {
    flex: 1 1 auto;
    min-height: 0;
}

/* ===== Pannello "Interrogazione urbanistica" ===== */

.urbanistic-zone-row {
    align-items: flex-start;
    white-space: normal;
}

.urbanistic-normative {
    color: #666;
    font-size: 0.8rem;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    background: #888;
    border: 1px solid #555;
    display: inline-block;
    flex: none;
}

.legend-swatch-small {
    width: 10px;
    height: 10px;
}

.legend-desc {
    color: #333;
    font-size: 0.8rem;
}
