/* ==============================
   Root Variables & Fonts
   ============================== */
:root {
  --font-body: 'Prompt', 'Sarabun', sans-serif;
  --card-radius: 1.5rem;
  --transition-fast: 0.2s;
  --bg-light: #f8f9fa;
  --bg-light-alt: #f9fafa;
  --bg-dark: #1e1e1e;
  --bg-dark-alt: #3a3a3a;
  --text-light: #e0e0e0;
  --text-dark: #212529;
  --border-light: #ddd;
  --border-alt: #e4e7eb;
  --brand-brown: #795548;
  --brand-brown-dark: #5d4037;
}

body {
  font-family: var(--font-body);
  background: var(--bg-light);
  color: var(--text-dark);
  transition: background 0.3s, color 0.3s;
}

/* ==============================
   Dark Mode
   ============================== */
body.dark-mode {
  background: var(--bg-dark);
  color: var(--text-light);
}

body.dark-mode .navbar,
body.dark-mode .footer,
body.dark-mode .bg-light {
  background-color: var(--bg-dark) !important;
  border-color: #333 !important;
}

body.dark-mode .product-card,
body.dark-mode .recent-orders-container {
  background-color: var(--bg-dark-alt);
  color: var(--text-light);
}

body.dark-mode .order-box img {
  background-color: #fff;
}

body.dark-mode .toast-body {
  color: var(--text-light);
}

body.dark-mode .order-box {
  background: var(--bg-dark-alt);
  color: var(--text-light);
  border-color: #444;
}

body.dark-mode .order-box:hover {
  background: #292929;
}

body.dark-mode .badge {
  background: #4c3829 !important;
  color: #fff !important;
}

body.dark-mode .timeline-content,
body.dark-mode .timeline-icon {
  background: #272522;
  color: #f9e0c5;
  border-color: var(--brand-brown);
}

body.dark-mode .text-success {
  color: #86efac !important;
}

body.dark-mode .product-card:hover {
  box-shadow: 0 10px 48px 0 #0004;
}

body.dark-mode .order-scroll {
  background: #222;
  border-color: #333;
}

body.dark-mode .modal-content {
  background: #28231e;
  color: #fff;
}

body.dark-mode .form-control {
  background: #2e2c2a;
  color: #fff;
  border-color: #444;
}

body.dark-mode .form-control:focus {
  background: #393633;
  color: #fff;
  border-color: #795548;
}

body.dark-mode .btn {
  filter: brightness(0.95);
}

body.dark-mode .bg-white {
  background: #262423 !important;
}

body.dark-mode .alert-warning {
  background: #433b2f !important;
  color: #ffe082 !important;
}

/* ==============================
   Navbar & Footer
   ============================== */
.navbar,
.footer {
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  transition: background-color 0.3s;
}

.navbar-brand {
  font-weight: bold;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
  color: var(--brand-brown);
}

.footer {
  border-top: 1px solid var(--border-light);
  color: #222;
}

/* ==============================
   Product Card
   ============================== */
.product-card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: 0 6px 32px 0 #0001;
  transition: box-shadow var(--transition-fast), background-color 0.2s;
  padding: 1.5rem 1rem;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-card:hover {
  box-shadow: 0 10px 48px 0 #0002;
  transform: translateY(-3px);
}

.product-image {
  object-fit: cover;
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 1rem;
  background: #fcfcfc;
}

/* ==============================
   Badges & Typography
   ============================== */
.badge {
  font-size: 0.8rem;
  padding: 0.35em 0.7em;
  letter-spacing: 0.2px;
}

.text-warning {
  font-size: 14px;
}

.text-success {
  color: #12b07a !important;
}

h2,
h4,
h5 {
  font-family: 'Prompt', 'Sarabun', sans-serif;
}

h2 {
  color: var(--brand-brown);
  font-weight: 700;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
}

/* ==============================
   Timeline Section
   ============================== */
.timeline {
  position: relative;
  margin: 2rem auto;
  max-width: 900px;
  padding-left: 10px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #79554822;
  border-radius: 2px;
}

.timeline-step {
  position: relative;
  display: flex;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.timeline-icon {
  background: #fff;
  border: 2px solid var(--brand-brown);
  color: var(--brand-brown);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-top: -4px;
}

.timeline-content {
  background: #fff;
  border-radius: 1rem;
  padding: 1rem 1.4rem;
  box-shadow: 0 1px 8px #0001;
  min-width: 0;
  flex: 1;
  border-left: 3px solid var(--brand-brown);
}

/* ==============================
   Recent Orders Scroll
   ============================== */
.recent-orders-container {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 1rem;
  padding: 1rem;
  margin-top: 2rem;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

.recent-orders-container h5 {
  font-weight: 600;
  color: #333;
}

.order-scroll {
  display: flex;
  overflow-x: auto;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background-color: var(--bg-light-alt);
  border: 1px solid var(--border-alt);
  border-radius: 8px;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.order-scroll::-webkit-scrollbar {
  display: none;
}

.order-box {
  background: var(--bg-light);
  color: var(--text-dark);
  min-width: 260px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.order-box img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #555;
  background: #fff;
  padding: 4px;
}

.order-box .fw-bold {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.order-box:hover {
  background: #e9ecef;
  transform: translateY(-2px);
}

#latest-orders .order-box {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==============================
   Floating Buttons
   ============================== */
#cart-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--brand-brown);
  color: #fff;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 3px 20px #0003;
  z-index: 1100;
  text-decoration: none;
  border: none;
  outline: none;
}

#cart-float:hover {
  color: #fff;
  background: #f3e7db;
}


#back-to-top {
  position: fixed;
  bottom: 95px;
  right: 26px;
  z-index: 1101;
  display: none;
}

/* Track Order Button */
.btn.position-fixed.start-0.bottom-0 {
  z-index: 1050;
}

/* ==============================
   Toast Container
   ============================== */
#toast-container {
  z-index: 1080;
  max-width: 300px;
}

/* ==============================
   Carousel (Review)
   ============================== */
.carousel-indicators [data-bs-target] {
  background: var(--brand-brown);
}

/* ==============================
   Banner on Mobile
   ============================== */
@media (max-width: 767px) {
  .promo-bottom-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background: #fffbe6;
    border-top: 1px solid #eedc82;
    padding: 10px 0 12px;
    text-align: center;
  }
}

/* ==============================
   Responsive Tweaks
   ============================== */
@media (max-width: 575px) {
  body {
    font-size: 15px;
  }

  h5.card-title {
    font-size: 1rem;
  }

  .product-card {
    padding: 1rem;
  }

  .navbar-brand {
    font-size: 1.1rem;
  }

  .timeline {
    padding-left: 10px;
  }

  .timeline-step {
    flex-direction: column;
    gap: 0;
  }

  .timeline-content {
    margin-top: 0.5rem;
  }
}


/* ==============================
   Button/Element Hover
   ============================== */
button:hover,
.btn:hover {
  filter: brightness(1.05);
}

/* ==============================
   Utility
   ============================== */
.fw-bold {
  font-weight: bold !important;
}

.step-card:hover {
  box-shadow: 0 8px 28px #0001;
  transform: translateY(-4px) scale(1.025);
  transition: 0.15s;
}

.step-circle {
  background: #fff7ed;
}

/* เพิ่ม Responsive เล็กน้อย */
@media (max-width: 576px) {
  .product-card {
    padding: .7rem;
  }

  .product-image {
    max-height: 120px;
  }
}

.alert.fade {
  opacity: 0;
  transition: opacity 0.4s;
}

#promo-banner.fade {
  opacity: 0;
  transition: opacity 0.4s;
}

.floating-draggable {
  position: fixed;
  z-index: 1055;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: box-shadow .2s;
  box-shadow: 0 3px 16px #0003;
  border-radius: 50px;
}
.floating-draggable:active {
  cursor: grabbing;
  box-shadow: 0 6px 30px #0004;
}

#track-float {
  background: #1976d2;
  color: #fff;
  font-size: 1.7rem;
  left: 22px;
  bottom: 100px;
  padding: 10px 18px 10px 18px;
  border: 2px solid #95bbd5;
  transition: background .18s;
}

#track-float:hover {
  background: #64b5f6;
}

@media (max-width: 520px) {

  #cart-float, #track-float {
    position: fixed;
    font-size: 1.5rem;
    padding: 7px 13px;
  }
}
.modal-zoom-img {
  max-width: 96vw;
  max-height: 80vh;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  transition: transform 0.3s;
  cursor: zoom-in;
}
  .modal-zoomed {
    cursor: zoom-out;
    transform: scale(2) !important;
    z-index: 1057;
  }
.award-img,
.award-img-wide {
  display: block;
  margin: 0 auto;
  width: auto !important;
  height: auto !important;
  max-width: 120px !important;
  max-height: 54px !important;
  object-fit: contain !important;
  border: 1.5px solid #eee;
  background: #fff;
  border-radius: 7px;
  box-shadow: 0 1px 4px #0001;
  padding: 2px 6px;
}

.award-img-wide {
  width: auto !important;      /* แก้ปัญหา img-fluid ของ Bootstrap */
  max-width: 120px !important; /* ไม่เกินขนาดที่ต้องการ */
  max-height: 54px !important;
  height: 54px !important;
  object-fit: contain !important;
  border: 1.5px solid #eee;
  padding: 2px 6px;
  background: #fff;
}

.award-img {
  max-height: 54px !important;
  width: auto !important;      /* ให้ทุก img ใน .award-img ไม่ขยายเกินจริง */
  object-fit: contain;
}

/* Responsive: ลดขนาดแนวนอนบนจอเล็ก */
@media (max-width: 767px) {
  .award-img, .award-img-wide {
    max-width: 90px !important;
    max-height: 40px !important;
  }
}

/* กำหนดให้รูปภาพใน modal ไม่เกินขอบ modal */
.modal-content {
  max-width: 96vw;
  width: 100%;
}

.modal-body {
  text-align: center;
  overflow: auto;
  padding: 1.2rem;
}

.modal-zoom-img,
#awardModalImg {
  max-width: 90vw;       /* ไม่เกิน viewport แนวนอน */
  max-height: 76vh;      /* ไม่เกินสูงสุด */
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  margin-left: auto;
  margin-right: auto;
  display: block;
}

#awardModal .modal-dialog {
  max-width: 98vw;
  margin: 1.5rem auto;
}
#awardModalImg,
.modal-zoom-img {
  max-width: 92vw;
  max-height: 74vh;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  margin: 0 auto;
  display: block;
}
#cookie-consent {
  backdrop-filter: blur(2px);
  font-size: 1.08rem;
}
.gallery-scroll::-webkit-scrollbar {
  height: 7px;
  background: #eee;
}
.gallery-scroll::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 8px;
}
.gallery-thumb:hover {
  filter: brightness(0.85) drop-shadow(0 0 3px #222);
}
@media (max-width: 768px) {
  #processGallery .carousel-item img {
    height: 200px !important;
  }
}

