/**
 * vcfire-v2.css - Component styles for VCFire v2 redesign
 * Only things that can't be expressed in Tailwind:
 *   - Pseudo-elements, complex selectors
 *   - JS-toggled state classes
 *   - Address search dropdown
 *   - Leaflet popup overrides
 *   - Stat card accent borders
 */

/* ============================================ */
/* BASE / FONT                                  */
/* ============================================ */

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

#map {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* ============================================ */
/* GLASS PANEL (shared)                         */
/* ============================================ */

.glass-panel {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ============================================ */
/* TOP BAR                                      */
/* ============================================ */

#top-bar {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ============================================ */
/* STAT CARDS                                   */
/* ============================================ */

.stat-card {
    background: rgba(30, 41, 59, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
    position: relative;
}

.stat-card:hover {
    background: rgba(30, 41, 59, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(249, 115, 22, 0.15);
}

.stat-card.active {
    border-left-color: #F97316;
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.2);
}

/* Accent border colors per card type */
.stat-card.incidents { border-left-color: #ff6b6b; }
.stat-card.units     { border-left-color: #F97316; }
.stat-card.toptype   { border-left-color: #9b59b6; }
.stat-card.response  { border-left-color: #ffd43b; }

.stat-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.stat-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.stat-card.incidents .stat-icon { background: rgba(255, 107, 107, 0.15); color: #ff6b6b; }
.stat-card.units .stat-icon     { background: rgba(249, 115, 22, 0.15); color: #F97316; }
.stat-card.toptype .stat-icon   { background: rgba(155, 89, 182, 0.15); color: #9b59b6; }
.stat-card.response .stat-icon  { background: rgba(255, 212, 59, 0.15); color: #ffd43b; }

.stat-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
}

.stat-value {
    font-weight: 700;
    color: white;
    text-align: center;
}

/* ============================================ */
/* SECTION HEADINGS                             */
/* ============================================ */

#stats-panel h3 {
    margin: 0 0 1rem 0;
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

#weather-widget h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#legend h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ============================================ */
/* MOBILE STATS PANEL COLLAPSE                  */
/* ============================================ */

@media (max-width: 767px) {
    #stats-panel h3 {
        font-size: 0.6rem;
        margin-bottom: 0;
        cursor: pointer;
        user-select: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    #stats-panel h3::after {
        content: '\25BC';
        font-size: 0.5rem;
        margin-left: 0.5rem;
        transition: transform 0.3s ease;
        color: rgba(255, 255, 255, 0.3);
    }
    #stats-panel.mobile-collapsed h3::after {
        transform: rotate(-90deg);
    }
    #stats-panel:not(.mobile-collapsed) h3 {
        margin-bottom: 0.75rem;
    }
}

#stats-panel.mobile-collapsed {
    padding: 0.5rem 0.75rem;
    max-height: 40px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}
#stats-panel.mobile-collapsed .stat-card,
#stats-panel.mobile-collapsed #heatmap-btn,
#stats-panel.mobile-collapsed #hotspot-btn,
#stats-panel.mobile-collapsed #heatmap-date,
#stats-panel.mobile-collapsed #panel-tabs,
#stats-panel.mobile-collapsed #incidents-tab-content {
    display: none;
}

/* ============================================ */
/* WEATHER WIDGET MOBILE MINIMIZED              */
/* ============================================ */

#weather-widget.mobile-minimized h4,
#weather-widget.mobile-minimized .weather-current-label,
#weather-widget.mobile-minimized .weather-desc,
#weather-widget.mobile-minimized .weather-minmax,
#weather-widget.mobile-minimized .weather-temp {
    display: none;
}
#weather-widget.mobile-minimized .weather-icon {
    font-size: 1.2rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

@media (max-width: 767px) {
    #weather-widget:not(.mobile-minimized) {
        width: auto;
        height: auto;
        min-width: 150px;
    }
}

#legend.mobile-visible {
    display: block;
}

/* ============================================ */
/* ADDRESS SEARCH                               */
/* ============================================ */

#address-search-box {
    position: relative;
}

#address-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.625rem 2.5rem 0.625rem 2.5rem;
    font-size: 0.8125rem;
    border-radius: 9999px;
    font-family: inherit;
    transition: all 0.2s ease;
}
#address-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
#address-search-input:focus {
    outline: none;
    border-color: #F97316;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

#address-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    font-size: 0.8rem;
}

#address-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.98);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.search-result-item {
    padding: 0.625rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.15s;
}
.search-result-item:hover {
    background: rgba(249, 115, 22, 0.1);
}
.search-result-name {
    color: white;
    font-weight: 600;
    font-size: 0.8125rem;
}
.search-result-address {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.6875rem;
    margin-top: 0.125rem;
}

/* Search result marker on map */
.search-result-marker {
    width: 20px;
    height: 20px;
    background: #F97316;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ============================================ */
/* HOTSPOT NAVIGATOR MOBILE OVERRIDE            */
/* ============================================ */

@media (max-width: 479px) {
    #hotspot-navigator {
        top: auto !important;
        bottom: 8rem !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
        transform: none !important;
        min-width: auto !important;
        max-width: none !important;
        width: calc(100% - 1rem) !important;
    }
}

/* ============================================ */
/* MARKER HIGHLIGHT ANIMATIONS                  */
/* ============================================ */

.marker-highlight-purple {
    filter: drop-shadow(0 0 12px rgba(155, 89, 182, 0.8)) drop-shadow(0 0 24px rgba(155, 89, 182, 0.4));
}
.marker-highlight-yellow {
    filter: drop-shadow(0 0 12px rgba(255, 212, 59, 0.8)) drop-shadow(0 0 24px rgba(255, 212, 59, 0.4));
}

/* ============================================ */
/* POPUP STYLES (Leaflet popups)                */
/* ============================================ */

.popup-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #F97316;
}
.popup-detail {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}
.popup-label {
    font-weight: 600;
    color: #888;
}

/* ============================================ */
/* LEGEND ITEMS                                 */
/* ============================================ */

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ============================================ */
/* PILL TABS                                    */
/* ============================================ */

.pill-tab {
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}
.pill-tab.active {
    background: #F97316;
    color: white;
}
.pill-tab:not(.active) {
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
}
.pill-tab:not(.active):hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================ */
/* PILL BUTTONS (heatmap, hotspot controls)     */
/* ============================================ */

.pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #F97316;
    color: #F97316;
    background: transparent;
}
.pill-btn:hover {
    background: rgba(249, 115, 22, 0.1);
}
.pill-btn.active,
.pill-btn.filled {
    background: #F97316;
    color: white;
    border-color: #F97316;
}
.pill-btn.active:hover,
.pill-btn.filled:hover {
    background: #EA580C;
    border-color: #EA580C;
}

/* ============================================ */
/* UNIFIED MODAL                                */
/* ============================================ */

.modal-panel {
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.modal-title i {
    color: #F97316;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.15s;
}
.modal-close:hover {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

/* ============================================ */
/* MOBILE BOTTOM SHEET (stats panel)            */
/* ============================================ */

@media (max-width: 767px) {
    #stats-panel:not(.mobile-collapsed) {
        border-radius: 16px 16px 0 0;
        max-height: 65vh;
        overflow-y: auto;
    }
    /* Drag handle indicator */
    #stats-panel .drag-handle {
        display: block;
    }
}

@media (min-width: 768px) {
    #stats-panel .drag-handle {
        display: none;
    }
}
