  @import url("https://fonts.googleapis.com");
  @import url("https://fonts.gstatic.com");
  @import url("https://fonts.googleapis.com/css2?family=Mitr:wght@200;300;400;500;600;700&display=swap");

  /* รีเซ็ตพื้นฐานของทุกหน้า*/
  body {
    margin: 0;                                             /* ลบ margin เริ่มต้นของ body */
    font-family: "Mitr" , "Segoe UI", Arial, sans-serif;            /* ฟอนต์หลัก */
    background: linear-gradient(135deg, #338d75, #9edccf); /* พื้นหลังไล่สีฟ้า-ม่วง */
    display: flex;                                         /* ใช้ flex เพื่อจัดกลาง (สำหรับหน้า login/role) */
    justify-content: center;                               /* จัดแนวนอนให้อยู่กลาง */
    align-items: center;                                   /* จัดแนวตั้งให้อยู่กลาง */
    height: 100vh;                                         /* สูงเต็มจอ */
  }
  /* ////////////////////////////////////////////////////////////////////////////////////// */

  /* /////////////////////////
      หน้าเลือกบทบาท (role.html)
    ///////////////////////// */
  .role-container {                                        /* กล่องรวมของหน้าเลือกบทบาท */
    text-align: center;
    background: rgba(255,255,255,0.85);
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    width: 320px;
  }

  .role-container h2 {                                     /* หัวข้อในหน้าเลือกบทบาท */
    margin-bottom: 25px;
    color: #2d3436;
  }

  .role-card {                                             /* ปุ่มการ์ดเลือกบทบาท */
    position: relative;
    margin: 20px 0;
    padding: 20px 0;
    border-radius: 12px;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  .role-card:hover {                                       /* เอฟเฟกต์ตอนเอาเมาส์ชี้ */
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.25);
  }

  /* สีแยกตามบทบาท */
  .role-card.user {  background: linear-gradient(135deg, #d0ce6c, #00cec9); } /* ปุ่ม user */
  .role-card.admin { background: linear-gradient(135deg, #7254a2, #e84393); } /* ปุ่ม admin */

  .role-text {                                            /* ตัวหนังสือหลักบนการ์ด */
    position: relative;
    z-index: 2;
  }

  .role-bg-icon {                                         /* ไอคอนใหญ่จางๆ ด้านหลังการ์ด */
    position: absolute;
    right: 10px;
    bottom: -10px;
    font-size: 4.5rem;
    opacity: 0.25;
    z-index: 1;
    pointer-events: none;
  }

  .hidden { display: none; }                              /* ซ่อนไว้ (ใช้กับ JS) */

  /* //////////////////////////////////////////////////////////////////////////////// */

  /* //////////////
    หน้า user-login
    ////////////// */
  .login-container {                                      /* กล่องฟอร์มล็อกอินผู้ใช้ */
    background: rgba(255, 255, 255, 0.9);
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    width: 350px;
    text-align: center;
  }

  .login-container h2 {                                   /* หัวข้อหน้า login */
    margin-bottom: 25px;
    font-size: 1.8rem;
    color: #2d3436;
  }

  .login-container form {                                 /* ฟอร์มหลัก จัดแนวตั้ง */
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .login-container label {                                /* ป้ายกำกับ input */
    text-align: left;
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 5px;
  }

  .login-container input[type="text"],
  .login-container input[type="tel"] {                    /* ช่องกรอก username/เบอร์โทร */
    padding: 10px 14px;
    border: 1px solid #b2bec3;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background-color: #fffaf0; /* พาสเทลครีมอ่อน */
    border-color: #c3c3c3;    /* สีเส้นขอบอ่อน */
  }

  .login-container input[type="text"]:focus,
  .login-container input[type="tel"]:focus {              /* เอฟเฟกต์ focus */
    border-color: #89cff0;    /* พาสเทลฟ้า */
    outline: none;
  }

  .login-container button {                           /* ปุ่มเข้าสู่ระบบ */
    background: linear-gradient(135deg, #71a73b, #e6f7a4); /* พาสเทลชมพู-ส้มอ่อน */
    color: #2d3436;
    border: none;
    padding: 12px 0;
    border-radius: 8px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
  }
  .login-container button:hover {                         /* เอฟเฟกต์ hover ปุ่ม */
    background: linear-gradient(135deg, #ffdfba, #ffb3ba);
    transform: translateY(-2px);
  }
  /* /////////////////////////////////////////////////////////////////////////////////////// */

  /* /////////////////////////////////
    หน้า report.html (ฟอร์มรายงานปัญหา)
    ///////////////////////////////// */
  body.report-page {                                      /* จัด body ของหน้า report */
    /* [แก้ไข] ลบ display: flex ออก เพื่อให้มันใช้ CSS ของตัวเองได้เต็มที่ */
    /* display: flex; */
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding-top: 40px;
    background: linear-gradient(135deg, #74b9ff, #a29bfe);
    font-family: "Segoe UI", Arial, sans-serif;
  }

  .report-container {                                     /* กล่องฟอร์มรายงาน */
    background: rgba(255, 255, 255, 0.95);
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    width: 400px;
    max-width: 90%;
    text-align: left;
    margin: 0 auto; /* [แก้ไข] เพิ่ม auto margin เพื่อจัดกลาง เมื่อ body ไม่ใช่ flex */
  }

  .report-container h2 {                                  /* หัวข้อฟอร์ม */
    margin-bottom: 10px;
    font-size: 1.8rem;
    color: #2d3436;
    text-align: center;
  }

  .report-container p {                                   /* คำอธิบายใต้หัวข้อ */
    margin-bottom: 20px;
    color: #636e72;
    text-align: center;
    font-size: 1rem;
  }

  .report-container form {                                /* ฟอร์มภายใน */
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .report-container label {                               /* ป้ายกำกับ */
    font-weight: 600;
    color: #2d3436;
  }

  .report-container input[type="text"],
  .report-container input[type="file"],
  .report-container textarea,
  .report-container select {                               /* ช่องกรอก/อัปโหลด/เลือก */
    padding: 10px 14px;
    border: 1px solid #b2bec3;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
  }

  .report-container input[type="text"]:focus,
  .report-container input[type="file"]:focus,
  .report-container textarea:focus,
  .report-container select:focus {                         /* เอฟเฟกต์ focus */
    border-color: #0984e3;
    outline: none;
  }

  .report-container textarea {                             /* ปรับ textarea */
    resize: vertical;
  }

  .report-container button {                                /* ปุ่มส่งรายงาน */
    background: linear-gradient(135deg, #00b894, #00cec9);
    border: none;
    padding: 12px 0;
    border-radius: 8px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
  }
  .report-container button:hover {
    background: linear-gradient(135deg, #00cec9, #00b894);
    transform: translateY(-2px);
  }
  /* แผนที่เต็มหน้าจอ */
  #map {
    height: 100vh;
    width: 100%;
  }
  
/* เมื่อย้ายไปมุมขวาบน */
.top-right-btn {
            position: fixed;
            top: 15px;
            right: 15px;
            z-index: 1000; /* ให้อยู่เหนือแผนที่ แต่ใต้ Modal */
        }

  
  /* //////////////////////////////////////////////////////////////////////////////////////////////////// */

  /* ///////////////////////////////
    ปรับแต่ง Modal ให้ดูเหมือน Bootstrap
    /////////////////////////////// */

  /* กล่อง Modal */
  .modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px 35px;
    border-radius: 15px;
    width: 90%;
    max-width: 520px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    font-family: "Mitr","Segoe UI", Tahoma, sans-serif;
  }

  /* ช่องไฟในฟอร์ม */
  .modal-content form {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  /* ป้ายชื่อ */
  .modal-content label {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    display: block;
  }

  /* ปรับช่องกรอกแบบ Bootstrap */
  .modal-content input[type="text"],
  .modal-content select,
  .modal-content textarea,
  .modal-content input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 16px;
    color: #212529;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 8px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box; /* [แก้ไข] เพิ่ม box-sizing เพื่อให้ padding ไม่ล้น */
  }

  /* เอฟเฟกต์ตอนโฟกัส */
  .modal-content input:focus,
  .modal-content select:focus,
  .modal-content textarea:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    outline: none;
  }

  /* พื้นที่กล่องตำแหน่ง */
  .location-box {
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    font-size: 14px;
    color: #555;
  }

  /* ปุ่มดึงตำแหน่ง */
  #getLocationBtn {
    background: linear-gradient(135deg, #96869d, #74b9ff);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
  }
  #getLocationBtn:hover {
    background: linear-gradient(135deg, #96869d, #74b9ff);
  }

  /* ปุ่มส่ง */
  .modal-content button[type="submit"] {
    background: linear-gradient(135deg, #96869d, #74b9ff);
    color: #fff;
    font-size: 18px;
    font-weight: 500;
    border: none;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: background 0.3s;
  }
  .modal-content button[type="submit"]:hover {
    background: linear-gradient(135deg, #74b9ff, #0d6efd);
  }

  /* ปุ่มปิด */
  .close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #ff0000;
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
  }
  .close:hover,
  .close:focus {
    color: #000;
    cursor: pointer;
  }

  /* กล่องฟอร์ม login ของ admin */
  .admin-login {
    max-width: 380px;
    margin: 80px auto;
    padding: 40px 35px;
    background: linear-gradient(145deg, #ffeaa7, #fab1a0); /* ไล่สีสดใส */
    border-radius: 25px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.25);
    text-align: center;
    animation: fadeIn 0.8s ease-in-out;
    transition: transform 0.3s ease;
  }

  .admin-login:hover {
    transform: translateY(-3px);
  }

  /* หัวข้อฟอร์ม */
  .admin-login h2 {
    margin-bottom: 30px;
    color: #2d3436;
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 1.8rem;
  }

  /* ช่องกรอก email และ password */
  .admin-login input[type="email"],
  .admin-login input[type="password"] {
    width: 100% !important;
    padding: 16px 18px !important;
    margin-bottom: 22px !important;
    border: 1px solid #b2bec3;
    border-radius: 15px !important;
    font-size: 1rem !important;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
  }

  /* เอฟเฟกต์เวลาโฟกัส */
  .admin-login input[type="email"]:focus,
  .admin-login input[type="password"]:focus {
    border-color: #6c5ce7;
    box-shadow: 0 0 12px rgba(108,92,231,0.5);
    outline: none;
  }

  /* ปุ่มเข้าสู่ระบบ */
  .admin-login button {
    width: 100%;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    border: none;
    padding: 16px 0;
    border-radius: 15px;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
  }

  .admin-login button:hover {
    background: linear-gradient(135deg, #a29bfe, #6c5ce7);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.35);
  }

  /* ข้อความแสดง error */
  .admin-login .error-msg {
    color: #d63031;
    margin-top: 15px;
    font-size: 0.95rem;
    text-align: center;
  }

  /* animation */
  @keyframes fadeIn {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
  }

  /* ////////////////////////////////////////////////////////////////////////////////////// */

/* ==============================
    Admin Dashboard (Modern Dash UI Style)
    ============================== */

  /* เปลี่ยนพื้นหลังและฟอนต์ของหน้าแอดมิน */
  body.admin-page-background {
    display: block;       
    justify-content: normal; 
    align-items: normal;   
    height: auto;          

    background-color: #f5f4f8 !important; /* [อัปเดต] สีพื้นหลังเทาอ่อนสไตล์ Dash UI */
    font-family: 'Kanit', sans-serif; /* [เพิ่ม] ใช้ฟอนต์ให้เข้ากับหน้าเว็บหลัก */
    min-height: 100vh;           
    margin: 0;
    padding: 0;
    overflow-y: auto;   
  }

  /* ==============================
     [เพิ่มใหม่] สไตล์การ์ดสถิติและกรอบแผนที่แบบ Dash UI
     ============================== */
  .dash-card {
      border: none !important;
      box-shadow: 0 1px 3px rgba(3,0,71,.09) !important;
      border-radius: 0.75rem !important;
      background-color: #ffffff !important;
  }
  .dash-card .card-header {
      background-color: transparent !important;
      border-bottom: 1px solid #e2e8f0 !important;
      padding: 1.25rem 1.5rem !important;
  }
  .icon-shape {
      width: 48px;
      height: 48px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 0.5rem;
      font-size: 1.25rem;
  }

  /* ==============================
     สไตล์ตาราง (ปรับลุคเป็นมินิมอล)
     ============================== */
  /* .table-container {
    max-height: 80vh;                 
    overflow-y: auto;                 
    background: #fff;                 
    border-radius: 0.75rem; /* [อัปเดต] มุมโค้งตามการ์ด Dash UI */
    /* box-shadow: 0 1px 3px rgba(3,0,71,.09); [เพิ่ม] เงาบางๆ ให้กล่องตาราง
  }  */
    /* ==============================
     สไตล์ตาราง (ปรับให้กลืนไปกับหน้าเว็บ ไม่เป็นกล่อง)
     ============================== */
  .table-container {
    max-height: 85vh; /* ให้ความสูงเกือบเต็มจอ */
    overflow-y: auto;                 
    background: #ffffff; /* พื้นหลังขาว */
    border-radius: 0 !important; /* [แก้] เอาขอบมนออก */
    box-shadow: none !important; /* [แก้] เอาเงาออก */
    border-top: 1px solid #e2e8f0; /* เพิ่มเส้นคั่นบางๆ ด้านบนให้ดูมีมิติ */
    /* margin: 0 -1.5rem; */ /* (ตัวเลือกเสริม) ถ้าอยากให้ตารางทะลุชิดขอบจอซ้าย-ขวา ให้เอา comment บรรทัดนี้ออกครับ */
  }

  /* ปรับให้หน้าเว็บหลักมีพื้นหลังสีขาวด้วย ตารางจะได้เนียนเป็นเนื้อเดียวกัน */
/* ==============================
   สไตล์พื้นหลังหน้าเว็บ (รวมสีเขียวอ่อนเข้าด้วยกัน)
   ============================== */
body, body.admin-page-background {
    background-color: #26eb7b !important; /* พื้นหลังสีเขียวอ่อน สบายตา */
    overflow-x: hidden; /* กันหน้าจอเลื่อนแนวนอน */
}

/* ==============================
   Sidebar Layout & Topbar (รวมร่างแล้ว)
   ============================== */

/* ตั้งค่า Sidebar ยึดติดด้านซ้าย และเพิ่มเอฟเฟกต์พับเมนู */
#sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    transition: all 0.3s ease; /* ทำให้เลื่อนแบบสมูท */
    white-space: nowrap; /* ป้องกันตัวหนังสือล้นเวลาพับ */
    overflow-x: hidden;
}

/* พื้นที่เนื้อหาหลักขวามือ */
#main-content {
    width: calc(100% - 260px); /* คำนวณความกว้างหักลบเมนู */
    margin-left: 260px;
    min-height: 100vh;
    display: flex; /* กลับมาใช้ Flex เพื่อให้โครงสร้างไม่พัง */
    flex-direction: column;
    transition: all 0.3s ease; /* ทำให้เลื่อนแบบสมูท */
    background-color: transparent;
}

/* ==============================
   เมื่อกดพับ Sidebar (สั่งงานผ่าน JS)
   ============================== */
body.sidebar-collapsed #sidebar {
    margin-left: -260px; /* ซ่อนเมนูไปทางซ้ายสุด */
}
        
body.sidebar-collapsed #main-content {
    width: 100%; /* ขยายเนื้อหาหลักให้เต็มจอ */
    margin-left: 0;
}

/* ตกแต่งปุ่ม Hover สำหรับปุ่มเปิด/ปิดเมนู */
.btn-toggle-sidebar:hover {
    background-color: #e9ecef;
    transform: scale(1.05);
}

/* --------------------------------------
   (ส่วนอื่นๆ เช่น .table-container, .nav-tabs, .popup-container 
   ให้คงไว้เหมือนเดิมได้เลยครับ ไม่มีปัญหาอะไร) 
   -------------------------------------- */

  /* ปรับหัวตารางให้คลีนแบบแอปอินเตอร์ */
  .table thead th {
    position: sticky; 
    top: 0;
    background-color: #f1f5f9 !important;  /* [อัปเดต] พื้นหลังสีเทาอ่อน */
    color: #475569 !important; /* [อัปเดต] ข้อความสีเทาเข้ม */
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    text-transform: uppercase !important; /* ตัวพิมพ์ใหญ่ */
    padding: 1rem 1.5rem !important;
    border-bottom: none !important;
    z-index: 2;
  }

  /* ปรับช่องเซลล์ในตาราง */
  .table tbody td {
    padding: 1rem 1.5rem !important;
    vertical-align: middle;
    border-bottom: 1px solid #e2e8f0 !important;
  }

  .table td, .table th {
    text-align: center;
    vertical-align: middle;
    white-space: normal;
    word-wrap: break-word;
  }

  .table img {
    max-width: 150px;
    height: auto;
    border-radius: 8px;
  }

  .table tbody tr:hover {
    background-color: #f8f9fa;
    transform: translateY(-2px);
    transition: transform 0.2s ease;
  }

  /* ========================================
   * สไตล์ Popup (AI Alert) - คงเดิม 100%
   * ========================================
   */
  .popup-container {
    position: fixed; 
    top: 20px;
    right: 20px;
    z-index: 9999; 
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 350px;
    max-width: 90%;
    border-left: 5px solid #3498DB; 
  }

  .popup-content { padding: 20px; }
  .popup-content h3 { margin-top: 0; }

  .popup-buttons button {
    margin-top: 15px;
    margin-right: 10px;
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
  }

  .popup-buttons #goto-map-btn { background-color: #2980b9; color: white; }
  .popup-buttons #goto-table-btn { background-color: #f1c40f; color: #333; }
  .popup-buttons .close-btn { background-color: #aaa; color: white; }

  /* สีตามระดับผลกระทบ */
  .impact-High { border-left-color: #E74C3C; }
  .impact-Medium { border-left-color: #F39C12; }
  .impact-Low { border-left-color: #3498DB; }

  /* สไตล์สำหรับไฮไลท์ตาราง */
  .highlight-row {
    background-color: #fff3cd; 
    animation: fadeOutHighlight 5s forwards; 
  }

  @keyframes fadeOutHighlight {
    from { background-color: #fff3cd; }
    to { background-color: transparent; }
  }

  /* ================================
      ปรับแต่งแท็บเมนู (Bootstrap Tabs) - คงเดิม 100%
     ================================ */
  .nav-tabs {
      border-bottom: 2px solid #dee2e6; 
      margin-bottom: 0; 
  }
  .nav-tabs .nav-link {
      border: 1px solid transparent; 
      border-top-left-radius: .35rem; 
      border-top-right-radius: .35rem;
      padding: .75rem 1.25rem; 
      font-weight: 500; 
      color: #495057; 
      background-color: #f8f9fa; 
      transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; 
  }
  .nav-tabs .nav-link:hover:not(.active) { 
      background-color: #e9ecef; 
      border-color: transparent; 
      color: #0d6efd; 
  }
  .nav-tabs .nav-link.active {
      color: #0d6efd; 
      background-color: #fff; 
      border-color: #dee2e6 #dee2e6 #fff; 
      border-bottom-color: #fff; 
      font-weight: 700; 
  }
  .tab-content {
      background-color: #fff; 
      padding: 20px;
      border: 1px solid #dee2e6; 
      border-top: none; 
      border-radius: 0 0 .35rem .35rem; 
      box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
  }

  /* ==============================
   Sidebar Layout & Topbar
   ============================== */
body.admin-page-background {
    background-color: #f5f4f8 !important; /* พื้นหลังเทาอ่อน */
    overflow-x: hidden; /* กันหน้าจอเลื่อนแนวนอน */
}

/* ตั้งค่า Sidebar ยึดติดด้านซ้าย */
#sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
}

/* ตกแต่งปุ่มเมนูใน Sidebar ให้เหมือน Dash UI */
#sidebar .nav-pills .nav-link {
    color: #475569;
    border-radius: 0.5rem;
    padding: 0.75rem 1.25rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

#sidebar .nav-pills .nav-link:hover {
    background-color: #f1f5f9;
    color: #0d6efd; /* สีน้ำเงินตอน Hover */
}

#sidebar .nav-pills .nav-link.active {
    background-color: #e0e7ff; /* พื้นหลังสีฟ้าอ่อนตอนกดเลือก */
    color: #4338ca; /* สีน้ำเงินเข้ม */
    font-weight: 600;
}

/* พื้นที่เนื้อหาหลักขวามือ (ดันหลบ Sidebar 260px) */
#main-content {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* แถบ Topbar ด้านบน */
.topbar {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ยกเลิกกรอบของ Tab Content แบบเก่า เพราะเราจะกางเต็มจอแล้ว */
.tab-content {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

  /* =======================
      สไตล์หน้า Admin Login - คงเดิม 100%
     =======================*/
  .login-box {
      max-width: 380px;
      padding: 40px 35px;
      background: linear-gradient(145deg, #ffeaa7, #7e5c55); 
      border-radius: 25px; 
      box-shadow: 0 15px 35px rgba(236, 0, 0, 0.25);
      text-align: left;
      animation: fadeIn 0.8s ease-in-out;
      transition: transform 0.3s ease;
      margin: auto; 
  }
  .login-box:hover { transform: translateY(-3px); }
  .login-box h2 {
      margin-bottom: 30px;
      color: #2d3436;
      font-weight: 700;
      letter-spacing: 1px;
      font-size: 1.8rem;
  }
  .login-box .form-control { 
      padding: 16px 18px !important; 
      margin-bottom: 22px !important; 
      border: 1px solid #b2bec3;
      border-radius: 15px !important; 
      font-size: 1rem !important; 
      box-sizing: border-box;
      transition: border-color 0.3s ease, box-shadow 0.3s ease;
  }
  .login-box .form-control:focus {
      border-color: #6c5ce7;
      box-shadow: 0 0 12px rgba(108,92,231,0.5);
      outline: none;
  }
  .login-box button[type="submit"] { 
      width: 100%;
      background: linear-gradient(135deg, #6c5ce7, #a29bfe); 
      border: none;
      padding: 16px 0; 
      border-radius: 15px; 
      color: #fff;
      font-size: 1.15rem; 
      font-weight: 700; 
      cursor: pointer;
      transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
  }
  .login-box button[type="submit"]:hover {
      background: linear-gradient(135deg, #a29bfe, #6c5ce7);
      transform: translateY(-2px);
      box-shadow: 0 8px 25px rgba(0,0,0,0.35);
  }
  .login-box hr {
      margin-top: 25px;
      margin-bottom: 15px;
      border-top: 1px solid rgba(0,0,0,0.1);
  }
  .login-box p a { color: #6c5ce7; text-decoration: none; font-weight: 500; }
  .login-box p a:hover { text-decoration: underline; }
  .login-box .back-to-home-btn:hover {
      color:#ffffff;
      background-color: #6c5ce7; 
      transform: translateY(-1px);
  }


/* ขนาดมาตรฐานตอนเปิด Sidebar */
.sidebar {
    width: 250px; /* ความกว้างของเมนูด้านซ้าย */
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background-color: #ffffff;
    transition: all 0.3s ease; /* ทำให้ตอนย่อ/ขยายดูนุ่มนวล */
    z-index: 100;
}

/* ทำให้ Sidebar มี Animation สมูทๆ และเลื่อนซ่อนไปทางซ้ายเมื่อมีคลาส collapsed */
    #sidebar {
        transition: margin-left 0.3s ease;
    }
    #sidebar.collapsed {
        margin-left: -260px !important; /* บังคับซ่อน */
    }

    /* ทำให้ Main Content ขยายเต็มจอเมื่อมีคลาส expanded */
    #main-content {
        transition: margin-left 0.3s ease, width 0.3s ease;
    }
    #main-content.expanded {
        margin-left: 0 !important; /* บังคับให้ชิดซ้าย */
        width: 100% !important;    /* บังคับเต็มจอ */
    }
    

.filter-container {
    position: absolute;
    top: 70px;
    left: 20px;
    z-index: 1000;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    /* ลบ transition ออกเพื่อไม่ให้สั่น */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px; /* คุมความสูงให้เท่ากันทั้งตอนหุบและกาง */
}

/* ถ้าหน้าจอเล็กกว่า 768px (พวกมือถือ/แท็บเล็ต) */
@media (max-width: 768px) {
    .filter-container {
        top: 120px; /* เขยิบลงมาเยอะหน่อยในมือถือ */
        left: 10px;  /* ชิดซ้ายขึ้นอีกนิดเพื่อเพิ่มพื้นที่แผนที่ */
    }
}

.filter-container.collapsed {
    padding: 10px 15px;
    width: auto; /* ให้กว้างตามตัวหนังสือ "ประเภท" */
}

.filter-container.collapsed::after {
    content: 'ประเภท';
    font-weight: 500; /* ตัวบางตามที่ต้องการ */
    font-size: 14px;
    color: #555;
}

/* ซ่อนพวกนี้แบบไม่มี Animation */
.filter-container.collapsed label, 
.filter-container.collapsed select {
    display: none !important;
}