/* Google Sans Font Setup */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600&display=swap');

:root {
    --primary-color: #007AFF; /* iOS Blue */
    --danger-color: #FF3B30;  /* iOS Red */
    --warning-color: #FF9500; /* iOS Orange */
    --success-color: #34C759; /* iOS Green */
    --bg-glass: rgba(255, 255, 255, 0.92);
    --shadow: 0 4px 20px rgba(0,0,0,0.15);
    --font-stack: 'Google Sans', 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font-stack);
    overflow: hidden; /* ป้องกัน Scrollbar */
    -webkit-font-smoothing: antialiased;
}

/* Map Container */
#map {
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

/* Floating Panels (General) */
.floating-panel {
    position: absolute;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: var(--shadow);
    z-index: 1000;
    padding: 16px;
    transition: all 0.3s ease;
}

/* 1. Dashboard Stats (Top Left) */
.stats-panel {
    top: 20px;
    left: 20px;
    width: 280px;
}
.stat-title {
    font-size: 14px;
    color: #8E8E93;
    font-weight: 500;
    margin-bottom: 8px;
}
.stat-bar-container {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}
.bar-segment { height: 100%; }
.status-text {
    font-size: 12px;
    color: #1C1C1E;
}

/* 2. Authentication Button (Top Right) */
.auth-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--bg-glass);
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    box-shadow: var(--shadow);
    border: none;
}

/* 3. Filter Bar (Bottom Center) */
.filter-bar {
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    padding: 8px;
    border-radius: 24px;
}
.filter-btn {
    border: none;
    background: transparent;
    padding: 10px 16px;
    border-radius: 16px;
    font-family: var(--font-stack);
    font-size: 14px;
    font-weight: 500;
    color: #8E8E93;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.filter-btn.active {
    background: #fff;
    color: #000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.filter-icon { width: 18px; height: 18px; fill: currentColor; }

/* 4. Admin/Form Modal (Hidden by default) */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }

.admin-window {
    width: 90%;
    max-width: 900px;
    height: 80vh;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    box-shadow: var(--shadow);
}

.split-view-map { flex: 1; position: relative; }
.split-view-form {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #F2F2F7;
}

/* Form Elements */
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 500; color: #333; }
.form-input, .form-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #E5E5EA;
    border-radius: 10px;
    font-family: var(--font-stack);
    font-size: 16px;
    background: #fff;
}
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary:hover { opacity: 0.9; }

/* Custom Marker Pins (CSS for Leaflet DivIcon) */
.custom-pin {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pin-red { background: var(--danger-color); }
.pin-orange { background: var(--warning-color); }
.pin-green { background: var(--success-color); }
.pin-icon { width: 16px; height: 16px; fill: #fff; }

/* Responsive */
@media (max-width: 768px) {
    .stats-panel { width: calc(100% - 40px); top: 60px; }
    .auth-btn { top: 10px; right: 10px; padding: 6px 12px; font-size: 12px; }
    .filter-bar { width: 90%; overflow-x: auto; justify-content: flex-start; }
    .admin-window { flex-direction: column; height: 90vh; }
    .split-view-map { height: 200px; flex: none; }
}