/* style.css (Final Polish) */
body { margin: 0; padding: 0; display: flex; height: 100vh; font-family: 'Sarabun', sans-serif; overflow: hidden; }

/* Sidebar & Layout */
.sidebar { width: 340px; background: #f4f6f9; padding: 15px; box-shadow: 2px 0 10px rgba(0,0,0,0.1); z-index: 1000; overflow-y: auto; display: flex; flex-direction: column; box-sizing: border-box; }
.header h2 { margin-top: 0; color: #2c3e50; display: flex; align-items: center; gap: 10px; }
#map { flex-grow: 1; height: 100%; }

/* Panels & Controls */
.control-panel { background: white; padding: 15px; border-radius: 8px; margin-bottom: 15px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.control-panel h3 { margin-top: 0; margin-bottom: 10px; font-size: 1rem; color: #444; border-bottom: 2px solid #f0f0f0; padding-bottom: 5px; }
.hint { font-size: 0.85em; color: #666; margin-bottom: 8px; margin-top: 0; }
input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; font-size: 16px; }
button { width: 100%; padding: 10px; background: #007bff; color: white; border: none; cursor: pointer; border-radius: 4px; font-weight: bold; transition: background 0.2s; font-size: 1rem; }
button:hover { background: #0056b3; }
.btn-offline { background: #28a745; margin-top: 5px;}
.btn-reset { background-color: #6c757d; color: white; }

/* Checkbox Layout */
.filter-group label, .grid-toggle label { display: flex; align-items: center; justify-content: flex-start; width: 100%; padding: 6px 0; cursor: pointer; border-bottom: 1px dashed #eee; font-size: 0.95rem; }
.filter-group label:last-child { border-bottom: none; }
.filter-group input[type="checkbox"], .grid-toggle input[type="checkbox"] { width: auto !important; margin: 0 10px 0 0; transform: scale(1.2); cursor: pointer; }
.result-box { margin-top: 15px; font-size: 0.95em; color: #333; line-height: 1.6; }
.footer { margin-top: auto; text-align: center; color: #aaa; font-size: 0.75em; padding-top: 20px;}

/* --- 🔴 ส่วนสำคัญที่แก้เรื่องการแสดงผล --- */

/* 1. Tooltip บนเส้น (Target Label) - บังคับขอบสีฟ้า */
.target-label {
    background-color: rgba(255, 255, 255, 0.98) !important;
    border: 2px solid #007bff !important; /* ขอบสีฟ้า */
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    font-family: 'Sarabun', sans-serif;
    font-size: 13px;
    color: #333;
    padding: 6px 10px;
    text-align: center;
    white-space: nowrap; 
    line-height: 1.4;
}

/* ซ่อนหาง Tooltip */
.leaflet-tooltip-top:before, .leaflet-tooltip-bottom:before, .leaflet-tooltip-left:before, .leaflet-tooltip-right:before { display: none; }
.leaflet-tooltip { border: none; box-shadow: none; background: transparent; }

/* 2. ไอค่อนบ้าน (Persistent User Icon) - บังคับขนาดและตำแหน่ง */
.user-pin {
    font-size: 32px !important;
    line-height: 32px !important;
    text-align: center;
    width: 40px !important;
    height: 40px !important;
    filter: drop-shadow(0px 3px 3px rgba(0,0,0,0.4));
    cursor: default;
    z-index: 9999 !important; /* อยู่บนสุดเสมอ */
}

/* 3. Grid Label */
.grid-label { font-size: 14px; font-weight: bold; color: rgba(0, 0, 0, 0.4); text-shadow: 1px 1px 0px white, -1px -1px 0px white; text-align: center; white-space: nowrap; }

/* Responsive */
@media (max-width: 600px) {
    body { flex-direction: column; }
    .sidebar { width: 100%; height: 50%; order: 2; padding: 10px; }
    #map { height: 50%; order: 1; }
    .control-panel { padding: 10px; margin-bottom: 10px; }
}