body {
    font-family: 'Tahoma', 'Vazirmatn', 'Arial', sans-serif;
    background-image: linear-gradient(135deg, rgba(227, 242, 253, 0.86) 0%, rgba(240, 248, 255, 0.86) 100%), url('/staticImages/BGImage.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin: 5px 0;
}

/* افزایش فاصله‌ها در صفحه‌های کوچک‌تر */
@media (max-width: 768px) {
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }
}

#map {
    height: 75vh;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

/* Header styling */
.card-header {
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
    border: none;
}

.bg-primary {
    background: linear-gradient(135deg, #1976d2 0%, #2196f3 100%) !important;
}

.bg-danger {
    background: linear-gradient(135deg, #d32f2f 0%, #f44336 100%) !important;
}

.card {
    margin-bottom: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.card-body {
    background: linear-gradient(135deg, #f8fbff 0%, #e8f4fd 100%);
    border-radius: 0 0 12px 12px;
    padding: 1.5rem;
}

.col-12 .card-body {
    background: linear-gradient(135deg, #f0f8ff 0%, #e1f5fe 100%);
}

.legend {
    background: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
}

.legend i {
    width: 18px;
    height: 18px;
    float: right;
    margin-left: 8px;
    opacity: 0.7;
}

.info {
    padding: 6px 8px;
    font: 15px/18px 'Tahoma', 'Vazirmatn', Arial, Helvetica, sans-serif;
    background: white;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    direction: rtl;
    text-align: right;
}

.data-type-selector {
    margin-bottom: 15px;
}

/* Stable Leaflet point popups
   The ML panel can make a popup tall. Keep its content inside the map viewport
   and let the popup content scroll instead of creating a hover/auto-pan loop. */
.leaflet-popup-content {
    max-height: min(62vh, 520px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.leaflet-popup-content-wrapper {
    overflow: hidden;
}

/* Flood warning popup styles */
.flood-warning-popup {
    margin-top: 10px;
    padding: 8px;
    background-color: #fff3f3;
    border: 1px solid #ffcccc;
    border-radius: 5px;
}

.flood-warning-popup h5 {
    color: #cc0000;
    margin-top: 0;
    margin-bottom: 8px;
    font-weight: bold;
}

.flood-warning-popup p {
    margin: 5px 0;
    font-size: 0.9em;
}

/* Blinking marker style */
.leaflet-marker-icon.blink {
    animation: blink-animation 1s steps(5, start) infinite;
}

@keyframes blink-animation {
    to {
        visibility: hidden;
    }
}

/* Custom point styles */
.custom-point-marker {
    background: transparent !important;
    border: none !important;
}

.custom-point-marker div {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.custom-point-marker div:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#customPointPanel {
    transition: all 0.3s ease;
}

#customPointPanel .card-header {
    background: linear-gradient(135deg, #ffc107, #ff8c00);
    color: #fff;
    font-weight: bold;
    border-radius: 12px 12px 0 0;
}

#customPointPanel .card-body {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border-radius: 0 0 12px 12px;
}

/* Form controls styling */
.form-control {
    border-radius: 8px;
    border: 2px solid #e3f2fd;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #2196f3;
    box-shadow: 0 0 0 0.2rem rgba(33, 150, 243, 0.25);
    background: #fff;
}

.form-label {
    font-weight: 600;
    color: #1565c0;
    margin-bottom: 0.5rem;
}

#customPointData {
    transition: all 0.3s ease;
}

#customPointData .alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#customPointData .alert-danger {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    color: #c62828;
    border: 2px solid #ffcdd2;
}

#customPointData .alert-success {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    color: #2e7d32;
    border: 2px solid #c8e6c9;
}

#customPointData .alert-warning {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    color: #f57c00;
    border: 2px solid #ffecb3;
}

#customPointData .alert-info {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1565c0;
    border: 2px solid #bbdefb;
}

/* General alert improvements */
.alert {
    border-radius: 10px;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

/* Custom point button styles */
#customPointBtn {
    transition: all 0.3s ease;
    font-weight: bold;
}

#customPointBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#customPointBtn.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    border-color: #138496;
    animation: pulse 2s infinite;
}

/* Custom point panel button styles */
.custom-point-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    min-height: 42px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.custom-point-btn i {
    font-size: 1.1em;
    margin-left: 0.3em;
    vertical-align: middle;
}

.custom-point-btn span {
    vertical-align: middle;
    font-family: inherit;
}

.custom-point-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.custom-point-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.custom-point-btn.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff !important;
}

.custom-point-btn.btn-success:hover {
    background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
}

.custom-point-btn.btn-success i,
.custom-point-btn.btn-success span {
    color: #fff !important;
}

.custom-point-btn.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
    color: #fff !important;
}

.custom-point-btn.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #c0392b 100%);
}

.custom-point-btn.btn-danger i,
.custom-point-btn.btn-danger span {
    color: #fff !important;
}

.custom-point-btn:disabled {
    opacity: 0.6;
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: not-allowed;
}

.custom-point-btn:disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Download button styles */
#downloadCsvBtn, #downloadAllDataBtn {
    transition: all 0.3s ease;
    font-weight: bold;
}

#downloadCsvBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #17a2b8, #138496);
    border-color: #138496;
}

#downloadAllDataBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #6c757d, #5a6268);
    border-color: #5a6268;
}

#downloadCsvBtn:disabled, #downloadAllDataBtn:disabled {
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(23, 162, 184, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(23, 162, 184, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(23, 162, 184, 0);
    }
}

/* Input group styles for coordinates */
.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

.input-group .form-control:last-child {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* Responsive adjustments */
.select-lg {
    font-size: 1.18rem !important;
    height: 48px !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.select-label-lg {
    font-size: 1.13rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
    margin-top: -15px;
}

@media (max-width: 768px) {
    .row.g-2.flex-nowrap {
        margin-bottom: 12px;
    }
}

@media (max-width: 768px) {
    #customPointPanel .row > div {
        margin-bottom: 15px;
    }
    
    #customPointPanel .d-flex {
        justify-content: center !important;
    }
    
    #customPointBtn, #downloadCsvBtn, #downloadAllDataBtn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .card-body .row > div {
        margin-bottom: 15px;
    }
    
    .card-body .d-flex {
        justify-content: center !important;
    }
}

@media (max-width: 576px) {
    .card-body .row {
        flex-direction: column;
    }
    
    .card-body .col-md-2 {
        width: 100%;
        margin-bottom: 10px;
    }
}

.custom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    font-family: inherit;
    font-size: 0.95rem;
    min-width: 130px;
    min-height: 45px;
    border-radius: 10px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s;
    background: linear-gradient(135deg, #dc0000 0%, #ff1a1a 100%);
    color: #fff !important;
    border: none;
    margin: 2px;
    position: relative;
}

.custom-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

.custom-btn i {
    font-size: 1.1em;
    margin-left: 0.2em;
    margin-right: 0.2em;
    vertical-align: middle;
}

.custom-btn span {
    vertical-align: middle;
    font-family: inherit;
}

.custom-btn:active, .custom-btn:focus {
    outline: 2px solid #1976d2;
    box-shadow: 0 0 0 2px #1976d2;
}

.custom-btn.btn-warning {
    background: linear-gradient(135deg, #ffd600 0%, #ffe082 100%);
    color: #333 !important;
}
.custom-btn.btn-warning i, .custom-btn.btn-warning span { color: #333 !important; }

.custom-btn.btn-success {
    background: linear-gradient(135deg, #43a047 0%, #81c784 100%);
    color: #fff !important;
}
.custom-btn.btn-success i, .custom-btn.btn-success span { color: #fff !important; }

.custom-btn.btn-secondary {
    background: linear-gradient(135deg, #607d8b 0%, #b0bec5 100%);
    color: #fff !important;
}
.custom-btn.btn-secondary i, .custom-btn.btn-secondary span { color: #fff !important; }

.custom-btn.btn-info {
    background: linear-gradient(135deg, #29b6f6 0%, #4fc3f7 100%);
    color: #fff !important;
}
.custom-btn.btn-info i, .custom-btn.btn-info span { color: #fff !important; }

.custom-btn.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #5c9eff 100%);
    color: #fff !important;
}
.custom-btn.btn-primary i, .custom-btn.btn-primary span { color: #fff !important; }

.custom-btn:disabled {
    opacity: 0.6;
    box-shadow: none;
}

/* Leaflet control-layers (base map selector) font and direction */
.leaflet-control-layers {
    font-family: 'Tahoma', 'Vazirmatn', Arial, sans-serif !important;
    font-size: 1.05rem !important;
    direction: rtl;
    text-align: right;
    border-radius: 10px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.leaflet-control-layers label {
    font-family: inherit !important;
    font-size: 1.05rem !important;
    direction: rtl;
    text-align: right;
    margin-bottom: 4px;
}
.leaflet-control-layers-base input[type="radio"] {
    accent-color: #2196f3;
}

/* Daily precipitation forecast layer controls */
.precipitation-layer-panel {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(33, 150, 243, 0.18);
    border-radius: 12px;
    padding: 12px;
    margin: 0 2px;
}

.rain-layer-switch {
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1565c0;
    font-weight: 600;
}

.rain-layer-switch .form-check-input {
    float: none;
    margin: 0 0 0 8px;
    cursor: pointer;
}

.rain-layer-status {
    font-size: 0.82rem;
    color: #345;
    margin-top: 3px;
    line-height: 1.6;
}

.leaflet-precipitation-canvas {
    image-rendering: auto;
    mix-blend-mode: multiply;
}

@media (max-width: 768px) {
    .precipitation-layer-panel {
        padding: 10px;
    }


    .rain-layer-status {
        font-size: 0.78rem;
    }
}

/* Modern primary-page actions */
.custom-btn { border:0; border-radius:12px; min-height:42px; padding:.55rem .9rem; font-weight:700; box-shadow:0 5px 14px rgba(20,55,90,.16); transition:transform .18s ease,box-shadow .18s ease,filter .18s ease; display:inline-flex; align-items:center; gap:.4rem; }
.custom-btn i { width:24px; height:24px; display:inline-grid; place-items:center; border-radius:8px; background:rgba(255,255,255,.22); }
.custom-btn:hover { transform:translateY(-2px); box-shadow:0 8px 20px rgba(20,55,90,.24); filter:saturate(1.08); }
.custom-btn:active { transform:translateY(0); }
.flood-analysis-card .card-header { color:#fff; background:linear-gradient(135deg,#00695c,#26a69a); }
.flood-analysis-card .card-body { background:linear-gradient(135deg,#effaf8,#e0f2f1); }
.flood-layer-select { width:auto; min-width:230px; }
.analysis-summary { padding:.7rem 1rem; border-radius:10px; background:#fff; border:1px solid #b2dfdb; }
.flood-cell-tooltip { direction:rtl; text-align:right; }
@media (max-width:768px){.flood-layer-select{width:100%;}.custom-btn{width:100%;justify-content:center;}}

/* ===== Refined six-button primary action bar ===== */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: stretch;
    gap: 9px;
    width: 100%;
    margin: 0;
}

.action-buttons .custom-btn {
    min-width: 0;
    width: 100%;
    min-height: 50px;
    margin: 0;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 14px;
    display: flex;
    flex-direction: row;
    direction: rtl;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: .78rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(28, 60, 90, .18), inset 0 1px 0 rgba(255,255,255,.20);
}

.action-buttons .custom-btn i {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    margin: 0;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    background: rgba(255, 255, 255, .22);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}

.action-buttons .custom-btn span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.action-buttons .custom-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(28, 60, 90, .25), inset 0 1px 0 rgba(255,255,255,.24);
}

.action-buttons .custom-btn:focus-visible {
    outline: 3px solid rgba(25, 118, 210, .30);
    outline-offset: 2px;
}

@media (max-width: 991.98px) {
    .date-type-controls { margin-bottom: 4px; }
    .action-buttons { grid-template-columns: repeat(6, minmax(105px, 1fr)); overflow-x: auto; padding-bottom: 5px; }
}

@media (max-width: 575.98px) {
    .action-buttons { grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
    .action-buttons .custom-btn { min-height: 50px; padding: 7px 8px; font-size: .74rem; gap: 6px; }
    .action-buttons .custom-btn i { width: 27px; height: 27px; flex-basis: 27px; font-size: .9rem; }
}

/* Clear visual state while polygon drawing is active */
#finishPolygonBtn {
    min-width: 145px;
    animation: polygonFinishPulse 1.8s ease-in-out infinite;
}
@keyframes polygonFinishPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(13,110,253,.25); }
    50% { box-shadow: 0 0 0 7px rgba(13,110,253,0); }
}
.leaflet-container.polygon-drawing-active { cursor: crosshair !important; }

/* Parallel ML flood-occurrence forecast panel (experimental adapter) */
.ml-forecast-box {
    margin-top: 10px;
    padding: 9px 11px;
    border: 1px solid #6f42c1;
    border-right: 4px solid #6f42c1;
    border-radius: 8px;
    background: #f7f3ff;
    line-height: 1.75;
    font-size: 0.88rem;
    direction: rtl;
}
.ml-forecast-box.ml-state-flood { background: #fff3f5; border-color: #a61e4d; }
.ml-forecast-box.ml-state-nonflood { background: #f5f2ff; border-color: #6f42c1; }
.ml-forecast-box.ml-unavailable { background: #f6f6f6; border-color: #888; }
.ml-title { font-weight: 700; margin-bottom: 4px; color: #4b2d83; }
.ml-state-flood .ml-title { color: #8b1538; }
.ml-experimental { font-size: 0.72rem; padding: 1px 5px; border-radius: 9px; background: #e8dcff; color: #4b2d83; }
.ml-caveat { margin-top: 5px; padding-top: 5px; border-top: 1px dashed rgba(80,60,110,.28); color: #5f5f67; font-size: .75rem; }
.ml-muted { color: #666; font-size: .8rem; }
.ml-confidence { font-weight: 700; }
.ml-confidence-low { color: #a61e4d; }
.ml-confidence-guarded { color: #b26a00; }
.ml-confidence-high { color: #276749; }
.ml-confidence-very_high { color: #146c43; }
.ml-guide-alert { background: #f7f3ff; border: 1px solid #cab8ee; color: #33264f; }
.ml-model-status { font-weight: 600; font-size: .85rem; }

/* ========================================================================
   ABAN v3.5 — user-facing simple + advanced point forecast dashboard
   ======================================================================== */
.leaflet-popup-content {
    width: auto !important;
    max-height: min(72vh, 680px);
    margin: 12px 12px 14px 12px;
}

.leaflet-popup-content-wrapper {
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(15, 35, 55, .20);
    border: 1px solid rgba(61, 95, 125, .13);
}

.aban-popup-dashboard {
    width: min(510px, calc(100vw - 76px));
    min-width: 300px;
    color: #203040;
    direction: rtl;
    text-align: right;
    line-height: 1.55;
}

.forecast-point-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 2px 11px;
    border-bottom: 1px solid #e7edf3;
}

.forecast-point-kicker {
    display: block;
    font-size: .68rem;
    font-weight: 800;
    color: #7790a5;
    letter-spacing: .02em;
    margin-bottom: 1px;
}

.forecast-point-header h3 {
    margin: 0;
    font-size: 1.07rem;
    font-weight: 900;
    color: #17344c;
}

.forecast-point-header h3 i { color: #1684a7; margin-left: 4px; }
.forecast-point-header small { color: #7a8b98; font-size: .68rem; }

.forecast-date-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #eaf5fb;
    color: #31546d;
    border: 1px solid #cfe1ee;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: .71rem;
    font-weight: 800;
    white-space: nowrap;
}

.forecast-section {
    margin-top: 12px;
    border-radius: 15px;
    padding: 12px;
    overflow: hidden;
}

.forecast-simple {
    background: linear-gradient(145deg, #f2fbff 0%, #e3f4fb 100%);
    border: 1px solid #bfddee;
}

.forecast-advanced {
    position: relative;
    background: linear-gradient(155deg, #f4fbff 0%, #edf5ff 54%, #eefafb 100%);
    border: 1px solid #cdddf0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.forecast-advanced::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, #4b89c7, #3d9dc9, #4fc3c8);
}

.forecast-section-head {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 10px;
}

.forecast-section-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: #dff2fb;
    color: #1f7ea2;
    font-size: .92rem;
}

.advanced-head .forecast-section-icon {
    background: linear-gradient(135deg, #4f93cc, #57b4d4);
    color: #fff;
    box-shadow: 0 5px 12px rgba(55, 124, 170, .20);
}

.forecast-section-head > div:nth-child(2) { min-width: 0; flex: 1; }
.forecast-section-head h4 { margin: 0; font-size: .93rem; font-weight: 900; color: #193b52; }
.forecast-section-head p { margin: 1px 0 0; font-size: .69rem; color: #718391; }

.forecast-section-tag {
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(255,255,255,.72);
    border: 1px solid #ccdee8;
    padding: 3px 7px;
    font-size: .64rem;
    font-weight: 800;
    color: #4e6d82;
}

.advanced-tag { border-color: #d7cbed; color: #684b9d; background: #fff; }

.simple-main-value {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255,255,255,.84);
    border: 1px solid #cfe3ee;
    border-radius: 11px;
    padding: 8px 10px;
    margin-bottom: 8px;
}
.simple-main-value span { color: #5f7483; font-size: .76rem; }
.simple-main-value strong { color: #0e668c; font-size: .96rem; white-space: nowrap; }

.simple-status {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border-radius: 11px;
    padding: 8px 9px;
    margin-bottom: 8px;
    border: 1px solid transparent;
}
.simple-status > i { margin-top: 3px; font-size: .9rem; }
.simple-status > div { display: flex; flex-direction: column; gap: 1px; }
.simple-status strong { font-size: .78rem; }
.simple-status span, .simple-status small { font-size: .68rem; line-height: 1.55; }
.simple-status-danger { color: #8b2133; background: #fff0f2; border-color: #f3c5cd; }
.simple-status-ok { color: #17633e; background: #eefaf3; border-color: #caead7; }
.simple-status-muted { color: #725f38; background: #fff9e9; border-color: #f0dfae; }

.simple-hydro-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.simple-hydro-item {
    min-width: 0;
    background: rgba(255,255,255,.82);
    border: 1px solid #d0e2ec;
    border-radius: 10px;
    padding: 7px 7px;
    text-align: center;
}
.simple-hydro-item span { display: block; color: #6b7d89; font-size: .62rem; line-height: 1.35; }
.simple-hydro-item strong { display: block; color: #284b60; font-size: .71rem; margin-top: 2px; overflow-wrap: anywhere; }

.advanced-probability-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.probability-card {
    position: relative;
    min-height: 126px;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    padding: 11px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.8);
    box-shadow: 0 5px 16px rgba(42, 55, 78, .08);
}
.flood-probability { background: linear-gradient(145deg, rgba(255,255,255,.95) 0%, #eef5ff 100%); }
.rain-probability { background: linear-gradient(145deg, rgba(255,255,255,.95) 0%, #e4f5fb 100%); }
.probability-icon {
    width: 28px; height: 28px; display: grid; place-items: center;
    border-radius: 9px; margin-bottom: 5px; font-size: .78rem;
    background: #e4f2fd; color: #4679b2;
}
.rain-probability .probability-icon { background: #d8f0fa; color: #1c87a2; }
.probability-label { color: #546779; font-size: .69rem; font-weight: 800; }
.probability-card > strong { font-size: 1.55rem; line-height: 1.15; color: #365d91; margin: 2px 0; }
.rain-probability > strong { color: #0f6f8f; }
.probability-card > small { color: #798795; font-size: .60rem; line-height: 1.45; min-height: 27px; }
.probability-progress { height: 5px; background: #dbe8f2; border-radius: 99px; margin-top: auto; overflow: hidden; }
.probability-progress span { display: block; height: 100%; background: linear-gradient(90deg, #4d8cc8, #58bfd0); border-radius: inherit; }
.probability-context { color: #6d7f88; font-size: .58rem; line-height: 1.35; margin-top: auto; }

.operational-probability-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 9px;
    padding: 8px 10px;
    border: 1px solid #d9e7df;
    border-radius: 11px;
    background: linear-gradient(145deg, #f9fcfa 0%, #eef8f2 100%);
    color: #466257;
}
.operational-probability-note > i { margin-top: 2px; color: #3f8a68; font-size: .75rem; }
.operational-probability-note > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.operational-probability-note strong { font-size: .67rem; line-height: 1.35; }
.operational-probability-note span { font-size: .57rem; line-height: 1.55; }

.severity-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 9px;
    border-radius: 12px;
    padding: 9px 10px;
    border: 1px solid transparent;
}
.severity-badge { flex: 1; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 7px; }
.severity-badge i { grid-row: 1 / span 2; font-size: 1.15rem; }
.severity-badge span { font-size: .63rem; opacity: .78; }
.severity-badge strong { font-size: .88rem; }
.severity-score { text-align: center; border-right: 1px solid rgba(40,40,40,.12); padding-right: 10px; }
.severity-score span { display: block; font-size: .58rem; opacity: .75; }
.severity-score strong { display: block; font-size: 1.03rem; }
.severity-score small { font-size: .55rem; font-weight: 600; }
.severity-note { flex-basis: 100%; display: none; }
.severity-yellow { background: #fff9dc; border-color: #e8d16d; color: #6d5a08; }
.severity-orange { background: #fff0df; border-color: #edb36e; color: #8b4d0a; }
.severity-red { background: #ffe9eb; border-color: #e9949e; color: #8b1f31; }
.severity-inactive { background: #f7f8fa; border-color: #e0e5e9; color: #63717c; }
.severity-inactive > i { font-size: 1rem; color: #7d8992; }
.severity-inactive > div { display: flex; flex-direction: column; }
.severity-inactive strong { font-size: .75rem; }
.severity-inactive span { font-size: .63rem; line-height: 1.45; }

.advanced-event-block, .advanced-days, .environment-block {
    margin-top: 10px;
    background: rgba(250,253,255,.76);
    border: 1px solid #d3e2ef;
    border-radius: 12px;
    padding: 9px;
}
.advanced-subtitle {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #4b506e;
    font-size: .72rem;
    font-weight: 900;
    margin-bottom: 7px;
}
.advanced-subtitle i { color: #6650a3; }
.advanced-subtitle span { margin-right: auto; color: #85909a; font-size: .59rem; font-weight: 700; }

.event-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.event-metric {
    min-width: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 5px;
    background: rgba(255,255,255,.90);
    border: 1px solid #dbe6ef;
    border-radius: 9px;
    padding: 6px;
}
.event-metric i { grid-row: 1 / span 2; color: #4a83a0; font-size: .72rem; }
.event-metric span { color: #7a7e89; font-size: .55rem; line-height: 1.3; }
.event-metric strong { color: #3c4750; font-size: .65rem; white-space: nowrap; }
.event-method-note { color: #7d7d87; font-size: .57rem; line-height: 1.5; margin-top: 6px; }
.event-method-note i { color: #6680a0; margin-left: 3px; }

.advanced-day-row {
    display: grid;
    grid-template-columns: 72px minmax(70px, 1fr) 126px 8px;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    border-bottom: 1px dashed #e5e2ea;
}
.advanced-day-row:last-child { border-bottom: 0; }
.advanced-day-date { display: flex; flex-direction: column; }
.advanced-day-date strong { font-size: .62rem; color: #4d5964; }
.advanced-day-date small { font-size: .52rem; color: #939ba2; }
.advanced-day-bar { height: 6px; border-radius: 99px; background: #e9e6ef; overflow: hidden; }
.advanced-day-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7f64b8 0%, #dc526f 100%); }
.advanced-day-meta { display: flex; flex-direction: column; text-align: left; direction: ltr; }
.advanced-day-meta strong { font-size: .63rem; color: #644489; }
.advanced-day-meta small { font-size: .49rem; color: #7e8991; white-space: normal; line-height: 1.3; }
.advanced-day-signal { width: 7px; height: 7px; border-radius: 50%; }
.day-signal-positive { background: #d9405d; box-shadow: 0 0 0 3px rgba(217,64,93,.12); }
.day-signal-negative { background: #75ad91; }

.environment-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #7c8490;
    font-size: .64rem;
    padding: 8px 3px;
}
.environment-spinner {
    width: 14px; height: 14px; flex: 0 0 14px;
    border: 2px solid #d9d0e9; border-top-color: #694ca0;
    border-radius: 50%; animation: abanEnvSpin .75s linear infinite;
}
@keyframes abanEnvSpin { to { transform: rotate(360deg); } }
.environment-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}
.environment-card {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 7px;
    background: rgba(255,255,255,.90);
    border: 1px solid #d8e5ee;
    border-radius: 10px;
    padding: 7px;
}
.environment-card:last-child { grid-column: 1 / -1; }
.environment-icon {
    width: 27px; height: 27px; flex: 0 0 27px;
    display: grid; place-items: center; border-radius: 8px;
    background: #eef5ed; color: #3b7b49; font-size: .7rem;
}
.environment-elevation .environment-icon { background: #f4eee8; color: #846043; }
.environment-stream .environment-icon { background: #e5f4fb; color: #347eaa; }
.environment-cover .environment-icon { background: #f1eee6; color: #786d43; }
.environment-use .environment-icon { background: #eaf5e8; color: #527f43; }
.environment-card > div { min-width: 0; }
.environment-card span:not(.environment-icon) { display: block; color: #7a858d; font-size: .55rem; }
.environment-card strong { display: block; color: #35434d; font-size: .69rem; overflow-wrap: anywhere; }
.environment-card small { display: block; color: #8c969c; font-size: .50rem; line-height: 1.4; margin-top: 1px; }
.environment-source-note { color: #7d828c; font-size: .53rem; line-height: 1.45; margin-top: 6px; }
.environment-source-note i { color: #6f5b99; margin-left: 3px; }
.environment-error { color: #856a49; background: #fff9eb; border-radius: 8px; padding: 7px; font-size: .63rem; }

.ml-technical-details {
    margin-top: 9px;
    border: 1px solid #ddd7e7;
    border-radius: 10px;
    background: rgba(255,255,255,.62);
    overflow: hidden;
}
.ml-technical-details summary {
    cursor: pointer;
    list-style: none;
    padding: 8px 9px;
    color: #5e5472;
    font-size: .66rem;
    font-weight: 800;
    user-select: none;
}
.ml-technical-details summary::-webkit-details-marker { display: none; }
.ml-technical-details summary i { margin-left: 4px; color: #7259a2; }
.ml-technical-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 0 8px 8px;
}
.ml-technical-grid > div { background: #fff; border: 1px solid #ebe8ef; border-radius: 8px; padding: 6px; }
.ml-technical-grid span { display: block; color: #899098; font-size: .52rem; }
.ml-technical-grid strong { display: block; color: #4d4f59; font-size: .62rem; overflow-wrap: anywhere; }
.ml-technical-details .ml-caveat { margin: 0 8px 8px; padding: 7px; border: 0; border-radius: 8px; background: #edf5fb; color: #73717a; font-size: .55rem; line-height: 1.5; }
.advanced-unavailable { color: #675b78; background: #fff; border: 1px solid #e5dfed; border-radius: 10px; padding: 8px; font-size: .68rem; }

#customPointDataContent .aban-popup-dashboard {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
}
#customPointDataContent .forecast-section { padding: 14px; }
#customPointDataContent .advanced-probability-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
#customPointDataContent .event-metrics-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
#customPointDataContent .environment-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
#customPointDataContent .environment-card:last-child { grid-column: auto; }

@media (max-width: 575.98px) {
    .leaflet-popup-content { margin: 9px; max-height: 68vh; }
    .aban-popup-dashboard { width: min(395px, calc(100vw - 58px)); min-width: 270px; }
    .forecast-point-header { align-items: center; }
    .forecast-point-header h3 { font-size: .92rem; }
    .forecast-date-chip { font-size: .62rem; padding: 4px 7px; }
    .forecast-section { padding: 9px; margin-top: 9px; }
    .advanced-probability-grid { gap: 6px; }
    .probability-card { min-height: 118px; padding: 9px; }
    .probability-card > strong { font-size: 1.35rem; }
    .simple-hydro-grid { grid-template-columns: 1fr; }
    .simple-hydro-item { display: flex; align-items: center; justify-content: space-between; text-align: right; }
    .simple-hydro-item span, .simple-hydro-item strong { display: inline; }
    .event-metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .environment-grid { grid-template-columns: 1fr; }
    .environment-card:last-child { grid-column: auto; }
    .advanced-day-row { grid-template-columns: 62px minmax(45px, 1fr) 106px 7px; gap: 4px; }
    .advanced-day-meta small { font-size: .45rem; }
    .ml-technical-grid { grid-template-columns: 1fr; }
    #customPointDataContent .advanced-probability-grid,
    #customPointDataContent .event-metrics-grid,
    #customPointDataContent .environment-grid { grid-template-columns: 1fr; }
}

/* V3.7 — Larger map workspace + compact hover help
   Keep guidance available without consuming vertical page space. */
.container {
    width: min(90vw, 1500px);
    max-width: 1500px;
}

.map-row {
    margin-bottom: 0;
}

.map-card {
    margin-bottom: 10px;
}

.map-card-body {
    padding: 0.65rem;
    background: linear-gradient(135deg, #f8fbff 0%, #e8f4fd 100%);
}

.map-stage {
    position: relative;
    width: 100%;
}

#map {
    height: 82vh;
    min-height: 650px;
    width: 100%;
    border-radius: 10px;
}

.map-help-widget {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 1000;
    direction: rtl;
    outline: none;
}

.map-help-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(61, 88, 124, 0.18);
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.94);
    color: #31506f;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    box-shadow: 0 5px 18px rgba(31, 61, 89, 0.16);
    backdrop-filter: blur(8px);
    cursor: help;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.map-help-trigger i {
    color: #1976d2;
    font-size: 0.9rem;
}

.map-help-widget:hover .map-help-trigger,
.map-help-widget:focus-within .map-help-trigger {
    transform: translateY(-1px);
    background: #fff;
    box-shadow: 0 7px 22px rgba(31, 61, 89, 0.22);
}

.map-help-popover {
    position: absolute;
    left: 0;
    bottom: calc(100% + 9px);
    width: min(350px, calc(100vw - 44px));
    padding: 11px 12px;
    border: 1px solid rgba(55, 84, 116, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 12px 32px rgba(24, 49, 75, 0.20);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.985);
    transform-origin: bottom left;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.map-help-widget:hover .map-help-popover,
.map-help-widget:focus-within .map-help-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.map-help-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    padding-bottom: 7px;
    border-bottom: 1px solid #e9eef4;
    color: #233f5a;
    font-size: 0.78rem;
    font-weight: 900;
}

.map-help-title i {
    color: #1976d2;
}

.map-help-item {
    display: grid;
    grid-template-columns: 18px 1fr;
    align-items: start;
    gap: 6px;
    margin: 6px 0;
    color: #506478;
    font-size: 0.66rem;
    line-height: 1.65;
}

.map-help-item i {
    margin-top: 3px;
    color: #5c83a5;
    text-align: center;
}

.map-help-model-status {
    margin-top: 8px !important;
    padding-top: 7px;
    border-top: 1px dashed #dce4ec;
    color: #667889;
    font-size: 0.61rem;
}

@media (max-width: 1199.98px) {
    .container {
        width: 98vw;
        max-width: none;
        padding-left: 10px;
        padding-right: 10px;
    }

    #map {
        height: 78vh;
        min-height: 600px;
    }
}

@media (max-width: 767.98px) {
    .container {
        width: 100%;
        margin-top: 8px;
        padding-left: 6px;
        padding-right: 6px;
    }

    .map-card-body {
        padding: 0.4rem;
    }

    #map {
        height: 74vh;
        min-height: 560px;
        border-radius: 8px;
    }

    .map-help-widget {
        left: 10px;
        bottom: 10px;
    }

    .map-help-trigger {
        padding: 7px 10px;
        font-size: 0.7rem;
    }

    .map-help-popover {
        width: min(320px, calc(100vw - 30px));
    }
}

@media (max-width: 480px) {
    #map {
        height: 72vh;
        min-height: 520px;
    }

    .map-help-trigger span {
        display: none;
    }

    .map-help-trigger {
        width: 36px;
        height: 36px;
        justify-content: center;
        padding: 0;
    }
}

/* ========================================================================
   ABAN v3.8 — compact forecast selector + refined desktop workspace
   ======================================================================== */
.forecast-mode-switch {
    display: grid;
    grid-template-columns: auto repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 6px;
    margin-top: 9px;
    padding: 5px;
    border: 1px solid #d1e3ef;
    border-radius: 12px;
    background: linear-gradient(145deg, #eef8fd 0%, #e6f3fb 100%);
}

.forecast-mode-caption {
    padding: 0 5px;
    color: #718493;
    font-size: .61rem;
    font-weight: 800;
    white-space: nowrap;
}

.forecast-mode-tab {
    min-width: 0;
    min-height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 9px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #4f6d82;
    font-family: inherit;
    font-size: .68rem;
    font-weight: 900;
    cursor: pointer;
    transition: background .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.forecast-mode-tab i { font-size: .72rem; }
.forecast-mode-tab:hover { background: rgba(255,255,255,.82); color: #34566e; }
.forecast-mode-tab.active {
    background: rgba(255,255,255,.95);
    color: #2f6f99;
    border-color: #c8dde9;
    box-shadow: 0 3px 10px rgba(56, 75, 94, .10);
}
.forecast-mode-tab[data-forecast-mode-target="simple"].active {
    color: #1f7ea2;
    border-color: #bddceb;
}
.forecast-mode-tab:focus-visible {
    outline: 2px solid rgba(66, 112, 180, .28);
    outline-offset: 1px;
}

.forecast-mode-pane { display: none; }
.forecast-mode-pane.active { display: block; }
.forecast-mode-pane .forecast-section { margin-top: 9px; }

/* Desktop: make both the upper controls card and map card slightly narrower
   while preserving the enlarged v3.7 map height. */
@media (min-width: 1200px) {
    .container {
        width: min(90vw, 1500px);
        max-width: 1500px;
    }

    .top-dashboard-card .card-body {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    #map {
        height: 82vh;
        min-height: 650px;
    }
}

@media (max-width: 575.98px) {
    .forecast-mode-switch {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
    }
    .forecast-mode-caption { display: none; }
    .forecast-mode-tab { min-height: 34px; padding: 6px 5px; font-size: .62rem; }
}

/* ========================================================================
   ABAN v4.1 — map-contained compact point forecast popup
   The dashboard is docked inside the map instead of being anchored above a
   marker. This keeps the whole panel visible for northern/southern points and
   avoids zoom/pan gymnastics. The body scrolls independently from the map.
   ======================================================================== */
.aban-map-forecast-popup {
    position: absolute;
    z-index: 1250;
    top: 50%;
    width: min(430px, calc(100% - 92px));
    max-height: calc(100% - 92px);
    display: flex;
    flex-direction: column;
    direction: rtl;
    background: linear-gradient(180deg, rgba(244, 251, 255, .985) 0%, rgba(233, 246, 253, .975) 100%);
    border: 1px solid rgba(92, 148, 184, .26);
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(24, 78, 108, .18);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-50%) scale(.985);
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
    overflow: hidden;
}

.aban-map-forecast-popup.dock-left {
    left: 54px;
    right: auto;
}

.aban-map-forecast-popup.dock-right {
    right: 54px;
    left: auto;
}

.aban-map-forecast-popup.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
}

.aban-map-forecast-popup-toolbar {
    min-height: 37px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 9px 6px 7px;
    color: #466073;
    background: linear-gradient(135deg, #eef8fd 0%, #e4f2fb 52%, #eef9ff 100%);
    border-bottom: 1px solid #d3e6f3;
    font-size: .65rem;
    font-weight: 900;
}

.aban-map-forecast-popup-toolbar > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.aban-map-forecast-popup-toolbar > span i { color: #1887a8; }

.aban-map-forecast-popup-close {
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    display: grid;
    place-items: center;
    border: 1px solid #dce6ec;
    border-radius: 9px;
    background: rgba(255,255,255,.92);
    color: #5b7486;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}

.aban-map-forecast-popup-close:hover {
    color: #a73243;
    background: #fff5f6;
    border-color: #efcbd0;
    transform: scale(1.04);
}

.aban-map-forecast-popup-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding: 9px 10px 11px;
    scroll-behavior: smooth;
    background: linear-gradient(180deg, rgba(242,249,255,.75) 0%, rgba(235,246,252,.86) 100%);
}

.aban-map-forecast-popup-content::-webkit-scrollbar { width: 7px; }
.aban-map-forecast-popup-content::-webkit-scrollbar-track { background: transparent; }
.aban-map-forecast-popup-content::-webkit-scrollbar-thumb {
    background: #8cb8cf;
    border-radius: 99px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.aban-map-forecast-popup .aban-popup-dashboard {
    width: 100%;
    min-width: 0;
}

.aban-map-forecast-popup .forecast-point-header,
.aban-map-forecast-popup .forecast-mode-switch,
.aban-map-forecast-popup .forecast-section,
.aban-map-forecast-popup .ml-technical-details {
    background-clip: padding-box;
}

.aban-map-forecast-popup .forecast-point-header {
    gap: 8px;
    padding: 1px 1px 8px;
}

.aban-map-forecast-popup .forecast-point-header h3 { font-size: .96rem; }
.aban-map-forecast-popup .forecast-date-chip { padding: 4px 7px; font-size: .64rem; }

.aban-map-forecast-popup .forecast-mode-switch {
    position: sticky;
    top: -1px;
    z-index: 12;
    margin-top: 7px;
    box-shadow: 0 5px 12px rgba(35, 55, 72, .08);
}

.aban-map-forecast-popup .forecast-section {
    margin-top: 8px;
    padding: 9px;
    border-radius: 13px;
}

.aban-map-forecast-popup .forecast-section-head { margin-bottom: 7px; gap: 7px; }
.aban-map-forecast-popup .forecast-section-icon { width: 31px; height: 31px; flex-basis: 31px; }
.aban-map-forecast-popup .forecast-section-head h4 { font-size: .86rem; }
.aban-map-forecast-popup .forecast-section-head p { font-size: .62rem; }
.aban-map-forecast-popup .advanced-probability-grid { gap: 6px; }
.aban-map-forecast-popup .probability-card { min-height: 112px; padding: 9px; border-radius: 12px; }
.aban-map-forecast-popup .probability-card > strong { font-size: 1.34rem; }
.aban-map-forecast-popup .operational-probability-note,
.aban-map-forecast-popup .severity-card { margin-top: 7px; padding: 7px 8px; }
.aban-map-forecast-popup .advanced-event-block,
.aban-map-forecast-popup .advanced-days,
.aban-map-forecast-popup .environment-block { margin-top: 8px; padding: 8px; }
.aban-map-forecast-popup .advanced-day-row { padding: 3px 0; }
.aban-map-forecast-popup .ml-technical-details { margin-top: 7px; }

/* Long advanced subsections can be focused with one click. */
.popup-detail-block {
    position: relative;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, transform .15s ease;
}

/* v4.1.1 — every main information block in the contained popup now gives
   immediate visual feedback on hover. A click pins the emphasis and makes the
   block slightly larger without changing the data layout. */
.aban-map-forecast-popup .forecast-section {
    overflow: visible;
}

.popup-interactive-block {
    position: relative;
    cursor: pointer;
    outline: 0 solid transparent;
    transform-origin: center center;
    transition: transform .16s ease, box-shadow .16s ease, outline-color .16s ease,
                background-color .16s ease, border-color .16s ease, filter .16s ease;
}

.popup-interactive-block:hover,
.popup-interactive-block:focus-visible {
    z-index: 3;
    outline: 2px solid rgba(91, 74, 155, .20);
    outline-offset: 1px;
    box-shadow: 0 7px 18px rgba(55, 65, 105, .12);
    filter: saturate(1.035);
}

.popup-interactive-block.is-emphasized {
    z-index: 5;
    transform: translateY(-1px) scale(1.018);
    outline: 2px solid rgba(91, 74, 155, .38);
    outline-offset: 2px;
    box-shadow: 0 12px 28px rgba(67, 53, 121, .18);
    filter: saturate(1.06);
}

.popup-detail-block:hover {
    border-color: #c9bce5;
}

.popup-detail-block .advanced-subtitle { min-height: 24px; }

.popup-detail-focus-btn {
    margin-right: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border: 1px solid #ddd6eb;
    border-radius: 8px;
    background: rgba(255,255,255,.9);
    color: #6a5790;
    font-family: inherit;
    font-size: .52rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.popup-detail-focus-btn:hover,
.popup-detail-focus-btn.is-focused {
    color: #fff;
    background: #6650a3;
    border-color: #6650a3;
}

.forecast-advanced.popup-detail-mode > *:not(.popup-detail-focused):not(.forecast-section-head) {
    display: none !important;
}

.forecast-advanced.popup-detail-mode > .forecast-section-head {
    margin-bottom: 6px;
}

.forecast-advanced.popup-detail-mode > .popup-detail-focused {
    display: block !important;
    margin-top: 0;
    border-color: #bcaadd;
    background: #fff;
    box-shadow: 0 10px 24px rgba(77, 62, 122, .14);
}

/* Once popup-detail-mode is removed by «نمای کامل», all direct children return
   to their normal layout immediately. Keeping this rule explicit prevents any
   stale focused-state styling from visually collapsing the card. */
.forecast-advanced:not(.popup-detail-mode) > .popup-detail-block {
    display: block;
}

/* The old Leaflet popup styling is retained for unrelated Leaflet popups, but
   ABAN point forecasts are rendered in the contained panel above. */

@media (max-width: 900px) {
    .aban-map-forecast-popup {
        width: min(410px, calc(100% - 72px));
        max-height: calc(100% - 70px);
    }
    .aban-map-forecast-popup.dock-left { left: 44px; }
    .aban-map-forecast-popup.dock-right { right: 44px; }
}

@media (max-width: 575.98px) {
    .aban-map-forecast-popup,
    .aban-map-forecast-popup.dock-left,
    .aban-map-forecast-popup.dock-right {
        top: auto;
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
        max-height: 72%;
        border-radius: 16px;
        transform: translateY(12px) scale(.99);
    }
    .aban-map-forecast-popup.is-open {
        transform: translateY(0) scale(1);
    }
    .aban-map-forecast-popup-toolbar { min-height: 34px; }
    .aban-map-forecast-popup-content { padding: 7px 8px 9px; }
    .popup-detail-focus-btn span { display: none; }
    .popup-detail-focus-btn { width: 25px; height: 25px; padding: 0; justify-content: center; }
    .popup-interactive-block.is-emphasized { transform: translateY(-1px) scale(1.008); }
}

/* Selected point remains visually identifiable while its floating panel is open. */
.leaflet-interactive.aban-selected-marker {
    filter: drop-shadow(0 0 6px rgba(37, 121, 164, .78));
    stroke-width: 4px !important;
}

/* ===== ABAN V4.2 — area hydrology routing controls ===== */
.routing-animation-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border: 1px solid rgba(25, 118, 210, 0.18);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(240, 248, 255, 0.96), rgba(247, 250, 255, 0.96));
}
.routing-play-btn {
    min-width: 88px;
    border-radius: 9px;
    font-weight: 700;
}
.routing-time-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 360px;
    min-width: 240px;
}
.routing-time-slider {
    margin: 0;
    min-width: 150px;
}
.routing-time-label {
    min-width: 145px;
    padding: 5px 9px;
    border-radius: 8px;
    background: rgba(255,255,255,.9);
    border: 1px solid rgba(25,118,210,.12);
    color: #174f78;
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
    text-align: center;
}
.routing-method-badge {
    padding: 6px 10px;
    border-radius: 999px;
    background: #e8f5e9;
    color: #216b3d;
    border: 1px solid #c8e6c9;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: help;
}
.routing-animation-note {
    flex: 1 1 100%;
    color: #5d6d7e;
    font-size: .76rem;
    line-height: 1.7;
    padding-top: 1px;
}
.analysis-routing-summary {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-inline-start: 10px;
    padding-inline-start: 10px;
    border-inline-start: 1px solid rgba(0,0,0,.12);
    color: #245d72;
}
.routing-leaflet-tooltip {
    direction: rtl;
    text-align: right;
    border-radius: 10px !important;
    border: 1px solid rgba(25,118,210,.22) !important;
    box-shadow: 0 8px 22px rgba(0,0,0,.14) !important;
}
.routing-reach-tooltip {
    min-width: 190px;
    line-height: 1.7;
    font-size: 12px;
}
.routing-tooltip-live {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px dashed rgba(0,0,0,.15);
    color: #1565c0;
}

@media (max-width: 768px) {
    .routing-animation-controls { gap: 8px; padding: 8px; }
    .routing-time-wrap { flex-basis: 100%; min-width: 0; }
    .routing-time-label { min-width: 118px; font-size: .72rem; }
    .routing-method-badge { font-size: .7rem; }
    .analysis-routing-summary { display: flex; margin: 6px 0 0; padding: 6px 0 0; border-inline-start: 0; border-top: 1px solid rgba(0,0,0,.1); }
}


/* ===== ABAN V4.2.1 — directional flow arrows ===== */
.routing-arrow-toggle {
    border-radius: 9px;
    font-weight: 700;
    white-space: nowrap;
}
.routing-arrow-toggle.active {
    color: #fff;
    background: #0785a8;
    border-color: #0785a8;
    box-shadow: 0 4px 12px rgba(7,133,168,.18);
}
.routing-flow-arrow-marker {
    background: transparent !important;
    border: 0 !important;
    pointer-events: none !important;
}
.routing-flow-arrow {
    --routing-arrow-angle: 0deg;
    --routing-arrow-scale: 1;
    --routing-arrow-opacity: .72;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(var(--routing-arrow-angle)) scale(var(--routing-arrow-scale));
    transform-origin: center;
    opacity: var(--routing-arrow-opacity);
    transition: opacity .22s ease, filter .22s ease, color .22s ease;
    color: #0b78b5;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(255,255,255,.96), 0 0 4px rgba(255,255,255,.92);
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.14));
}
.routing-flow-arrow::before {
    content: "➤";
}
.routing-flow-arrow.is-dominant {
    color: #8e24aa;
    font-size: 20px;
}
.routing-flow-arrow.is-strong {
    color: #d81b60;
    filter: drop-shadow(0 1px 2px rgba(216,27,96,.28));
}
.routing-flow-arrow.is-dry {
    color: #607d8b;
}
.routing-calibration-state {
    display: inline-block;
    margin-inline-start: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(33,107,61,.18);
    font-size: .68rem;
    font-weight: 700;
}
@media (max-width: 768px) {
    .routing-arrow-toggle { font-size: .72rem; }
    .routing-flow-arrow { width: 18px; height: 18px; font-size: 15px; }
    .routing-flow-arrow.is-dominant { font-size: 17px; }
}

/* ===== ABAN V4.2.2 — zoom-responsive routing symbology ===== */
.routing-visual-legend {
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    gap: 8px 12px;
    flex-wrap: wrap;
    padding: 7px 9px;
    border-radius: 9px;
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(25,118,210,.10);
    color: #455a64;
    font-size: .70rem;
    line-height: 1.4;
}
.routing-legend-title {
    font-weight: 800;
    color: #174f78;
}
.routing-legend-item,
.routing-dominant-legend {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.routing-legend-item i {
    width: 20px;
    height: 5px;
    border-radius: 999px;
    background: var(--legend-color);
    box-shadow: 0 0 0 1px rgba(0,0,0,.05);
}
.routing-dominant-legend i {
    width: 24px;
    height: 5px;
    border-radius: 999px;
    background: #1e88e5;
    box-shadow: 0 0 0 3px rgba(126,87,194,.30);
}

/* Arrow colour now follows the same discharge-intensity palette as the reaches.
   Dominant routing is conveyed by size + violet halo rather than a second colour scale. */
.routing-flow-arrow {
    --routing-arrow-color: #90caf9;
    width: 40px;
    height: 40px;
    color: var(--routing-arrow-color);
    transition: opacity .20s ease, filter .20s ease, color .20s ease, transform .20s ease;
}
.routing-flow-arrow.is-dominant {
    color: var(--routing-arrow-color);
    font-size: 20px;
    text-shadow:
        0 1px 2px rgba(255,255,255,.98),
        0 0 4px rgba(255,255,255,.94),
        0 0 5px rgba(126,87,194,.72),
        0 0 8px rgba(126,87,194,.40);
}
.routing-flow-arrow.is-strong {
    color: var(--routing-arrow-color);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.22));
}
.routing-flow-arrow.is-dry {
    --routing-arrow-color: #78909c;
    color: #78909c;
    filter: saturate(.55) drop-shadow(0 1px 1px rgba(0,0,0,.12));
}

@media (max-width: 768px) {
    .routing-visual-legend { gap: 6px 9px; padding: 6px 7px; font-size: .64rem; }
    .routing-legend-item i { width: 16px; }
    .routing-dominant-legend i { width: 19px; }
    .routing-flow-arrow { width: 34px; height: 34px; font-size: 15px; }
    .routing-flow-arrow.is-dominant { font-size: 17px; }
}

/* ABAN v4.3.9 — lazy daily/hourly precipitation charts inside point popup */
.popup-rain-chart {
    margin: 8px 0 2px;
    border: 1px solid rgba(83, 162, 202, .24);
    border-radius: 13px;
    background: linear-gradient(145deg, rgba(239, 250, 255, .92), rgba(224, 244, 252, .86));
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.popup-rain-chart:hover,
.popup-rain-chart.is-open {
    border-color: rgba(42, 145, 193, .46);
    box-shadow: 0 5px 16px rgba(36, 112, 151, .08), inset 0 1px 0 rgba(255,255,255,.82);
}

.popup-rain-chart-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #234d67;
    text-align: right;
    cursor: pointer;
}

.popup-rain-chart-toggle:focus-visible {
    outline: 2px solid rgba(31, 132, 181, .46);
    outline-offset: -2px;
}

.popup-rain-chart-icon {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(145deg, #d7f1fb, #bfe7f6);
    color: #187da3;
}

.popup-rain-chart-title {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.popup-rain-chart-title strong { font-size: .73rem; font-weight: 900; color: #1d516d; }
.popup-rain-chart-title small { font-size: .58rem; color: #6b899b; }
.popup-rain-chart-chevron { color: #4387a8; transition: transform .2s ease; }
.popup-rain-chart.is-open .popup-rain-chart-chevron { transform: rotate(180deg); }

.popup-rain-chart-panel {
    border-top: 1px solid rgba(100, 174, 207, .20);
    padding: 9px;
    background: rgba(248, 253, 255, .68);
}

.rain-chart-loading,
.rain-chart-empty {
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #5f8194;
    font-size: .64rem;
    text-align: center;
}
.rain-chart-empty i { color: #4492b7; }

.rain-chart-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.rain-chart-tabs {
    display: inline-flex;
    padding: 2px;
    border-radius: 9px;
    background: #e7f4fa;
    border: 1px solid #d1e8f2;
}
.rain-chart-tab {
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #567788;
    padding: 5px 9px;
    font-size: .59rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}
.rain-chart-tab i { margin-left: 3px; }
.rain-chart-tab.active {
    background: rgba(255,255,255,.94);
    color: #126f98;
    box-shadow: 0 2px 7px rgba(28, 94, 126, .10);
}

.rain-chart-day-control {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6b8492;
    font-size: .56rem;
    white-space: nowrap;
}
.rain-chart-day-control[hidden] { display: none !important; }
.rain-chart-day-select {
    border: 1px solid #d3e7f0;
    border-radius: 8px;
    background: rgba(255,255,255,.90);
    color: #315c72;
    padding: 4px 6px;
    font-size: .58rem;
    min-width: 94px;
}

.rain-chart-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-bottom: 5px;
}
.rain-chart-summary > div {
    min-width: 0;
    padding: 6px 5px;
    border-radius: 9px;
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(197, 226, 238, .82);
    text-align: center;
}
.rain-chart-summary span { display: block; color: #708997; font-size: .50rem; }
.rain-chart-summary strong { display: block; margin-top: 1px; color: #165e80; font-size: .67rem; }
.rain-chart-summary small { display: block; color: #8a9aa4; font-size: .46rem; margin-top: 1px; }

.rain-chart-svg-wrap {
    width: 100%;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(239,249,253,.86));
    border: 1px solid rgba(201, 228, 239, .76);
    overflow: hidden;
}
.rain-bar-svg { display: block; width: 100%; height: auto; aspect-ratio: 560 / 218; }
.rain-chart-grid { stroke: #dcebf2; stroke-width: 1; }
.rain-chart-y-label,
.rain-chart-x-label,
.rain-chart-unit,
.rain-chart-value {
    fill: #78909c;
    font-family: inherit;
    font-size: 10px;
}
.rain-chart-unit { fill: #4f7e96; font-size: 9px; font-weight: 700; }
.rain-chart-value { fill: #246c8e; font-size: 9px; font-weight: 700; }
.rain-chart-bar {
    fill: #55acd1;
    opacity: .86;
    transition: opacity .15s ease;
}
.rain-chart-bar:hover { opacity: 1; }
.rain-chart-bar.is-selected {
    fill: #197aa6;
    opacity: 1;
}

.rain-chart-note {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    margin-top: 6px;
    padding: 6px 7px;
    border-radius: 8px;
    color: #6c8796;
    background: rgba(224, 243, 251, .62);
    font-size: .52rem;
    line-height: 1.55;
}
.rain-chart-note i { color: #3188ae; margin-top: 2px; }

@media (max-width: 575.98px) {
    .popup-rain-chart-toggle { padding: 7px 8px; }
    .popup-rain-chart-panel { padding: 7px; }
    .rain-chart-controls { align-items: stretch; flex-direction: column; }
    .rain-chart-tabs { align-self: stretch; }
    .rain-chart-tab { flex: 1; }
    .rain-chart-day-control { justify-content: space-between; }
    .rain-chart-day-select { flex: 1; }
    .rain-chart-summary { gap: 4px; }
    .rain-chart-summary > div { padding: 5px 3px; }
    .rain-bar-svg { height: auto; }
}

/* ABAN v4.3.11 — precipitation-probability consistency + expandable popup charts */
.rain-chart-summary small.is-derived {
    color: #9a6a13;
    font-weight: 800;
}
.rain-chart-summary small.is-derived i { margin-left: 2px; }

.rain-probability-consistency-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 5px 0 7px;
    padding: 6px 8px;
    border: 1px solid rgba(211, 165, 59, .28);
    border-radius: 9px;
    background: rgba(255, 248, 221, .78);
    color: #795c22;
    font-size: .52rem;
    line-height: 1.6;
}
.rain-probability-consistency-note i {
    color: #b98218;
    margin-top: 2px;
    flex: 0 0 auto;
}

.rain-chart-svg-wrap[data-rain-chart-expand="1"] {
    position: relative;
    cursor: zoom-in;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.rain-chart-svg-wrap[data-rain-chart-expand="1"]:hover {
    border-color: rgba(36, 139, 187, .48);
    box-shadow: 0 5px 15px rgba(33, 106, 141, .10);
}
.rain-chart-expand-cue {
    position: absolute;
    left: 7px;
    top: 7px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 7px;
    background: rgba(247, 253, 255, .90);
    border: 1px solid rgba(119, 185, 214, .33);
    color: #367d9d;
    font-size: .46rem;
    font-weight: 800;
    pointer-events: none;
    backdrop-filter: blur(3px);
}
.rain-chart-bar.has-derived-probability {
    stroke: rgba(194, 137, 24, .85);
    stroke-width: 1.2;
}

.rain-chart-expanded-overlay {
    position: absolute;
    inset: 10px;
    z-index: 1700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    border-radius: 12px;
    background: rgba(18, 54, 75, .30);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.rain-chart-expanded-dialog {
    width: min(980px, calc(100% - 20px));
    max-height: calc(100% - 20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    direction: rtl;
    background: linear-gradient(180deg, rgba(247, 253, 255, .99), rgba(231, 246, 253, .99));
    border: 1px solid rgba(85, 158, 194, .42);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(14, 57, 82, .24);
}
.rain-chart-expanded-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(134, 190, 216, .30);
    background: linear-gradient(135deg, #eaf8fe, #dff2fb);
    color: #255a73;
}
.rain-chart-expanded-header > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rain-chart-expanded-header strong {
    font-size: .90rem;
    font-weight: 900;
}
.rain-chart-expanded-header strong i { color: #248ab4; margin-left: 5px; }
.rain-chart-expanded-header small { color: #698899; font-size: .68rem; }
.rain-chart-expanded-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border: 1px solid #cee4ee;
    border-radius: 10px;
    background: rgba(255,255,255,.94);
    color: #4c7184;
    cursor: pointer;
}
.rain-chart-expanded-close:hover { color: #a43142; border-color: #e8c6cc; }
.rain-chart-expanded-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 12px;
}
.rain-chart-expanded-body .rain-chart-summary {
    max-width: 760px;
    margin: 0 auto 8px;
}
.rain-chart-expanded-body .rain-probability-consistency-note {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    font-size: .66rem;
}
.rain-chart-svg-wrap.is-expanded {
    max-width: 940px;
    margin: 0 auto;
    background: rgba(255,255,255,.96);
    border-color: rgba(140, 194, 218, .56);
    cursor: default;
}
.rain-bar-svg.is-expanded { width: 100%; height: auto; }
.rain-chart-expanded-body .rain-chart-y-label,
.rain-chart-expanded-body .rain-chart-x-label { font-size: 12px; }
.rain-chart-expanded-body .rain-chart-value { font-size: 11px; }
.rain-chart-expanded-body .rain-chart-unit { font-size: 11px; }
.rain-chart-expanded-body .rain-chart-note {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    font-size: .62rem;
}

@media (max-width: 767.98px) {
    .rain-chart-expanded-overlay { inset: 4px; padding: 5px; }
    .rain-chart-expanded-dialog { width: 100%; max-height: 96%; border-radius: 13px; }
    .rain-chart-expanded-header { padding: 8px 9px; }
    .rain-chart-expanded-header strong { font-size: .76rem; }
    .rain-chart-expanded-body { padding: 8px; }
    .rain-chart-expanded-body .rain-chart-summary { gap: 4px; }
    .rain-chart-expand-cue { font-size: .42rem; }
}

/* ===== Flood-area analysis date range (1..7 days) ===== */
.flood-analysis-range {
    border: 1px solid rgba(38, 166, 154, .28);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}
.flood-analysis-range-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    color: #175d56;
    font-size: .82rem;
    font-weight: 800;
}
.flood-analysis-range-title span {
    margin-right: auto;
    padding: 2px 7px;
    border-radius: 999px;
    background: #e4f5f2;
    color: #377a73;
    font-size: .67rem;
    font-weight: 700;
}
.flood-analysis-range-fields {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
    gap: 9px;
    align-items: end;
}
.flood-analysis-range-fields > label {
    margin: 0;
    min-width: 0;
    color: #3b5f5b;
    font-size: .72rem;
    font-weight: 700;
}
.flood-analysis-range-fields .jalali-date-field { margin-top: 4px; }
.flood-analysis-range-fields #floodAreaDefaultWeekBtn {
    min-height: 31px;
    white-space: nowrap;
}
.flood-analysis-range-help {
    margin-top: 7px;
    color: #607d79;
    font-size: .66rem;
    line-height: 1.75;
}
.flood-analysis-range-help i { color: #26988d; margin-left: 4px; }
.analysis-period-method {
    display: inline-block;
    margin-right: 7px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #e5f6f3;
    color: #236e66;
    font-size: .68rem;
    font-weight: 700;
}

@media (max-width: 768px) {
    .flood-analysis-range { padding: 9px; }
    .flood-analysis-range-fields { grid-template-columns: 1fr; }
    .flood-analysis-range-fields #floodAreaDefaultWeekBtn { width: 100%; }
    .flood-analysis-range-title { font-size: .76rem; }
    .flood-analysis-range-help { font-size: .62rem; }
}

/* ABAN custom-point dedicated report action */
.custom-point-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.custom-point-result-header h6 { margin: 0; }
.custom-point-result-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: nowrap;
    margin-inline-start: auto;
    margin-left: 2px;
    direction: rtl;
}
#customPointPdfBtn,
#customPointRawBtn {
    white-space: nowrap;
}
#customPointRawBtn {
    margin-left: 0;
}

@media (max-width: 768px) {
    .custom-point-result-header {
        align-items: stretch;
    }
    .custom-point-result-actions {
        width: 100%;
        margin-inline-start: 0;
        gap: 7px;
        flex-wrap: wrap;
    }
    #customPointPdfBtn,
    #customPointRawBtn {
        flex: 1 1 220px;
    }
}


/* ========================================================================
   ABAN map usability — high-contrast station markers, roomier custom-point
   action, and place/coordinate search beside the Leaflet basemap selector.
   ======================================================================== */

/*
 * Draw the marker as two independent masked layers: a slightly enlarged
 * black silhouette below the coloured marker.  This produces a real,
 * continuous outline even when the precipitation colour is pure white.
 * The selectors intentionally outrank the older inline marker-mask rules.
 */
.leaflet-marker-icon.aban-station-marker-shell .aban-station-marker-glyph {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    overflow: visible !important;
    background: transparent !important;
    -webkit-mask: none !important;
    mask: none !important;
    filter: none !important;
}

.leaflet-marker-icon.aban-station-marker-shell .aban-station-marker-glyph::before,
.leaflet-marker-icon.aban-station-marker-shell .aban-station-marker-glyph::after {
    content: "";
    position: absolute;
    inset: 0;
    display: block;
    pointer-events: none;
    transform-origin: 50% 50%;
    -webkit-mask: url('/staticImages/station-marker.png') center / contain no-repeat;
    mask: url('/staticImages/station-marker.png') center / contain no-repeat;
}

.leaflet-marker-icon.aban-station-marker-shell .aban-station-marker-glyph::before {
    z-index: 1;
    background: #111 !important;
    transform: scale(1.085);
}

.leaflet-marker-icon.aban-station-marker-shell .aban-station-marker-glyph::after {
    z-index: 2;
    background: var(--aban-marker-color, #607d8b) !important;
    transform: scale(1);
}

.leaflet-marker-icon.aban-custom-station-marker-shell .aban-station-marker-glyph::before,
.leaflet-marker-icon.aban-custom-station-marker-shell .aban-station-marker-glyph::after {
    -webkit-mask-image: url('/staticImages/station-markerCustom.png');
    mask-image: url('/staticImages/station-markerCustom.png');
}

.leaflet-marker-icon.aban-selected-marker .aban-station-marker-glyph {
    filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 7px #087cca) !important;
}

/* Give the custom-point action enough room for its longer runtime labels. */
.action-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(180px, 1.32fr) repeat(2, minmax(0, 1fr));
}
.action-buttons #customPointBtn {
    min-width: 180px;
}
.action-buttons #customPointBtn span {
    overflow: visible;
    text-overflow: clip;
}

/* Search widget floats inside the map, immediately left of the layer switcher. */
.aban-map-search {
    --aban-map-search-right: 180px;
    position: absolute;
    top: 10px;
    right: var(--aban-map-search-right);
    z-index: 1002;
    width: min(340px, calc(100% - var(--aban-map-search-right) - 14px));
    min-width: 180px;
    direction: rtl;
    font-family: 'Tahoma', 'Vazirmatn', Arial, sans-serif;
}

.aban-map-search-form {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: 42px;
    overflow: hidden;
    /* Match the compact Google-Earth-like reference: clean white card,
       subtle neutral border and a restrained shadow.  LTR flex order puts
       the search button on the RIGHT while the Persian input stays RTL. */
    direction: ltr;
    border: 1px solid rgba(94, 87, 75, .42);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 5px rgba(43, 35, 25, .24);
}

.aban-map-search-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 42px;
    padding: 7px 13px;
    border: 0;
    outline: 0;
    background: #fff;
    color: #344b5d;
    font: inherit;
    font-size: .82rem;
    line-height: 1.5;
    direction: rtl;
    text-align: right;
}

.aban-map-search-input::placeholder {
    color: #8b969e;
    opacity: 1;
}

.aban-map-search-button {
    flex: 0 0 42px;
    width: 42px;
    border: 0;
    border-left: 1px solid #d8dde1;
    background: #fff;
    color: #1976d2;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1rem;
}

.aban-map-search-button:hover,
.aban-map-search-button:focus-visible {
    background: #eef7ff;
    color: #0d5ba9;
    outline: none;
}

.aban-map-search.is-loading .aban-map-search-button i {
    animation: abanMapSearchSpin .75s linear infinite;
}
@keyframes abanMapSearchSpin { to { transform: rotate(360deg); } }

.aban-map-search-results {
    display: none;
    width: 100%;
    max-height: 290px;
    margin-top: 5px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid #d8e3eb;
    border-radius: 9px;
    background: rgba(255,255,255,.99);
    box-shadow: 0 8px 24px rgba(26, 53, 75, .20);
}
.aban-map-search-results.is-open { display: block; }

.aban-map-search-result,
.aban-map-search-message {
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid #edf2f5;
    background: transparent;
    color: #23445c;
    text-align: right;
    font-family: inherit;
    font-size: .78rem;
    line-height: 1.65;
}
.aban-map-search-result {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}
.aban-map-search-result:last-child,
.aban-map-search-message:last-child { border-bottom: 0; }
.aban-map-search-result:hover,
.aban-map-search-result:focus-visible,
.aban-map-search-result.is-active {
    background: #eef7ff;
    outline: none;
}
.aban-map-search-result i {
    flex: 0 0 18px;
    margin-top: 3px;
    color: #1976d2;
    text-align: center;
}
.aban-map-search-result-text {
    flex: 1 1 auto;
    min-width: 0;
}
.aban-map-search-result-title {
    display: block;
    color: #173b56;
    font-weight: 800;
}
.aban-map-search-result-detail {
    display: block;
    margin-top: 1px;
    color: #6e8290;
    font-size: .70rem;
}
.aban-map-search-message {
    color: #738693;
    cursor: default;
}
.aban-map-search-message.is-error { color: #a4313c; }

@media (max-width: 991.98px) {
    .action-buttons {
        grid-template-columns: repeat(3, minmax(105px, 1fr)) minmax(170px, 1.35fr) repeat(2, minmax(105px, 1fr));
    }
    .aban-map-search { width: min(310px, calc(100% - var(--aban-map-search-right) - 12px)); }
}

@media (max-width: 575.98px) {
    .action-buttons { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .action-buttons #customPointBtn { grid-column: span 2; min-width: 0; }
    .aban-map-search {
        top: 8px;
        min-width: 150px;
        width: min(270px, calc(100% - var(--aban-map-search-right) - 8px));
    }
    .aban-map-search-input { font-size: .74rem; padding-right: 8px; padding-left: 8px; }
    .aban-map-search-button { flex-basis: 38px; width: 38px; }
}

/* ========================================================================
   ABAN map basemap selector — third imagery source + mobile-safe layout
   ======================================================================== */
/* Keep the expanded selector compact now that three basemaps are available. */
.leaflet-control-layers-expanded {
    max-width: 190px;
}
.leaflet-control-layers-expanded .leaflet-control-layers-base label {
    white-space: normal;
    line-height: 1.45;
}

@media (max-width: 575.98px) {
    /* Reserve a predictable strip on the right for the Leaflet layer selector.
       This keeps the search field and the expanded three-item selector from
       overlapping on mobile screens. */
    .aban-map-search {
        --aban-map-search-right: 150px;
        min-width: 0;
        width: calc(100% - var(--aban-map-search-right) - 10px);
    }
    .leaflet-control-layers {
        font-size: .78rem !important;
    }
    .leaflet-control-layers label {
        font-size: .78rem !important;
        margin-bottom: 2px;
    }
    .leaflet-control-layers-expanded {
        max-width: 142px;
        padding: 6px 7px;
    }
}


/* ========================================================================
   ABAN — About Nadir modal + seven-button action bar
   ======================================================================== */
.action-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(180px, 1.32fr) repeat(3, minmax(0, 1fr));
}

.action-buttons #aboutUsBtn {
    background: linear-gradient(135deg, #455a64 0%, #263238 100%);
    border-color: rgba(255,255,255,.34);
}

.aban-about-modal { z-index: 1065; }
.aban-about-modal + .modal-backdrop,
.modal-backdrop.show { opacity: .66; }

.aban-about-modal .modal-dialog {
    width: min(94vw, 520px);
    margin-inline: auto;
}

.aban-about-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 24px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 28px 70px rgba(3, 22, 39, .34);
    direction: rtl;
}

.aban-about-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 6px;
    background: linear-gradient(90deg, #0d6efd, #00a8cc, #0d6efd);
}

.aban-about-card .modal-body { padding: 30px 30px 24px; }

.aban-about-close {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 2;
    margin: 0;
}

.aban-about-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    gap: 10px;
    padding: 0 38px;
    margin: 0 auto 22px;
}

.aban-about-logo {
    width: 82px;
    height: 82px;
    object-fit: contain;
    border-radius: 18px;
    filter: drop-shadow(0 8px 14px rgba(21, 62, 92, .18));
}

.aban-about-brand h2 {
    margin: 0;
    color: #173b57;
    font-size: 1.28rem;
    font-weight: 800;
    line-height: 1.5;
}

.aban-about-contacts {
    display: grid;
    gap: 10px;
}

.aban-about-contact {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-height: 46px;
    padding: 9px 13px;
    border: 1px solid #e0e9ef;
    border-radius: 12px;
    background: #f8fbfd;
    color: #24485f;
    text-decoration: none;
    font-size: .91rem;
    overflow-wrap: anywhere;
}

.aban-about-contact:hover {
    background: #eef7fb;
    color: #0b6fa4;
    border-color: #c8e2ee;
}

.aban-about-contact i {
    width: 24px;
    text-align: center;
    color: #117aa8;
    font-size: 1.05rem;
}

.aban-about-tagline {
    margin: 18px 0 0;
    padding-top: 14px;
    border-top: 1px solid #e5edf2;
    color: #31556d;
    font-size: .88rem;
    font-weight: 700;
    line-height: 1.8;
    text-align: center;
}

@media (max-width: 991.98px) {
    .action-buttons {
        grid-template-columns: repeat(3, minmax(105px, 1fr)) minmax(170px, 1.35fr) repeat(3, minmax(105px, 1fr));
    }
}

@media (max-width: 575.98px) {
    .action-buttons { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .aban-about-card .modal-body { padding: 26px 20px 20px; }
    .aban-about-logo { width: 70px; height: 70px; }
    .aban-about-brand h2 { font-size: 1.12rem; }
    .aban-about-contact { font-size: .82rem; }
}
