/* ===== สีและตัวอักษรหลักของเว็บ (แก้สีร้านได้ตรงนี้) =====
   โทนสีร้าน : แดง - ดำ - ขาว - เทา
   อยากเปลี่ยนเฉดสีแดงทั้งเว็บ แก้แค่ 3 บรรทัดแรก (--brand, --brand-dark, --brand-soft) */
:root {
  --brand: #c8102e;         /* แดงหลักของร้าน */
  --brand-dark: #8f0a20;    /* แดงเข้ม ใช้ตอนเอาเมาส์ชี้ */
  --brand-soft: #fdecee;    /* แดงอ่อนมาก ใช้เป็นพื้นหลัง */
  --sky: #f0a8b1;           /* แดงอ่อน ใช้บนพื้นสีดำ */
  --sand: #e5e7eb;          /* เทาอ่อน */
  --ink: #121417;           /* ดำ สีตัวอักษรหลัก */
  --muted: #6b7280;         /* เทา สีตัวอักษรจาง */
  --steel: #d8dadd;         /* เทาอ่อน เส้นขอบ */
  --soft: #f5f6f7;          /* เทาจาง พื้นหลัง */
  --graphite: #15171a;      /* ดำเทา ใช้กับแถบบนหลังร้านและส่วนท้าย */
  --shadow: 0 2px 8px rgba(0, 0, 0, .07);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .14);
}

body {
  font-family: 'Sarabun', sans-serif;
  color: var(--ink);
  background: #fff;
  font-size: .97rem;
}
h1, h2, h3, h4, h5, h6, .navbar, .btn, .brand-name { font-family: 'Prompt', sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
.text-brand { color: var(--brand) !important; }
.bg-brand { background: var(--brand) !important; }
.card { border: 1px solid var(--steel); border-radius: 14px; box-shadow: var(--shadow); }
.form-control:focus, .form-select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(200, 16, 46, .15);
}

/* ปุ่ม */
.btn { border-radius: 9px; font-weight: 500; }
.btn-brand { background: var(--brand); color: #fff; border: none; box-shadow: 0 2px 6px rgba(200,16,46,.28); }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); color: #fff; }
.btn-outline-brand { border: 1px solid var(--brand); color: var(--brand); background: #fff; }
.btn-outline-brand:hover { background: var(--brand); color: #fff; }

/* แถบบนและเมนู */
.topbar {
  background: var(--graphite);
  color: rgba(255,255,255,.82); font-size: .85rem; padding: 7px 0;
  border-bottom: 2px solid var(--brand);
}
.topbar a { color: #fff; margin-left: 18px; }
.topbar a:hover { color: var(--sky); }
.brand-logo {
  display: inline-flex; align-items: center; justify-content: center;
  height: 50px; flex: 0 0 auto;
}
.brand-logo img { height: 100%; width: auto; object-fit: contain; display: block; }
.brand-logo-lg { height: 84px; }
.brand-name { font-weight: 600; font-size: 1.02rem; letter-spacing: .1px; }
.brand-sub { font-size: .7rem; letter-spacing: 1.6px; color: var(--brand); font-weight: 600; }
.navbar-dark .brand-sub { color: var(--sky); }
.navbar { padding-top: .6rem; padding-bottom: .6rem; }
.navbar .nav-link { font-weight: 500; padding-left: .85rem; padding-right: .85rem; }
.navbar .dropdown-menu { max-height: 70vh; overflow-y: auto; border-radius: 12px; border-color: var(--steel); box-shadow: var(--shadow-lg); }
.navbar-light .nav-link:hover, .navbar-light .nav-link.active { color: var(--brand); }
.nav-search { min-width: 320px; }
/* หน้าร้านบนคอม: แถวบน = ค้นหา ตะกร้า เข้าสู่ระบบ / แถวล่าง = เมนู (กันเมนูตกบรรทัดเมื่อจอไม่กว้างมาก) */
@media (min-width: 992px) {
  .shop-collapse { flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; }
  .shop-tools { display: flex; align-items: center; justify-content: flex-end; width: 100%; }
  .shop-tools .nav-search { min-width: 0; flex: 0 1 400px; }
  .shop-nav { width: 100%; justify-content: flex-end; }
  .shop-nav .nav-link { white-space: nowrap; padding-top: .3rem; padding-bottom: .3rem; }
}
.nav-search .form-control { border-radius: 9px 0 0 9px; border-color: var(--steel); }
.nav-search .btn { border-radius: 0 9px 9px 0; }

/* ส่วนหัวใหญ่ (Hero) */
.hero {
  position: relative; color: #fff; margin-top: -1rem; overflow: hidden;
  background:
    radial-gradient(circle at 78% 28%, rgba(200, 16, 46, .55), transparent 52%),
    linear-gradient(120deg, #0a0b0d 0%, #1b1e22 58%, #2b3036 100%);
}
.hero::after {
  /* เส้นตารางจางๆ ให้ดูเป็นงานช่าง */
  content: ""; position: absolute; inset: 0; opacity: .10; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.7) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.7) 1px, transparent 1px);
  background-size: 56px 56px;
}
.hero > .container { position: relative; z-index: 1; }
.hero-tag {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
  padding: 5px 14px; border-radius: 30px; font-size: .85rem; letter-spacing: .3px;
}
.hero-title { font-weight: 600; font-size: clamp(1.7rem, 3.8vw, 2.6rem); line-height: 1.3; }
.hero-sub { color: rgba(255,255,255,.85); font-size: 1.05rem; }
.hero-logo {
  width: 380px; max-width: 85%;
  filter: drop-shadow(0 14px 30px rgba(0,0,0,.35));
}
.hero-search {
  display: flex; align-items: center; background: #fff; border-radius: 14px; padding: 7px;
  max-width: 640px; box-shadow: 0 14px 34px rgba(0,0,0,.2);
}
.hero-search > i { color: var(--muted); padding: 0 12px; font-size: 1.2rem; }
.hero-search .form-control { border: none; box-shadow: none; font-size: 1rem; }
.hero-search .btn { border-radius: 10px; white-space: nowrap; padding-left: 1.6rem; padding-right: 1.6rem; }
.quick-tags a {
  display: inline-block; color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 20px; padding: 3px 13px; margin: 3px 2px; font-size: .85rem;
}
.quick-tags a:hover { background: #fff; color: var(--brand-dark); border-color: #fff; }

/* จุดเด่นร้าน */
.features { margin-top: -30px; position: relative; z-index: 2; }
.feature {
  background: #fff; border: 1px solid var(--steel); border-radius: 14px; box-shadow: var(--shadow);
  padding: 16px; display: flex; align-items: center; gap: 12px; height: 100%;
  font-family: 'Prompt', sans-serif; font-weight: 500; font-size: .95rem;
}
.feature i { font-size: 1.7rem; color: var(--brand); }

/* หัวข้อ section */
.section-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; gap: 12px; }
.section-head h2 {
  font-size: 1.4rem; font-weight: 600; margin: 0; padding-left: 12px;
  border-left: 4px solid var(--brand);
}

/* หมวดหมู่ */
.category-block { border: 1px solid var(--steel); border-radius: 16px; overflow: hidden; height: 100%; box-shadow: var(--shadow); }
.category-main {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  background: var(--brand-soft); color: var(--ink); transition: .2s;
}
.category-main:hover { background: var(--brand); color: #fff; }
.category-main > i:first-child { font-size: 2rem; color: var(--brand); }
.category-main:hover > i:first-child { color: #fff; }
.category-main strong { display: block; font-family: 'Prompt', sans-serif; font-size: 1.12rem; font-weight: 600; }
.category-main small { display: block; opacity: .75; }
.category-main > div { flex: 1 1 auto; min-width: 0; }
.category-main > i { flex: 0 0 auto; }
.category-subs { padding: 14px 20px; display: flex; flex-wrap: wrap; gap: 8px; background: #fff; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  border: 1px solid var(--steel); border-radius: 20px; padding: 4px 12px; color: var(--ink); font-size: .88rem;
  line-height: 1.4;
}
.chip span {
  flex: 0 0 auto; background: var(--soft); border-radius: 10px; padding: 0 6px; font-size: .75rem; color: var(--muted);
  white-space: nowrap;
}
.chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* การ์ดสินค้า */
.product-card { border: 1px solid var(--steel); border-radius: 14px; overflow: hidden; transition: .2s; box-shadow: var(--shadow); }
.product-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: var(--brand); }
.product-thumb { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--soft); }
.product-thumb img { width: 100%; height: 100%; object-fit: contain; }
.stock-badge { position: absolute; top: 8px; left: 8px; font-size: .75rem; padding: 3px 9px; border-radius: 20px; color: #fff; }
.product-name {
  color: var(--ink); font-weight: 600; font-size: .9rem; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.product-name:hover { color: var(--brand); }
.price { color: var(--brand); font-family: 'Prompt', sans-serif; font-weight: 600; font-size: 1.15rem; }

/* ป้ายลดราคาและราคาเดิม */
.sale-badge {
  position: absolute; top: 8px; right: 8px; background: var(--brand); color: #fff;
  font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  font-family: 'Prompt', sans-serif;
}
.price-old { color: var(--muted); text-decoration: line-through; font-size: .9rem; }

/* กล่องราคาโปรโมชั่นในหน้าแก้ไขสินค้า */
.promo-box { background: var(--brand-soft); border: 1px solid #f7cdd3; border-radius: 12px; padding: 14px; }

/* การชำระเงิน */
.bank-row { border-left: 4px solid var(--brand); background: var(--soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.promptpay-box { border: 1px solid var(--steel); border-radius: 14px; padding: 14px; background: #fff; }
.promptpay-box img { max-width: 240px; }
.slip-thumb { max-width: 100%; max-height: 320px; border-radius: 12px; border: 1px solid var(--steel); }

/* กล่องแจ้งเตือนคำสั่งซื้อใหม่ */
.order-toast { border-left: 5px solid var(--brand); box-shadow: var(--shadow-lg); }
.order-toast .toast-header { background: var(--brand-soft); }

/* กล่องสถานะสินค้าในหน้าแก้ไข */
.status-box { background: var(--soft); border: 1px solid var(--steel); border-radius: 12px; padding: 14px; }
.form-switch .form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* บัตรโค้ดส่วนลด */
.coupon-card {
  display: flex; border: 1px dashed var(--brand); border-radius: 14px; overflow: hidden;
  background: var(--brand-soft);
}
.coupon-value {
  background: var(--brand); color: #fff; padding: 16px 12px; min-width: 104px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: 'Prompt', sans-serif; font-weight: 600; font-size: 1.05rem; line-height: 1.3;
}
.coupon-body { padding: 12px 16px; }
.coupon-code {
  font-family: 'Prompt', sans-serif; font-weight: 700; font-size: 1.1rem;
  letter-spacing: 1px; color: var(--brand-dark);
}
.coupon-box { background: var(--soft); border: 1px solid var(--steel); border-radius: 12px; padding: 12px; }

/* กล่องไม่มีรูป */
.no-image {
  width: 100%; height: 100%; min-height: 120px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #9aa0a6; background: var(--soft); gap: 4px;
}
.no-image i { font-size: 2.4rem; }
.no-image span { font-size: .78rem; }

/* หน้ารายละเอียด */
.detail-image {
  aspect-ratio: 1 / 1; border: 1px solid var(--steel); border-radius: 16px; overflow: hidden;
  background: var(--soft); box-shadow: var(--shadow);
}
.detail-image img { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery-thumb {
  width: 64px; height: 64px; padding: 0; border: 2px solid var(--steel); border-radius: 10px;
  overflow: hidden; background: var(--soft); cursor: pointer;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb.active, .gallery-thumb:hover { border-color: var(--brand); }

/* ช่องรูปอื่นๆ ในฟอร์มสินค้า */
.extra-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.extra-box {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; width: 100%;
  border: 2px dashed var(--steel); border-radius: 10px; overflow: hidden; background: var(--soft); cursor: pointer;
}
.extra-box:hover { border-color: var(--brand); }
.extra-box img { width: 100%; height: 100%; object-fit: cover; }
.extra-empty { display: flex; flex-direction: column; align-items: center; font-size: .75rem; color: var(--muted); }
.extra-empty i { font-size: 1.3rem; }
.detail-title { font-size: 1.4rem; font-weight: 600; line-height: 1.45; }
.detail-price { font-family: 'Prompt', sans-serif; font-size: 2.1rem; font-weight: 700; color: var(--brand); }
.info-box { background: var(--brand-soft); border: 1px solid #f7cdd3; border-radius: 14px; padding: 18px; }

/* ตัวกรองหน้าสินค้า */
.member-btn { white-space: nowrap; }
.filter-box { border: 1px solid var(--steel); border-radius: 14px; padding: 14px; position: sticky; top: 90px; box-shadow: var(--shadow); }
.filter-title { font-weight: 600; border-bottom: 2px solid var(--brand); padding-bottom: 8px; }
.filter-link { display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink); }
.filter-link.sub { padding-left: 24px; font-size: .9rem; }
/* ชื่อหมวดย่อยกับจำนวนสินค้า วางคนละช่อง ชื่อยาวจะขึ้นบรรทัดใหม่ในช่องของตัวเอง ไม่ทับตัวเลข */
.filter-link.sub { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.filter-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; line-height: 1.4; }
.filter-count {
  flex: 0 0 auto; min-width: 26px; text-align: center; font-size: .75rem; line-height: 1.5;
  padding: 0 6px; border-radius: 10px; background: var(--soft); color: var(--muted);
}
.filter-link:hover { background: var(--brand-soft); color: var(--brand); }
.filter-link.active { background: var(--brand); color: #fff; }
.filter-link.active .text-muted { color: #fff !important; }
.filter-link.active .filter-count { background: rgba(255, 255, 255, .25); color: #fff; }

.empty-box { text-align: center; padding: 48px 16px; background: var(--soft); border-radius: 14px; }
.empty-box i { font-size: 3rem; color: #9aa0a6; }

/* ปุ่มเปลี่ยนหน้า */
.pagination .page-link { color: var(--brand); border-color: var(--steel); }
.pagination .page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }

/* แถบติดต่อ */
.contact-strip {
  background: linear-gradient(120deg, #15171a 0%, #3a1016 55%, var(--brand) 100%); color: #fff;
  border-radius: 18px; padding: 30px; display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: center; gap: 16px;
  box-shadow: var(--shadow-lg);
}

/* ส่วนท้าย */
.site-footer { background: var(--graphite); color: #c9ccd1; border-top: 4px solid var(--brand); }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--sky); }
.footer-title { color: #fff; font-weight: 600; margin-bottom: 12px; border-left: 3px solid var(--brand); padding-left: 9px; }
.footer-bottom { background: #0b0c0e; color: #8c9197; }

/* ขั้นตอนติดตามพัสดุ */
.track-step { color: #9aa0a6; }
.track-step i {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%; font-size: 1.3rem;
  background: var(--soft); border: 2px solid var(--steel);
}
.track-step.done { color: var(--brand); }
.track-step.done i { background: var(--brand-soft); border-color: var(--brand); }

/* ปุ่มลอยส่งข้อความ */
.chat-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 1050;
  background: var(--brand); color: #fff; border: none; border-radius: 30px;
  padding: 12px 20px; font-family: 'Prompt', sans-serif; font-size: 1rem;
  box-shadow: 0 10px 26px rgba(200, 16, 46, .4);
}
.chat-fab i { font-size: 1.2rem; vertical-align: middle; }
.chat-fab:hover { background: var(--brand-dark); }

/* ===== ส่วนหลังร้าน ===== */
.staff-body { background: #f1f2f4; }
.navbar-dark.bg-dark { background: var(--graphite) !important; border-bottom: 3px solid var(--brand); }
.stat-card {
  border-radius: 16px; padding: 20px; color: #fff; display: flex;
  justify-content: space-between; align-items: center; height: 100%;
  box-shadow: var(--shadow-lg);
}
.stat-card i { font-size: 2.8rem; opacity: .3; }
.stat-card.c-red { background: linear-gradient(135deg, #c8102e, #e23b52); }
.stat-card.c-dark { background: linear-gradient(135deg, #121417, #3b4149); }
.stat-card.c-gold { background: linear-gradient(135deg, #4b5159, #808791); }
.stat-label { font-size: .93rem; opacity: .92; }
.stat-value { font-family: 'Prompt', sans-serif; font-size: 1.85rem; font-weight: 600; }
.stat-sub { font-size: .8rem; opacity: .85; }
.thumb-sm { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--soft); }
.thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.thumb-sm .no-image { min-height: 56px; }
.thumb-sm .no-image i { font-size: 1.3rem; }
.thumb-sm .no-image span { display: none; }
.table > :not(caption) > * > * { padding: .7rem .6rem; }
.progress-bar.bg-brand { background: var(--brand) !important; }

@media (max-width: 576px) {
  .nav-search { min-width: 0; width: 100%; }
  .stat-value { font-size: 1.5rem; }
  .detail-price { font-size: 1.75rem; }
  .brand-logo { height: 40px; }
  .brand-name { font-size: .88rem; }
  .contact-strip { padding: 22px; }
}
