/* ==================== CSS CUSTOM PROPERTIES ====================
               All shared design tokens live here so changing one value
               propagates consistently across every component. */
:root {
    --primary: #0ea5e9;
    /* Sky-blue accent */
    --danger: #ef4444;
    /* Red — alerts / sirens */
    --success: #22c55e;
    /* Green — all-clear / news */
    --warning: #eab308;
    /* Yellow — timestamps / caution */
    --glass: rgba(16, 26, 44, 0.68);
    /* Frosted-glass card fill */
    --glass-border: rgba(148, 163, 184, 0.2);
    /* Frosted-glass card border */
    --surface-1: #0d1b2d;
    --surface-2: #10223a;
    --text-strong: #f8fbff;
    --text-soft: #9eb1c8;
    --radius-lg: 22px;
    --radius-md: 16px;
    --font-body: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
    --font-display: "Space Grotesk", "Plus Jakarta Sans", system-ui, sans-serif;
}

/* ==================== BASE / RESET ====================
               Dark-theme foundation applied to the entire page. */
html {
    font-size: 1rem;
    /* Slightly smaller base for dense data tables */
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    background: radial-gradient(circle at 12% 14%, rgba(14, 165, 233, 0.2), transparent 36%), radial-gradient(circle at 86% 20%, rgba(59, 130, 246, 0.16), transparent 34%), radial-gradient(circle at 52% 100%, rgba(14, 116, 144, 0.24), transparent 45%), linear-gradient(125deg, #071120 0%, #0b182c 52%, #0b1f37 100%);
    color: #e2e8f0;
    font-family: var(--font-body);
    min-height: 100vh;
    height: 100%;
    margin: 0;
    padding: 0;
    letter-spacing: 0.01em;
    position: relative;
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    width: 46rem;
    height: 46rem;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(70px);
    z-index: 0;
    opacity: 0.22;
}

body::before {
    top: -22rem;
    left: -12rem;
    background: radial-gradient(circle at 35% 35%, #22d3ee 0%, #0ea5e9 50%, transparent 75%);
}

body::after {
    right: -14rem;
    bottom: -26rem;
    background: radial-gradient(circle at 40% 40%, #3b82f6 0%, #2563eb 45%, transparent 75%);
}

.container-fluid {
    position: relative;
    z-index: 1;

    margin-inline: auto;
}

/* Map container must have explicit height for Google Maps to render correctly. */
#map {
    height: 100%;
}

.adv-marker {
    --marker-color: #ef4444;
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: var(--marker-color);
    border: 2px solid #ffffff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.adv-marker::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    transform: translate(-50%, -50%) rotate(45deg);
    border-radius: 50%;
    background: #ffffff;
}

.adv-marker--missiles {
    --marker-color: #ef4444;
}

.adv-marker--hostileAircraftIntrusion {
    --marker-color: #3b82f6;
}

.adv-marker--default {
    --marker-color: #ef4444;
}

/* ==================== LINKS ====================
               Strip browser default underline/blue from every <a> tag;
               a subtle opacity fade on hover replaces the color change. */
a {
    color: inherit;
    /* Keeps current text color */
    text-decoration: none;
    /* Removes underline */
    transition:
        color 0.2s ease,
        opacity 0.2s ease;
}

a:hover {
    color: inherit;
    /* Prevents color change on hover */
    text-decoration: none;
}

/* Optional: If you want a subtle hover effect (recommended for better UX) */
a:hover {
    opacity: 0.85;
    /* Light fade on hover instead of color change */
}

/* ==================== CARD (GLASSMORPHISM) ====================
               Every panel uses a frosted-glass look: semi-transparent fill
               blurred with backdrop-filter, soft border, and deep shadow.  */
.card {
    background: var(--glass);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow:
        0 12px 36px rgba(2, 7, 18, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
    /* Required so child table rows don't escape rounded corners */
    transition:
        transform 0.26s ease,
        box-shadow 0.26s ease,
        border-color 0.26s ease;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(148, 163, 184, 0.32);
    box-shadow:
        0 18px 44px rgba(2, 7, 18, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.card-header {
    border-bottom: 1px solid var(--glass-border);
    padding: 14px 18px;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.015em;
    font-family: var(--font-display);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.section-header {
    text-wrap: balance;
}

.section-header i,
.card-header i {
    filter: drop-shadow(0 2px 6px rgba(2, 6, 23, 0.45));
}

/* ==================== TABLES ====================
               Bootstrap tables need several overrides to fit the dark glass
               theme and to round the corners of the first/last rows correctly. */
.table-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    /* Clips table corners to match card rounding */
}

.table {
    margin-bottom: 0;
    border-collapse: separate;
    /* Must be 'separate', not 'collapse', for border-radius to apply to cells */
    border-spacing: 0;
    /* Separate + zero spacing mimics collapse without losing radius support */
}

.table thead tr {
    background: rgba(0, 0, 0, 0.4);
}

.table th {
    color: var(--text-soft);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    padding: 14px 12px;
    border: none;
    background: rgba(2, 6, 23, 0.46);
    position: sticky;
    top: 0;
    z-index: 2;
}

.table td {
    padding: 11px 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.11);
    border-bottom: none;
    vertical-align: middle;
    color: #d8e3f0;
}

.table-dark {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.015);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
    --bs-table-color: #d8e3f0;
}

.table tbody tr {
    transition:
        background-color 0.22s ease,
        transform 0.22s ease;
}

/* Round only the four outer corners of the table body —
               inner cells stay square so borders align correctly.      */
.table tbody tr:first-child td:first-child {
    border-start-start-radius: 16px;
}

.table tbody tr:first-child td:last-child {
    border-start-end-radius: 16px;
}

.table tbody tr:last-child td:first-child {
    border-end-start-radius: 16px;
}

.table tbody tr:last-child td:last-child {
    border-end-end-radius: 16px;
}

.table-dark tr:hover {
    background: rgba(255, 255, 255, 0.07) !important;
}

/* Colored headers */
/*
                .header-danger {
                    background: linear-gradient(90deg, #7f1d1d, #b91c1c);
                }

                .header-primary {
                    background: linear-gradient(90deg, #1e40af, #1e3a8a);
                }

                .header-success {
                    background: linear-gradient(90deg, #166534, #15803d);
                }
                */

/* ==================== SECTION HEADER VARIANTS ====================
               Applied to .card-header elements to colour-code each dashboard panel:
               danger (red) = active alerts,  primary (blue) = summary,
               success (green) = news feed.                                        */
.header-danger {
    background: linear-gradient(135deg, #8f1f1f 0%, #b91c1c 52%, #dc2626 100%);
    /* Red — Pikud HaOref / map alert panels */
}

.header-primary {
    background: linear-gradient(135deg, #1d3f91 0%, #1e40af 54%, #2563eb 100%);
    /* Dark blue — Alerts Summary panel */
}

.header-success {
    background: linear-gradient(135deg, #0f6c34 0%, #15803d 54%, #16a34a 100%);
    /* Green — News Updates panel */
}

.header-dark {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 54%, #334155 100%);
    /* Neutral slate — low-emphasis utility panels */
}

/* ==================== CLOCK & STAT DISPLAY ====================
               .live-clock  — pill badge in the alert panel header showing HH:MM:SS
               .stat-number — large bold number used in the Summary counter table */
.live-clock {
    letter-spacing: 0.08em;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 999px;
}

.stat-number {
    font-size: 1.36rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text-strong);
    text-shadow: 0 2px 14px rgba(15, 23, 42, 0.42);
}

/* ==================== MODALS ====================
               Dark modal content override for Bootstrap's default white background. */
.modal-content {
    background: linear-gradient(165deg, rgba(13, 27, 45, 0.97) 0%, rgba(16, 34, 58, 0.94) 100%);
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: var(--radius-lg);
    box-shadow: 0 22px 60px rgba(2, 6, 23, 0.56);
}

/* ==================== RSS FEED SCROLL AREA ====================
               Constrains the news table height to 38% of the viewport so it
               doesn't push the map off-screen on smaller displays.    */

.scrollable::-webkit-scrollbar {
    width: 6px;
}

.scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 20px;
}

.tile {
    /* Utility class for scrollable card bodies */
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 146, 173, 0.5) transparent;
}

.tile::-webkit-scrollbar {
    width: 8px;
}

.tile::-webkit-scrollbar-thumb {
    background: rgba(124, 146, 173, 0.5);
    border-radius: 999px;
}

/* ==================== ICON BUTTONS & COLLAPSE CHEVRON ====================
               .icon-btn       — subtle scale+rotate pop on hover for clickable icons
               .collapse-icon  — chevron that rotates -90° when its section is collapsed */
.icon-btn {
    transition: all 0.25s ease;
}

.icon-btn:hover {
    transform: translateY(-1px) scale(1.12) rotate(6deg);
    filter: brightness(1.24);
}

.collapse-icon {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.collapsed .collapse-icon {
    transform: rotate(-90deg);
    /* Points left when panel is collapsed */
}

/* ==================== INTERACTIVE SUMMARY ICONS ====================
                Test Mode, Fullscreen, and Settings icons in the Summary panel get
                a more pronounced hover effect to indicate they're clickable. */

#sound_alerts_icon:hover {
    transform: scale(1.15);
    cursor: pointer;
    transition: all 0.3s ease;
}

#test_mode_icon:hover {
    transform: scale(1.15);
    cursor: pointer;
    transition: all 0.3s ease;
}

#fullscreen_icon:hover {
    transform: scale(1.15);
    cursor: pointer;
    transition: all 0.3s ease;
}

#open_settings_icon:hover {
    transform: scale(1.15) rotate(20deg);
    cursor: pointer;
    transition: all 0.3s ease;
}

#clear_pikud_history_icon:hover {
    transform: scale(1.15);
    cursor: pointer;
    transition: all 0.3s ease;
}

#update_app_version_icon:hover {
    transform: scale(1.15) rotate(20deg);
    cursor: pointer;
    transition: all 0.3s ease;
}

/* General icon button improvements */
.icon-btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== GLASS MODALS ====================
               Deep-navy frosted glass applied to early-warning, error,
               unmatched-city, and settings modals.                      */
.glass-modal {
    background: rgba(6, 37, 91, 0.95);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
    color: white;
}

.glass-inner {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

#earlyWarningModalEnter {
    --bs-modal-margin: 0;
}

#earlyWarningModalEnter .modal-dialog {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    width: min(42rem, calc(100vw - 2rem));
    max-width: none;
    margin: 0;
    transform: none;
}

#earlyWarningModalEnter .modal-content {
    max-height: calc(100vh - 1rem);
    overflow: hidden;
    min-height: 0;
}

#earlyWarningModalEnter .modal-body {
    overflow: hidden;
}

#earlyWarningModalEnter .glass-inner {
    max-height: calc(100vh - 11rem);
    overflow: hidden;
}

#earlyWarningLocations {
    max-height: min(42vh, 820px);
    overflow-y: auto;
    padding-right: 0.4rem;
    word-break: break-word;
}

@media (max-width: 991.98px) {
    #earlyWarningModalEnter .modal-dialog {
        bottom: 0.75rem;
        left: 0.75rem;
        width: calc(100vw - 1.5rem);
    }

    #earlyWarningModalEnter .modal-content {
        max-height: calc(100vh - 0.75rem);
    }

    #earlyWarningModalEnter .glass-inner {
        max-height: calc(100vh - 10.5rem);
    }

    #earlyWarningLocations {
        max-height: 42vh;
    }
}

#earlyWarningModalExit {
    --bs-modal-margin: 0;
}

#earlyWarningModalExit .modal-dialog {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    width: min(42rem, calc(100vw - 2rem));
    max-width: none;
    margin: 0;
    transform: none;
}

#earlyWarningModalExit .modal-content {
    min-height: 0;
}

@media (max-width: 991.98px) {
    #earlyWarningModalExit .modal-dialog {
        bottom: 0.75rem;
        left: 0.75rem;
        width: calc(100vw - 1.5rem);
    }
}

/* Force early-warning modals to bottom-right in Hebrew mode.
We use physical right/bottom anchors to avoid ambiguity with logical
properties and Bootstrap's modal centering defaults. */
#earlyWarningModalEnter .modal-dialog.modal-dialog-end,
#earlyWarningModalExit .modal-dialog.modal-dialog-end {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    left: auto;
    margin: 0;
}
@media (min-width: 576px) {
    #earlyWarningModalEnter .modal-dialog.modal-dialog-end,
    #earlyWarningModalExit .modal-dialog.modal-dialog-end {
        right: 1.75rem;
        bottom: 1.75rem;
    }
}


/* ==================== CITY AUTOCOMPLETE DROPDOWN ====================
               Dropdown list that appears below the city search input in Settings. */
#city_suggestions .list-group-item {
    background: rgba(15, 23, 42, 0.95);
    border: none;
    color: #e2e8f0;
    padding: 12px 16px;
}

#city_suggestions .list-group-item:hover {
    background: rgba(59, 130, 246, 0.35);
}

.form-control,
.form-select {
    background-color: rgba(2, 6, 23, 0.58);
    border: 1px solid rgba(148, 163, 184, 0.32);
    color: #e5edf7;
    border-radius: 12px;
    transition:
        border-color 0.22s ease,
        box-shadow 0.22s ease,
        background-color 0.22s ease;
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(2, 6, 23, 0.72);
    color: #f8fbff;
    border-color: rgba(56, 189, 248, 0.78);
    box-shadow: 0 0 0 0.18rem rgba(14, 165, 233, 0.26);
}

.btn {
    border-radius: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    border: none;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.32);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #38bdf8 0%, #3b82f6 100%);
    transform: translateY(-1px);
}

#map {
    border-radius: var(--radius-md);
}

@media (max-width: 991.98px) {
    body {
        font-size: 0.95rem;
    }

    .card {
        border-radius: 18px;
    }

    .card-header {
        padding: 12px 14px;
        font-size: 0.94rem;
    }

    .table td,
    .table th {
        padding: 9px 10px;
    }

    .stat-number {
        font-size: 1.2rem;
    }
}

.text-general-alerts {
    color: #1064e2 !important;
}

.text-orange {
    color: #fd7e14 !important;
}