/* เพิ่ม CSS ที่นี่ */
.twitter-typeahead .tt-menu {
  background-color: white !important;
  border: 1px solid #ccc;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  /* z-index: 9999 !important; */
}

.twitter-typeahead .tt-suggestion {
  background-color: white !important;
  color: #333;
  padding: 8px 10px;
}

.twitter-typeahead .tt-suggestion.tt-cursor {
  background-color: #f0f0f0 !important;
  color: #333 !important;
}

.pro-qty {
  display: inline-flex;
  align-items: center;
  /* border: 1px solid #ddd; */
  border-radius: 4px;
  padding: 0 10px 0 10px;
}

.pro-qty .qty-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  background: #f8f9fa;
  transition: all 0.3s;
}

.pro-qty .qty-btn:hover {
  background: #ff6f00;
  color: white;
}

.pro-qty input {
  width: 50px;
  text-align: center;
  border: none;
  padding: 0;
  height: 32px;
}

#cancel_discount {
  background: transparent;
  border: none;
  color: red;
  cursor: pointer;
  font-size: 18px;
  margin-left: 5px;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fff;
}

.cart-item img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
}

.cart-item-details {
  flex: 1;
}

.cart-item-details h5 {
  margin: 0;
  font-size: 15px;
}

.cart-item-details small {
  color: #666;
}

.cart-item-price {
  font-weight: bold;
}

@media (max-width: 768px) {
  .cart-table table tr {
    /* display: grid; */
    /* grid-template-areas:
      "image title"
      "image price"
      "image qty"
      "image subtotal"
      "image remove"; */
    grid-template-columns: 100px 1fr;
    gap: 8px;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 10px;
    background: #fff;
  }
  .btn-remove {
    background: #e0e0e0;
    color: #333;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
  }

  .btn-remove:hover {
    background: #ccc;
  }
}

.btn.btn-sm.btn-secondary,
.btn-secondary {
  background: #e0e0e0;
  color: #333;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-secondary:hover {
  background: #ccc;
}
.pm-section {
  font-size: 14px;
  color: #333;
}

input[type="file"].form-control {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  height: 40px; /* บังคับให้สูงเท่ากับ input text */
  line-height: 24px;
}

/* FLASHSALE */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.flash-sale-header {
  /* background: linear-gradient(135deg, #9cceca 0%, #b9fff3 50%, #9cceca 100%); */
  background: linear-gradient(135deg, #6b0f9e 0%, #c41e92 50%, #ff8a56 100%);
  padding: 20px 15px;
  border-radius: 15px;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
}

.flash-sale-header::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 70%
  );
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

.flash-sale-content {
  position: relative;
  z-index: 1;
}

/* Desktop Layout */
.flash-sale-desktop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Mobile Layout */
.flash-sale-mobile {
  display: none;
}

.flash-sale-logo {
  flex-shrink: 0;
}

.flash-sale-logo img {
  width: 180px;
  height: auto;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
}

.time-slots-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.time-slots-label {
  color: white;
  font-size: 16px;
  font-weight: 600;
  text-align: right;
}

.time-slots {
  display: flex;
  gap: 0;
  background: white;
  border-radius: 50px;
  padding: 5px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.time-slot {
  flex: 1;
  padding: 15px 25px;
  background: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  font-weight: 600;
}

.time-slot .time {
  display: block;
  font-size: 20px;
  color: #333;
  margin-bottom: 3px;
}

.time-slot .status {
  display: block;
  font-size: 12px;
  color: #666;
}

.time-slot.active {
  background: linear-gradient(135deg, #ff6f00 0%, #ff6f00 100%) !important;
  color: white !important;
}

.time-slot.active .time,
.time-slot.active .status {
  color: white !important;
}
/* Mobile Time Slot - เพิ่มความแข็งแกร่ง */
@media (max-width: 768px) {
  .flash-sale-mobile .time-slot.active {
    background: linear-gradient(135deg, #ff6f00 0%, #ff6f00 100%) !important;
    color: white !important;
  }

  .flash-sale-mobile .time-slot.active .time,
  .flash-sale-mobile .time-slot.active .status {
    color: white !important;
  }
}

/* Desktop */
.flash-sale-desktop .time-slot.active {
  background: linear-gradient(135deg, #ff6f00 0%, #ff6f00 100%) !important;
  color: white !important;
}

.flash-sale-desktop .time-slot.active .time,
.flash-sale-desktop .time-slot.active .status {
  color: white !important;
}

.time-slot:hover:not(.active) {
  background: #f8f9fa;
  transform: translateY(-2px);
}

.countdown-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.countdown-label {
  color: white;
  font-size: 16px;
  font-weight: 600;
}

.countdown-timer {
  display: flex;
  gap: 10px;
}

.countdown-item {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  padding: 12px 18px;
  border-radius: 12px;
  min-width: 70px;
  text-align: center;
}

.countdown-number {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: white;
  line-height: 1;
}

.view-all-btn {
  background: white;
  color: #6b0f9e;
  border: none;
  padding: 12px 30px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-all-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.3);
}

/* Mobile Styles */
@media (max-width: 768px) {
  .flash-sale-desktop {
    display: none;
  }

  .flash-sale-mobile {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .flash-sale-mobile-header {
    display: flex;
    flex-direction: column; /* ให้เป็นแนวตั้ง */
    align-items: center; /* จัดกึ่งกลาง */
    gap: 20px; /* เว้นระยะระหว่าง logo กับ countdown */
  }

  .flash-sale-logo img {
    width: 140px;
  }

  .countdown-wrapper {
    align-items: flex-end;
  }

  .countdown-label {
    font-size: 14px;
  }

  .countdown-timer {
    gap: 8px;
  }

  .countdown-item {
    padding: 10px 14px;
    min-width: 55px;
  }

  .countdown-number {
    font-size: 24px;
  }

  .time-slots-wrapper {
    gap: 12px;
  }

  .time-slots-label {
    text-align: left;
    font-size: 14px;
  }

  .time-slots {
    border-radius: 40px;
    padding: 4px;
  }

  .time-slot {
    padding: 12px 15px;
  }

  .time-slot .time {
    font-size: 18px;
  }

  .time-slot .status {
    font-size: 11px;
  }

  .view-all-btn {
    width: 100%;
    justify-content: center;
    padding: 14px 30px;
  }
}

@media (max-width: 480px) {
  .flash-sale-header {
    padding: 15px 12px;
  }

  .flash-sale-logo img {
    width: 120px;
  }

  .countdown-item {
    padding: 8px 10px;
    min-width: 48px;
  }

  .countdown-number {
    font-size: 20px;
  }

  .time-slot {
    padding: 10px 8px;
  }

  .time-slot .time {
    font-size: 16px;
  }

  .time-slot .status {
    font-size: 10px;
  }

  /* Flash Sale Border - Gradient Animation */
  .flash-sale-border {
    position: relative;
    border: 1px solid transparent !important;
    /* background: linear-gradient(white, white) padding-box,
      linear-gradient(
          90deg,
          #ff0000,
          #ff6b00,
          #ffd700,
          #00ff00,
          #00bfff,
          #9400d3,
          #ff0000
        )
        border-box; */
    background-size: 400% 100%;
    animation: gradient-rotate 3s linear infinite;
    z-index: 1;
  }

  @keyframes gradient-rotate {
    0% {
      background-position: 0% 50%;
    }
    100% {
      background-position: 400% 50%;
    }
  }

  /* Flash Badge */
  .flash-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ff4444, #ff4444);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgb(255, 102, 0);
    animation: flash-pulse 1.5s ease-in-out infinite;
  }

  @keyframes flash-pulse {
    0%,
    100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.1);
    }
  }

  .flash-sale-border {
    position: relative;
    border: 1px solid transparent !important;
    /* box-shadow: 0 0 0 2px #ff0844, 0 0 20px rgba(21, 0, 177, 0.4); */
    /* animation: rainbow-border 3s linear infinite; */
    margin: 5px;
  }

  @keyframes rainbow-border {
    0% {
      box-shadow: 0 0 0 2px #ff0844, 0 0 20px rgba(255, 8, 68, 0.4);
    }
    16% {
      box-shadow: 0 0 0 2px #ff6b00, 0 0 20px rgba(255, 107, 0, 0.4);
    }
    33% {
      box-shadow: 0 0 0 2px #ffd700, 0 0 20px rgba(255, 215, 0, 0.4);
    }
    50% {
      box-shadow: 0 0 0 2px #00ff00, 0 0 20px rgba(0, 255, 0, 0.4);
    }
    66% {
      box-shadow: 0 0 0 2px #00bfff, 0 0 20px rgba(0, 191, 255, 0.4);
    }
    83% {
      box-shadow: 0 0 0 2px #9400d3, 0 0 20px rgba(148, 0, 211, 0.4);
    }
    100% {
      box-shadow: 0 0 0 2px #ff0844, 0 0 20px rgba(255, 8, 68, 0.4);
    }
  }

  #flash-countdown {
    animation: flash-blink 1.5s ease-in-out infinite;
  }

  @keyframes flash-blink {
    0%,
    100% {
      opacity: 1;
    }
    50% {
      opacity: 0.1;
    }
  }
}

/* Flash Badge - แก้ไข z-index และเพิ่ม pointer-events */
.flash-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #ff4444, #ff6b6b);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(255, 68, 68, 0.5);
  animation: flash-pulse 1.5s ease-in-out infinite;
  z-index: 1; /* เปลี่ยนจาก 10 เป็น 1 */
  pointer-events: none; /* สำคัญมาก! ให้คลิกทะลุผ่านได้ */
}

@keyframes flash-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.flash-sale-border {
  position: relative;
  border: 1px solid transparent;
  /* background: linear-gradient(white, white) padding-box,
    linear-gradient(90deg, #ff0844, #ffb199, #ff0844) border-box;
  background-size: 100%, 300% 100%;
  animation: gradient-move 2s linear infinite; */
  overflow: visible !important;
}

@keyframes gradient-move {
  0% {
    background-position: 0% 0%, 0% 50%;
  }
  100% {
    background-position: 0% 0%, 300% 50%;
  }
}

.flash-countdown-small {
  font-weight: 500;
  animation: flash-blink 1.5s ease-in-out infinite;
}

@keyframes flash-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* =============================================
   แก้ปัญหาปุ่มกดไม่ได้บนมือถือ
   ============================================= */

.rbt-card-body {
  position: relative;
  z-index: 2;
}

/* ปรับปรุงปุ่มให้กดได้บนมือถือ */
.addToCartForm {
  position: relative;
  z-index: 3;
}

.addToCartForm button[type="submit"] {
  position: relative;
  z-index: 10 !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* เพิ่ม active state สำหรับมือถือ */
.addToCartForm button[type="submit"]:active {
  transform: scale(0.98);
  transition: transform 0.1s;
}

.rbt-btn.btn-gradient {
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

/* ให้แน่ใจว่า form ไม่ถูกบล็อก */
.rbt-card {
  pointer-events: auto;
}

.rbt-card * {
  pointer-events: auto;
}

/* แก้ไขเฉพาะ badge และ animation ให้คลิกทะลุผ่าน */
.flash-badge,
.flash-sale-border::before,
.flash-sale-border::after {
  pointer-events: none !important;
}

/* สำหรับมือถือโดยเฉพาะ */
@media (max-width: 768px) {
  .addToCartForm button {
    min-height: 44px; /* ขนาดขั้นต่ำสำหรับ touch target */
    padding: 12px 20px;
  }

  .rbt-card {
    margin-bottom: 20px;
  }
}

/* Hover effect สำหรับ product card */
.product-card-wrapper {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card-wrapper:hover {
  transform: translateY(-5px);
}

.product-card-wrapper:active {
  transform: translateY(-2px);
}

/* Animation สำหรับ notification */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ปรับปรุง button ให้ดูชัดเจนว่ายังคลิกได้ */
.add-to-cart-btn {
  position: relative;
  z-index: 10;
}

.add-to-cart-btn:hover {
  transform: scale(1.05);
}

/* Custom styles for Privacy Policy Modal */
#privacyPolicyModal .modal-content {
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

#privacyPolicyModal .modal-header {
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  color: #fff;
}

#privacyPolicyModal .modal-body {
  padding: 30px;
  line-height: 1.8;
}

#privacyPolicyModal h5 {
  color: #f5670f;
  font-weight: 600;
  margin-top: 20px;
}

#privacyPolicyModal h6 {
  color: #192335;
  font-weight: 600;
}

#privacyPolicyModal ul,
#privacyPolicyModal ol {
  padding-left: 25px;
}

#privacyPolicyModal ul li,
#privacyPolicyModal ol li {
  margin-bottom: 10px;
}

#privacyPolicyModal .alert {
  border-radius: 8px;
  border-left: 4px solid;
}

#privacyPolicyModal .alert-info {
  border-left-color: #f5670f;
}

#privacyPolicyModal .alert-warning {
  border-left-color: #ffc107;
}

#privacyPolicyModal .alert-success {
  border-left-color: #28a745;
}

#privacyPolicyModal hr {
  border-top: 2px solid #e5e5e5;
}

/* Custom Modal Styles */
.modal-header {
  background: linear-gradient(135deg, #8ccec4 0%, #bbf8efff 100%);
  color: white;
  border-bottom: none;
}

.modal-header .btn-close {
  filter: brightness(0) invert(1);
}

.modal-title {
  font-weight: 600;
}

.modal-body {
  padding: 2rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-body h4 {
  color: #8ccec4;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

.modal-body h5 {
  color: #8ccec4;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.75rem;
}

.modal-body ul {
  padding-left: 1.5rem;
}

.modal-body li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.policy-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

.policy-section:last-child {
  border-bottom: none;
}

.highlight-box {
  background-color: #f8f9fa;
  padding: 1rem;
  border-left: 4px solid #8ccec4;
  margin: 1rem 0;
}

.contact-info {
  background: linear-gradient(135deg, #8ccec4 0%, #cafff7ff 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 8px;
  margin-top: 1.5rem;
}

/* Footer link hover effect */
.copyright-link a {
  cursor: pointer;
  transition: all 0.3s ease;
}

.copyright-link a:hover {
  color: #8ccec4;
  text-decoration: underline;
}

/* Overlay พื้นหลัง */
.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  animation: fadeIn 0.3s ease-in;
}

.popup-overlay.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* กล่อง Popup */
.popup-container {
  position: relative;
  background: white;
  border-radius: 15px;
  max-width: 600px;
  width: 90%;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s ease-out;
}

/* ส่วนเนื้อหา */
.popup-content {
  position: relative;
}

/* ปุ่มปิด */
.popup-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 10;
  color: #333;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.popup-close:hover {
  background: white;
  transform: rotate(90deg) scale(1.1);
}

/* รูปภาพ */
.popup-image {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
}

/* Footer */
.popup-footer {
  padding: 15px 20px;
  background: #f8f9fa;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-container input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.checkbox-container label {
  cursor: pointer;
  font-size: 14px;
  color: #555;
}

.popup-button {
  padding: 8px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
}

.popup-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .popup-container {
    max-width: 95%;
  }

  .popup-footer {
    flex-direction: column;
    gap: 10px;
  }

  .popup-button {
    width: 100%;
  }
}
