/* ==========================================================================
   Anlık Orman Yangınları Haritası — Arayüz Stilleri
   Görsel Referans: Koyu Antrasit Harita + Sıcak Kehribar/Kahve Cam Paneller
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #232325;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #f5ebe1;
    -webkit-font-smoothing: antialiased;
}

#app-root {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#fire-map {
    width: 100%;
    height: 100%;
    background: #232325;
    transition: background-color 0.2s ease;
}

#fire-map.is-light-map {
    background: #dfe4e8;
}

/* Koyu harita altlığını görseldeki yumuşak antrasit/arduvaz tonuna getir */
.leaflet-tile-pane .dark-slate-tiles {
    filter: brightness(1.36) contrast(0.91) saturate(0.85);
}

/* Leaflet varsayılan atıf kutusunu zarif ve karanlık yap */
.leaflet-control-attribution {
    background: rgba(20, 14, 10, 0.65) !important;
    color: rgba(196, 173, 155, 0.65) !important;
    font-size: 10px !important;
    padding: 2px 7px !important;
    border-top-left-radius: 6px;
    backdrop-filter: blur(4px);
}

.leaflet-control-attribution a {
    color: rgba(251, 146, 60, 0.75) !important;
    text-decoration: none;
}

/* Ortak Sıcak Koyu-Kahve Cam (Glassmorphism) Panel Stili */
.glass-panel {
    position: absolute;
    z-index: 1000;
    background: rgba(25, 14, 9, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(168, 82, 24, 0.42);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 186, 120, 0.06);
}

/* --------------------------------------------------------------------------
   1. SOL ÜST PANEL: Anlık Orman Yangınları & Zaman Seçici
   -------------------------------------------------------------------------- */
.fire-control-card {
    top: 16px;
    left: 16px;
    width: 248px;
    border-radius: 11px;
    padding: 13px 14px 12px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 7px;
}

.flame-badge {
    font-size: 15px;
    line-height: 1;
    filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.55));
}

.card-title {
    margin: 0;
    font-size: 14.5px;
    font-weight: 700;
    color: #fb923c;
    letter-spacing: -0.01em;
}

.card-subtitle {
    margin: 4px 0 10px;
    font-size: 11px;
    color: #a98e77;
    font-weight: 400;
}

/* 3'lü Zaman Aralığı Seçici */
.range-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    background: rgba(46, 25, 15, 0.72);
    border: 1px solid rgba(133, 64, 20, 0.35);
    border-radius: 8px;
    padding: 3px;
}

.range-btn {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: #bfa38c;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    padding: 6px 4px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 34px;
    transition: all 0.18s ease;
}

.range-btn:hover {
    color: #fed7aa;
    background: rgba(154, 52, 18, 0.25);
}

.range-btn.active {
    background: linear-gradient(180deg, rgba(168, 76, 20, 0.72) 0%, rgba(124, 51, 14, 0.78) 100%);
    border-color: rgba(249, 115, 22, 0.48);
    color: #ffedd5;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

/* Alt Sayaç Satırı */
.status-line {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #bfa38c;
    min-height: 16px;
}

.loading-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fb923c;
    box-shadow: 0 0 8px #f97316;
    display: none;
    animation: firePulse 1s infinite ease-in-out;
    flex-shrink: 0;
}

.status-line.is-loading .loading-dot {
    display: inline-block;
}

@keyframes firePulse {
    0%, 100% { transform: scale(0.85); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
}

.detection-count {
    color: #fb923c;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.detection-text {
    color: #cbb29d;
}

/* --------------------------------------------------------------------------
   2. SAĞ ÜST PANEL: Altlık Harita Seçici & Haritalayan Künyesi
   -------------------------------------------------------------------------- */
.top-right-bar {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1002;
    display: flex;
    align-items: center;
    gap: 8px;
}

.basemap-switcher {
    position: relative;
}

.basemap-btn {
    position: relative;
    z-index: auto;
    appearance: none;
    border-radius: 9px;
    padding: 7px 11px;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 500;
    color: #f3e4d7;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.basemap-btn:hover,
.basemap-switcher.open .basemap-btn {
    background: rgba(42, 22, 13, 0.94);
    border-color: rgba(251, 146, 60, 0.68);
    color: #ffffff;
}

.basemap-icon {
    color: #fb923c;
    flex-shrink: 0;
}

.basemap-caret {
    font-size: 10.5px;
    color: #d6b69c;
    transition: transform 0.18s ease;
}

.basemap-switcher.open .basemap-caret {
    transform: rotate(180deg);
}

.basemap-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 224px;
    border-radius: 10px;
    padding: 5px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 1010;
}

.basemap-switcher.open .basemap-menu {
    display: flex;
}

.basemap-option {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: #e7d5c5;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 500;
    padding: 7px 10px;
    border-radius: 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 9px;
    text-align: left;
    width: 100%;
    transition: all 0.14s ease;
}

.basemap-option:hover {
    background: rgba(154, 52, 18, 0.28);
    color: #ffffff;
}

.basemap-option.active {
    background: linear-gradient(180deg, rgba(168, 76, 20, 0.55) 0%, rgba(124, 51, 14, 0.62) 100%);
    border-color: rgba(249, 115, 22, 0.42);
    color: #ffedd5;
    font-weight: 600;
}

.basemap-radio {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid #a98e77;
    flex-shrink: 0;
    position: relative;
    transition: all 0.14s ease;
}

.basemap-option.active .basemap-radio {
    border-color: #fb923c;
    background: #fb923c;
    box-shadow: 0 0 6px rgba(251, 146, 60, 0.75);
}

.author-pill {
    position: relative;
    z-index: auto;
    border-radius: 9px;
    padding: 7px 13px;
    font-size: 11.5px;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.author-prefix {
    color: #b59a84;
}

.author-name {
    color: #fb923c;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   3. SAĞ ALT PANEL: Yangın Yoğunluğu Lejantı
   -------------------------------------------------------------------------- */
.legend-card {
    bottom: 22px;
    right: 16px;
    width: 214px;
    border-radius: 10px;
    overflow: hidden;
}

.legend-header {
    width: 100%;
    appearance: none;
    border: 0;
    background: transparent;
    padding: 10px 13px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    color: #fb923c;
    font-family: inherit;
}

.legend-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.legend-caret {
    font-size: 11px;
    color: #d6b69c;
    transition: transform 0.2s ease;
}

.legend-card.collapsed .legend-caret {
    transform: rotate(180deg);
}

.legend-card.collapsed .legend-body {
    display: none;
}

.legend-body {
    padding: 2px 13px 11px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 11.5px;
    color: #e7d8cb;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s ease;
}

.legend-item:hover {
    color: #ffffff;
}

.legend-item.muted {
    opacity: 0.35;
    text-decoration: line-through;
}

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

.dot-low {
    background: #facc15;
    box-shadow: 0 0 6px rgba(250, 204, 21, 0.65);
}

.dot-medium {
    background: #f97316;
    box-shadow: 0 0 6px rgba(249, 115, 22, 0.65);
}

.dot-high {
    background: #ef4444;
    box-shadow: 0 0 7px rgba(239, 68, 68, 0.7);
}

.dot-extreme {
    background: #991b1b;
    border: 1px solid #dc2626;
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.75);
}

/* --------------------------------------------------------------------------
   4. SOL ALT: Harita Hızlı Araçları
   -------------------------------------------------------------------------- */
.map-tools {
    position: absolute;
    bottom: 22px;
    left: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tool-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(168, 82, 24, 0.42);
    background: rgba(25, 14, 9, 0.86);
    backdrop-filter: blur(10px);
    color: #e7d5c5;
    font-size: 17px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    transition: all 0.15s ease;
    padding: 0;
}

.tool-btn:hover,
.tool-btn.active {
    background: rgba(146, 64, 18, 0.85);
    border-color: rgba(251, 146, 60, 0.65);
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   5. YANGIN DETAY POPUP KARTI (Koyu Cam Tasarım)
   -------------------------------------------------------------------------- */
.leaflet-popup-content-wrapper {
    background: rgba(23, 13, 9, 0.95) !important;
    backdrop-filter: blur(12px);
    color: #f5ebe1 !important;
    border: 1px solid rgba(194, 92, 24, 0.52);
    border-radius: 10px !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65) !important;
    padding: 0 !important;
}

.leaflet-popup-tip {
    background: rgba(23, 13, 9, 0.95) !important;
    border: 1px solid rgba(194, 92, 24, 0.45);
}

.leaflet-popup-content {
    margin: 12px 14px !important;
    min-width: 230px;
    font-family: 'Inter', sans-serif;
}

.leaflet-container a.leaflet-popup-close-button {
    color: #bfa38c !important;
    top: 6px !important;
    right: 7px !important;
}

.leaflet-container a.leaflet-popup-close-button:hover {
    color: #fb923c !important;
}

.fire-popup-head {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 9px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(168, 82, 24, 0.28);
}

.fire-popup-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 99px;
}

.badge-l0 { background: rgba(250, 204, 21, 0.16); color: #fde047; border: 1px solid rgba(250, 204, 21, 0.4); }
.badge-l1 { background: rgba(249, 115, 22, 0.18); color: #fdba74; border: 1px solid rgba(249, 115, 22, 0.45); }
.badge-l2 { background: rgba(239, 68, 68, 0.2);  color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.48); }
.badge-l3 { background: rgba(185, 28, 28, 0.35); color: #fecaca; border: 1px solid rgba(220, 38, 38, 0.65); }

.fire-popup-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    font-size: 11.5px;
}

.fp-key {
    color: #a98e77;
}

.fp-val {
    color: #f7ede4;
    font-weight: 500;
    text-align: right;
}

.fire-popup-foot {
    margin-top: 9px;
    padding-top: 7px;
    border-top: 1px solid rgba(168, 82, 24, 0.22);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10.5px;
}

.fire-popup-coords {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: #b59a84;
}

.fire-popup-link {
    color: #fb923c !important;
    text-decoration: none;
    font-weight: 600;
}

.fire-popup-link:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   6. BİLDİRİM ÇUBUĞU (TOAST) & MOBİL UYUM
   -------------------------------------------------------------------------- */
.toast-msg {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    z-index: 2000;
    background: rgba(25, 14, 9, 0.94);
    border: 1px solid rgba(249, 115, 22, 0.55);
    color: #ffedd5;
    padding: 8px 16px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.toast-msg.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 760px) {
    .fire-control-card {
        top: 10px;
        left: 10px;
        right: 10px;
        width: auto;
    }

    .top-right-bar {
        top: 162px;
        right: 10px;
        left: 10px;
        justify-content: space-between;
        pointer-events: none;
    }

    .top-right-bar > * {
        pointer-events: auto;
    }

    .basemap-btn {
        font-size: 10.5px;
        padding: 6px 9px;
    }

    .basemap-menu {
        left: 0;
        right: auto;
    }

    .author-pill {
        font-size: 10.5px;
        padding: 6px 10px;
    }

    .legend-card {
        bottom: 14px;
        right: 10px;
        width: 196px;
    }

    .map-tools {
        bottom: 14px;
        left: 10px;
    }
}
