/* --- 1. Global & Variables (เปลี่ยนโทนสีหลักเป็นน้ำเงินเข้ม) --- */
:root {
  --primary-blue: #1a237e;     /* สีน้ำเงินเข้ม (Navy Blue) */
  --lucky-green: #198754;      /* เปลี่ยนตัวแปรเดิมให้เป็นน้ำเงินด้วย เพื่อให้ทุกหน้าเปลี่ยนตาม */
  --lucky-dark: #0d1440;       /* น้ำเงินดำ สำหรับ Gradient */
  --lucky-light: #e8eaf6;      /* ฟ้าอ่อนจางๆ สำหรับพื้นหลังส่วนฟอร์ม */
  --blue-gray: #6c757d;        /* สีเทาอมน้ำเงินปานกลาง */
  --white: #ffffff;
  --normal-yellow: #ffff00;            /* สีเหลืองมาตรฐาน */
  --bg-light: #f4f7f6;
  --text-dark: #333;
}

body {
  font-family: "Sarabun", sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  padding-bottom: 60px;
}

/* --- 2. Layout Containers --- */
.main-card {
  max-width: 900px;
  margin: 20px auto;
  background: var(--white);
  padding: 25px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* --- Header Section--- */
.header-section {
  background: #f5f5dc !important; /* สีพื้นหลัง ตัดกับตัวอักษรสีเข้ม */
  color: var(--primary-blue) !important;      /* ตัวอักษร navy blue */
  padding: 30px 25px !important;
  border-bottom: 1px solid #eeeeee; /* เส้นคั่นบางๆ ด้านล่าง */
  border-radius: 0px !important;    /* เอาขอบมนขนาดใหญ่ออก */
  box-shadow: none !important;      /* เอาเงาพื้นหลังออก */
  text-align: left !important;      /* จัดตัวอักษรชิดซ้าย */
}

/* บังคับสีตัวอักษรใน Header ให้ชัดเจน */
.header-section h2, 
.header-section h3, 
.header-section h4, 
.header-section p, 
.header-section span,
.header-section .text-muted {
  color: #333333 !important;
  opacity: 1 !important;
}

/* ปรับ Badge ชื่อร้านให้ดูเรียบหรู */
.store-badge {
  background: #f8f9fa !important;
  color: #198754 !important;
  border: 1px solid #dee2e6 !important;
  backdrop-filter: none !important;
}

/* --- 4. Menu & Grid (Dashboard) --- */
.menu-grid {
  max-width: 500px;
  margin: -30px auto 40px;
  padding: 0 15px;
}

.menu-item {
  background: var(--white);
  border-radius: 20px;
  padding: 22px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.menu-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(25, 135, 84, 0.12);
  color: var(--lucky-green);
  border-color: var(--lucky-green);
}

.icon-box {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; margin-right: 20px; flex-shrink: 0;
  transition: 0.3s;
}

/* --- 5. Forms & Inputs (SO/PO/TF) --- */
.qty-input {
  width: 75px !important;
  text-align: center;
  border-radius: 8px;
  font-weight: bold;
}

.price-select {
  min-width: 145px !important;
  border-radius: 8px;
}

.search-results, .supplier-results, .branch-results {
  position: absolute;
  z-index: 1050;
  width: 100%;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
}

/* --- 6. Sync & Pulse Animation --- */
.sync-info {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  padding: 15px 25px;
  display: inline-block;
  margin-top: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  text-align: left;
}

.dot {
  height: 10px; width: 10px;
  background-color: var(--lucky-green);
  border-radius: 50%; display: inline-block;
  margin-right: 10px; animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(25, 135, 84, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(25, 135, 84, 0); }
}

/* --- 7. History & Badge Styles --- */
.doc-badge {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-weight: bold; color: white;
}
.bg-so { background-color: var(--lucky-green); }
.bg-po { background-color: var(--primary-blue); }
.bg-tf { background-color: var(--blue-gray); }
.bg-bo { background-color: var(--normal-yellow); }

/* --- 8. Print Rules --- */
@media print {
  .no-print { display: none !important; }
  body { background: white !important; padding: 0; }
  .modal-content { border: none !important; box-shadow: none !important; }
}