/* ========================================================================
   เช็คน้ำท่วม.com - Main Stylesheet (Full Source Code)
   Theme: Light Premium / Minimal iOS Style (Cloud Radar Effect)
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

/* =========================================
   1. CORE VARIABLES & DESIGN TOKENS
   ========================================= */
:root {
    var(--bg-main): #f3f4f6;
    var(--text-dark): #1f2937;
    var(--text-muted): #6b7280;
    var(--accent-blue): #007AFF;
    var(--accent-neon-red): #FF3B30;
    
    var(--glass-bg): rgba(255, 255, 255, 0.85);
    var(--glass-border): rgba(255, 255, 255, 0.6);
    var(--glass-shadow): 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    var(--glass-blur): blur(20px) saturate(180%);
    
    var(--safe-area-top): env(safe-area-inset-top, 20px);
    var(--safe-area-bottom): env(safe-area-inset-bottom, 20px);
}

/* =========================================
   2. RESET & BASE (FULLSCREEN LOCK)
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    font-family: 'Prompt', sans-serif;
    background-color: #f3f4f6;
    color: #1f2937;
    height: 100dvh; 
    width: 100vw;
    overflow: hidden;
    position: fixed;
    inset: 0;
    overscroll-behavior-y: none;
}

/* =========================================
   3. APP LOADER (Splash Screen)
   ========================================= */
.app-loader {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ffffff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease;
}

.radar-spinner {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid rgba(0, 122, 255, 0.1);
    border-top-color: #007AFF;
    animation: spin 1s linear infinite;
}

/* =========================================
   4. MAP LAYER & CLOUD RADAR EFFECT
   ========================================= */
#mapContainer {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    height: 100dvh; 
    width: 100vw;
    z-index: 1;
    background: #e5e5ea;
}

.leaflet-control-zoom, .leaflet-control-attribution {
    display: none !important;
}

/* 🌟 เอฟเฟกต์แปลง Polygon ให้เป็นก้อนเมฆเรดาร์ (Weather Radar) 🌟 */
.flood-cloud-effect {
    /* ใช้ฟิลเตอร์เบลอเพื่อทำลายเส้นขอบคมๆ และทำเงาสะท้อนให้ดูเป็นมิติ */
    filter: blur(8px) drop-shadow(0 0 10px currentColor);
    transition: all 0.4s ease-in-out;
}

/* เวลาเมาส์ไปชี้ ให้เมฆหดตัวชัดขึ้นนิดนึง จะได้รู้ว่าคลิกเปิด Popup ได้ */
.flood-cloud-effect:hover {
    filter: blur(2px) drop-shadow(0 0 15px currentColor);
    cursor: pointer;
}

/* =========================================
   5. UI OVERLAYS (LIGHT GLASSMORPHISM)
   ========================================= */
.glass-effect {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.app-header {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    padding: 12px 20px;
    border-radius: 20px;
    z-index: 1000;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.app-header .text-white {
    color: #1f2937 !important;
}

.badge-live {
    font-size: 0.65rem;
    background: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 600;
    display: inline-block;
    animation: blink 2s infinite;
}

/* =========================================
   6. CUSTOM MAP CONTROLS
   ========================================= */
.custom-map-controls {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: #1f2937;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.btn-glass:active {
    background: #f3f4f6;
    transform: scale(0.92);
}

/* =========================================
   7. BOTTOM ACTION AREA & BUTTONS
   ========================================= */
.bottom-action-area {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom, 20px));
    left: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s ease;
}

.system-status-toast .text-white-50 {
    color: #6b7280 !important;
    font-weight: 500;
}

.btn-report-neon {
    background: #FF3B30;
    color: white;
    border: none;
    box-shadow: 0 10px 25px rgba(255, 59, 48, 0.4);
    transition: all 0.2s;
}

.btn-report-neon:hover {
    transform: translateY(-2px); 
    box-shadow: 0 15px 30px rgba(255, 59, 48, 0.5);
}

.btn-report-neon:active {
    transform: scale(0.95);
}

/* =========================================
   8. MORPHING FORM WIZARD (MOBILE vs PC)
   ========================================= */
.app-bottom-sheet {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    z-index: 1050;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    color: #1f2937;
}

.app-bottom-sheet .text-white { color: #1f2937 !important; }
.app-bottom-sheet .text-white-50 { color: #6b7280 !important; }
.btn-close-white { filter: invert(1) grayscale(100%) brightness(0%); }

@media (max-width: 767px) {
    .app-bottom-sheet {
        border-top-left-radius: 32px;
        border-top-right-radius: 32px;
        height: 75dvh;
    }
}

@media (min-width: 768px) {
    .app-header { width: 400px; }
    .bottom-action-area { 
        left: 50%; right: auto; transform: translateX(-50%); width: 400px;
    }
    .app-bottom-sheet {
        top: 20px !important; right: 20px !important; left: auto !important; bottom: 20px !important;
        height: calc(100dvh - 40px) !important; width: 450px !important;
        border-radius: 24px !important; box-shadow: -10px 0 40px rgba(0,0,0,0.1);
        transform: translateX(120%) !important; 
    }
    .offcanvas.show.app-bottom-sheet { transform: translateX(0) !important; }
    .sheet-drag-handle { display: none; }
}

.sheet-drag-handle {
    width: 40px; height: 5px; background: rgba(0, 0, 0, 0.2); border-radius: 10px; margin: 15px auto;
}

/* =========================================
   9. FORM ELEMENTS CUSTOMIZATION
   ========================================= */
.btn-outline-glass {
    border: 1px solid rgba(0,0,0,0.1);
    color: #6b7280;
    background: #ffffff;
    border-radius: 16px;
    transition: all 0.3s;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.btn-check:checked + .btn-outline-glass {
    background: rgba(0, 122, 255, 0.05);
    border-color: #007AFF;
    color: #007AFF;
    box-shadow: inset 0 0 0 1px #007AFF;
    transform: translateY(-2px);
}

.border-dashed { 
    border-style: dashed !important; 
    border-color: rgba(0,0,0,0.2) !important; 
    background: rgba(0,0,0,0.02);
}

/* =========================================
   10. ANIMATIONS & MISC
   ========================================= */
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.text-gradient {
    background: linear-gradient(to right, #007AFF, #34C759);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}