/* ===== Design tokens ===== */
:root {
  --brand: #ea580c;
  --brand-hover: #c2410c;
  --brand-soft: #ffedd5;
  --ink: #0f172a;
  --ink-muted: #64748b;
  --surface: #ffffff;
  --bg: #f1f5f9;
  --border: #e2e8f0;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 16px 40px rgba(15, 23, 42, 0.12);
  --font: "IBM Plex Sans Thai", system-ui, sans-serif;
  --bs-primary: #ea580c;
  --bs-primary-rgb: 234, 88, 12;
  --bs-link-color: #ea580c;
  --bs-link-hover-color: #c2410c;
  --bs-border-radius: 10px;
  --bs-border-radius-lg: 14px;
}

/* ===== Base ===== */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

main.site-main {
  flex: 1;
}

/* ===== Navbar ===== */
.site-navbar {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #f97316);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.45);
}

.site-navbar .nav-link {
  color: rgba(255, 255, 255, 0.82) !important;
  font-weight: 500;
  padding: 0.45rem 0.85rem !important;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link.active {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.1);
}

.site-navbar .nav-link-admin {
  color: #fdba74 !important;
}

.site-navbar .user-greeting {
  color: #fde68a !important;
  font-size: 0.9rem;
}

.btn-nav-cart {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff !important;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
}

.btn-nav-cart:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff !important;
  transform: translateY(-1px);
}

.cart-badge {
  background: var(--brand);
  font-size: 0.7rem;
  min-width: 1.25rem;
}

/* ===== Main container ===== */
.site-main > .container {
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
}

/* Auto-style plain h4 page titles on inner pages */
.site-main > .container > h4:first-child {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  color: var(--ink);
}

/* ===== Page header ===== */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1,
.page-header .page-title {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--ink);
}

.page-header .page-subtitle {
  color: var(--ink-muted);
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
}

/* ===== Hero (home) ===== */
.shop-hero {
  background: linear-gradient(135deg, #0f172a 0%, #334155 50%, #1e293b 100%);
  border-radius: var(--radius);
  color: #fff;
  padding: 2rem 2.25rem;
  margin-bottom: 1.75rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.shop-hero::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(234, 88, 12, 0.35) 0%, transparent 70%);
  pointer-events: none;
}

.shop-hero h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  position: relative;
}

.shop-hero p {
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
  max-width: 36rem;
  position: relative;
}

.shop-hero .hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  position: relative;
}

.hero-tag {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
}

a.hero-tag {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

a.hero-tag:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
  transform: translateY(-1px);
}

.btn-line {
  background: #06c755;
  border-color: #06c755;
  color: #fff;
}

.btn-line:hover {
  background: #05b34c;
  border-color: #05b34c;
  color: #fff;
}

/* ===== Cards ===== */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s, transform 0.25s;
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.card-footer {
  background: #fafbfc !important;
  border-top: 1px solid var(--border);
}

.filter-card {
  position: sticky;
  top: 5.5rem;
}

.filter-card .card-body {
  padding: 1.25rem;
}

.filter-card .section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-bottom: 0.75rem;
}

.product-filter-mobile {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.product-filter-mobile .section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.product-filter-form--mobile .form-label-sm {
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0;
}

@media (max-width: 991.98px) {
  .shop-layout .filter-card {
    position: static;
  }

  .shop-hero {
    margin-bottom: 1rem;
    padding: 1.25rem 1.35rem;
  }

  .shop-hero h1 {
    font-size: 1.25rem;
  }

  .shop-hero .hero-tags {
    gap: 0.4rem;
  }

  .shop-hero .hero-tag {
    font-size: 0.72rem;
    padding: 0.2rem 0.55rem;
  }
}

/* ===== Product cards ===== */
.product-card {
  border: none;
  height: 100%;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.product-card .card-img-top {
  height: 200px;
  object-fit: cover;
  background: #e2e8f0;
}

.product-card .card-body {
  padding: 1.1rem 1.15rem 0.75rem;
}

.product-card .product-meta {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-bottom: 0.35rem;
}

.product-card .card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .product-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand);
}

.product-card .product-stock {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.product-card .card-footer {
  padding: 0.75rem 1rem 1rem;
  border-top: none;
  background: transparent !important;
}

.btn-product-detail .btn-label-short {
  display: none;
}

.product-pagination .btn.disabled {
  pointer-events: none;
  opacity: 0.55;
}

#product-catalog-body.is-loading {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#product-catalog-anchor {
  scroll-margin-top: 5.5rem;
}

/* มือถือ: 3 คอลัมน์ × 3 แถว (9 รายการ/หน้า จาก PHP) */
@media (max-width: 575.98px) {
  .product-list-grid .product-card .card-img-top,
  .product-list-grid .product-card .card-img-top.bg-light {
    height: 88px;
  }

  .product-list-grid .product-card .card-body {
    padding: 0.5rem 0.45rem 0.35rem;
  }

  .product-list-grid .product-card .product-meta {
    font-size: 0.6rem;
    line-height: 1.2;
    margin-bottom: 0.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .product-list-grid .product-card .card-title {
    font-size: 0.72rem;
    -webkit-line-clamp: 2;
    margin-bottom: 0.25rem;
  }

  .product-list-grid .product-card .product-price {
    font-size: 0.82rem;
  }

  .product-list-grid .product-card .product-stock {
    font-size: 0.6rem;
    display: none;
  }

  .product-list-grid .product-card .card-footer {
    padding: 0.35rem 0.4rem 0.5rem;
  }

  .product-list-grid .btn-product-detail {
    font-size: 0.65rem;
    padding: 0.3rem 0.25rem;
  }

  .product-list-grid .btn-product-detail .btn-label-full {
    display: none;
  }

  .product-list-grid .btn-product-detail .btn-label-short {
    display: inline;
  }

  .product-pagination .btn {
    font-size: 0.85rem;
    padding: 0.45rem 0.75rem;
  }
}

/* ===== Service cards ===== */
.service-card {
  border-left: 4px solid var(--brand);
}

.service-card .service-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand);
}

/* ===== Buttons ===== */
.btn {
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), #f97316);
  border: none;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-hover), var(--brand));
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
  border: none;
}

.btn-outline-primary {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-outline-primary:hover {
  background: var(--brand);
  border-color: var(--brand);
}

/* ===== Forms ===== */
.form-control,
.form-select {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

.form-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ink);
}

/* ===== Tables ===== */
.table {
  --bs-table-bg: transparent;
}

.table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  font-weight: 700;
  border-bottom-width: 1px;
  background: #f8fafc;
}

.table-hover tbody tr:hover {
  background: rgba(234, 88, 12, 0.04);
}

.table-responsive {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.table-responsive .table {
  margin-bottom: 0;
}

/* ===== Alerts ===== */
.alert {
  border: none;
  border-radius: var(--radius-sm);
  border-left: 4px solid;
  box-shadow: var(--shadow-sm);
}

.alert-success {
  background: #ecfdf5;
  border-left-color: #10b981;
  color: #065f46;
}

.alert-danger {
  background: #fef2f2;
  border-left-color: #ef4444;
  color: #991b1b;
}

.alert-info {
  background: #eff6ff;
  border-left-color: #3b82f6;
  color: #1e40af;
}

.alert-warning {
  background: #fffbeb;
  border-left-color: #f59e0b;
  color: #92400e;
}

/* ===== Badges ===== */
.badge {
  font-weight: 600;
  padding: 0.4em 0.65em;
  border-radius: 6px;
}

.badge.bg-secondary {
  background: #e2e8f0 !important;
  color: #475569 !important;
}

/* ===== Auth pages ===== */
body.page-auth .site-main > .container {
  max-width: 440px;
}

body.page-auth .card {
  border: none;
  box-shadow: var(--shadow);
}

body.page-auth h4 {
  text-align: center;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

/* ===== Admin ===== */
body.page-admin .page-header .page-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-menu {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.admin-menu-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.admin-menu-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--brand);
  color: var(--ink);
}

.admin-menu-card .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.admin-menu-card .label {
  font-weight: 700;
  font-size: 1rem;
}

.admin-menu-card .desc {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* ฟอร์มเปลี่ยนสถานะในตารางแอดมิน */
.table-admin th.admin-status-cell,
.table-admin td.admin-status-cell {
  min-width: 16.5rem;
  width: 16.5rem;
  max-width: 16.5rem;
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
  vertical-align: middle;
}

.admin-status-form {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.admin-status-picker {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.admin-status-picker:focus-within {
  z-index: 5;
}

.admin-status-select {
  width: 100%;
  min-width: 10.5rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  padding: 0.42rem 2rem 0.42rem 0.6rem;
  background-position: right 0.55rem center;
  background-size: 12px 9px;
}

.admin-status-save {
  flex: 0 0 auto;
  white-space: nowrap;
  width: auto;
  min-width: 4.25rem;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

/* ===== List group (legacy admin links) ===== */
.list-group-item {
  border-color: var(--border);
  padding: 0.85rem 1.1rem;
  font-weight: 500;
}

.list-group-item-action:hover {
  background: var(--brand-soft);
  color: var(--brand-hover);
}

/* ===== Footer ===== */
.site-footer {
  background: #0f172a;
  color: rgba(255, 255, 255, 0.75);
  margin-top: auto;
  padding: 2.5rem 0 1.5rem;
}

.site-footer h6 {
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.85rem;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
}

.site-footer a:hover {
  color: #fdba74;
}

.site-footer .footer-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.site-footer .footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 2rem;
  padding-top: 1rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ===== Modal ===== */
.modal-content {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
}

.modal-header {
  border-bottom: 1px solid var(--border);
}

/* ===== Utilities ===== */
.text-muted {
  color: var(--ink-muted) !important;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.empty-state .icon {
  font-size: 2.5rem;
  color: var(--ink-muted);
  margin-bottom: 0.75rem;
}

.line-qr {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 0.5rem;
  background: #fff;
}

.map-embed {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  background: #e2e8f0;
  box-shadow: var(--shadow-sm);
}

.map-embed iframe {
  display: block;
  width: 100%;
  height: 200px;
  border: 0;
}

.order-item-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.order-item-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: var(--ink-muted);
  font-size: 1.25rem;
}

@media (max-width: 991.98px) {
  .filter-card {
    position: static;
  }

  .shop-hero {
    padding: 1.5rem;
  }

  .shop-hero h1 {
    font-size: 1.4rem;
  }
}
