/* ===== ELIMINATE DEFAULT BROWSER BLACK OUTLINE ON FOCUS/CLICK ===== */
a:focus,
a:active,
button:focus,
button:active,
input:focus,
input:active,
select:focus,
select:active,
textarea:focus,
textarea:active,
.btn:focus,
.btn:active,
.dropdown-toggle:focus,
.dropdown-toggle:active,
*:focus {
  outline: none !important;
  box-shadow: none !important;
}

.product-tabs .tab-pane {
    max-height: 380px !important;
    overflow-y: auto !important;
    padding-right: 15px !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
}

.product-tabs .tab-pane * {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
}


.product-tabs .tab-pane::-webkit-scrollbar {
    width: 6px !important;
}
.product-tabs .tab-pane::-webkit-scrollbar-track {
    background: #f8fafc !important;
}
.product-tabs .tab-pane::-webkit-scrollbar-thumb {
    background: #cbd5e1 !important;
    border-radius: 3px !important;
}
.product-tabs .tab-pane::-webkit-scrollbar-thumb:hover {
    background: #94a3b8 !important;
}

/* ===== PRODUCT ACTIONS BUTTONS (DESKTOP OVERRIDES) ===== */
.product-page-actions-list .btn {
    font-size: 12.5px !important;
    padding: 6px 8px !important;
    height: 40px !important;
    border-radius: 5px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
}

.product-page-actions-list .btn-advice {
    background: #059669 !important;
    background-color: #059669 !important;
    border: 1px solid #059669 !important;
    color: #fff !important;
    box-shadow: 0 2px 5px rgba(5, 150, 105, 0.2) !important;
    transition: all 0.2s ease-in-out !important;
}

.product-page-actions-list .btn-advice:hover,
.product-page-actions-list .btn-advice:focus,
.product-page-actions-list .btn-advice:active {
    background: #047857 !important;
    background-color: #047857 !important;
    border-color: #047857 !important;
    color: #fff !important;
}

@media (min-width: 992px) {
  .product-page-actions-list {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
    max-width: 480px !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
  }

  .product-page-actions-list > li {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .product-page-actions-list > li > a,
  .product-page-actions-list > li > form,
  .product-page-actions-list > li > button {
    flex: 1 1 calc(50% - 4px) !important;
    width: calc(50% - 4px) !important;
    min-width: 180px !important;
    margin: 0 !important;
    text-align: center !important;
  }

  .product-page-actions-list > li > form {
    display: inline-flex !important;
  }

  .product-page-actions-list > li > form button {
    width: 100% !important;
    height: 40px !important;
  }
}

/* Ensure products inside detail carousels stretch to fill the owl-item container width */
.owl-detail-carousel .product-best-seller {
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Unloaded Carousel Fallback to prevent vertical stacking and layout shifts (All screens) */
.owl-detail-carousel:not(.owl-loaded) {
  display: flex !important;
  overflow-x: auto !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  gap: 15px !important;
  padding-bottom: 10px !important;
  -webkit-overflow-scrolling: touch !important;
}

.owl-detail-carousel:not(.owl-loaded) > div {
  flex: 0 0 20% !important; /* 5 items on desktop */
  min-width: 180px !important;
  max-width: 240px !important;
}

/* ===== RESPONSIVE ACTIONS LIST & CAROUSEL ON MOBILE ===== */
@media (max-width: 991px) {
  .product-page-actions-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 0 !important;
    list-style: none !important;
    width: 100% !important;
    margin: 15px 0 !important;
  }
  
  .product-page-actions-list > li {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Buttons general styling on mobile */
  .product-page-actions-list .btn,
  .product-page-actions-list form {
    margin: 0 !important;
    height: 38px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border-radius: 5px !important;
    white-space: nowrap !important;
  }

  /* Adjust internal form buttons */
  .product-page-actions-list form {
    display: inline-flex !important;
  }
  .product-page-actions-list form button {
    width: 100% !important;
    height: 100% !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border-radius: 5px !important;
    white-space: nowrap !important;
    margin: 0 !important;
  }

  /* IN STOCK LAYOUT */
  /* Row 1: Thêm giỏ hàng (btn-primary) and Mua ngay (form) */
  .product-page-actions-list .btn-primary,
  .product-page-actions-list form {
    flex: 1 0 calc(50% - 5px) !important;
    width: calc(50% - 5px) !important;
  }

  /* Row 2: Quan tâm (btn-danger) and Tư vấn (button) - 2 buttons per row on mobile just like PC */
  .product-page-actions-list .btn-danger,
  .product-page-actions-list button[onclick*="openAdviceModal"] {
    flex: 1 0 calc(50% - 5px) !important;
    width: calc(50% - 5px) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
  }

  /* OUT OF STOCK LAYOUT */
  /* Row 1: Tạm hết hàng / Ngưng bán (disabled) should take 100% width */
  .product-page-actions-list button[disabled] {
    flex: 1 0 100% !important;
    width: 100% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .owl-detail-carousel:not(.owl-loaded) > div {
    flex: 0 0 160px !important;
    width: 160px !important;
    max-width: 160px !important;
  }
}

/* ===== PRODUCT DETAIL PRICE, TITLE & TABS CUSTOM OPTIMIZATION ===== */

/* 1. Price & Title Font Size Tweak */
.product-detail-name {
  font-size: 20px !important;
}

.detail-price-new {
  font-size: 22px !important;
}

@media (max-width: 767px) {
  .product-detail-name {
    font-size: 17px !important;
  }
  
  .detail-price-new {
    font-size: 18px !important;
  }
}

/* 2. Tabs Alignment & Mobile/Tablet Scroll Tweak */
.product-tabs .nav-tabs {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important; /* Hide scrollbar for Firefox */
  border-bottom: 2px solid #e8f5e9 !important;
}

.product-tabs .nav-tabs::-webkit-scrollbar {
  display: none !important; /* Hide scrollbar for Chrome, Safari, and Opera */
}

.product-tabs .nav-tabs > li {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  margin-bottom: -2px !important;
}

.product-tabs .nav-tabs > li > a {
  font-size: 14px !important;
  padding: 10px 16px !important;
}

@media (max-width: 480px) {
  .product-tabs .nav-tabs > li > a {
    font-size: 13px !important;
    padding: 8px 12px !important;
  }
}

/* ===== OWL CAROUSEL DOTS POSITION AND STYLE OPTIMIZATION ===== */
.owl-detail-carousel.owl-nav-dots-inner .owl-dots {
  position: relative !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  margin-top: 15px !important;
  margin-bottom: 15px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  float: none !important;
  width: 100% !important;
}

.owl-detail-carousel.owl-nav-dots-inner .owl-dots .owl-dot {
  float: none !important;
  display: inline-block !important;
  background-color: #cbd5e1 !important; /* Neutral soft gray dot background */
  border: 1px solid #94a3b8 !important;
  box-shadow: none !important;
  transition: background-color 0.2s, transform 0.2s !important;
}

.owl-detail-carousel.owl-nav-dots-inner .owl-dots .owl-dot.active {
  background-color: #00833d !important; /* Theme active green dot color */
  border-color: #00833d !important;
  transform: scale(1.3) !important;
}

/* ===== ADVICE MODAL PREMIUM DESIGN ===== */
#adviceModal .modal-dialog {
  width: 95% !important;
  max-width: 500px !important;
  margin: 30px auto !important;
  display: inline-block !important;
}

@media (max-width: 767px) {
  #adviceModal {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  #adviceModal .modal-dialog {
    display: block !important; /* Standard block on mobile for scrolling, vertical-align: top */
    width: calc(100% - 20px) !important;
    max-width: 480px !important;
    margin: 15px auto !important;
    vertical-align: top !important;
  }
  
  #adviceModal .modal-header h4 {
    font-size: 16px !important;
  }

  #adviceModal .modal-body {
    padding: 15px !important;
  }

  #adviceModal .modal-footer {
    padding: 12px 15px !important;
  }
}

#adviceModal .modal-content {
  border-radius: 12px !important;
  border: none !important;
  overflow: hidden !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
  height: auto !important; /* Resets global styles.css height: 355px override! */
  min-height: unset !important;
  max-height: unset !important;
}

#adviceModal .modal-header {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  color: #fff !important;
  padding: 18px 20px !important;
  border-bottom: none !important;
  position: relative !important;
}

#adviceModal .modal-header .close {
  width: 28px !important;
  height: 28px !important;
  position: absolute !important;
  top: 50% !important;
  right: 15px !important;
  transform: translateY(-50%) !important;
  opacity: 0.8 !important;
  color: #fff !important;
  background: rgba(255, 255, 255, 0.15) !important;
  border-radius: 50% !important;
  border: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 20px !important;
  line-height: 1 !important;
  padding: 0 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  float: none !important;
}

#adviceModal .modal-header .close:hover {
  opacity: 1 !important;
  background: rgba(255, 255, 255, 0.3) !important;
  transform: translateY(-50%) scale(1.05) !important;
}

#adviceModal .modal-body {
  padding: 24px 20px !important;
}

#adviceModal .modal-body p {
  font-size: 14px !important;
  color: #475569 !important;
  line-height: 1.5 !important;
}

#adviceModal .modal-body strong {
  color: #059669 !important;
}

#adviceModal .form-group label {
  font-size: 13.5px !important;
  color: #1e293b !important;
  margin-bottom: 8px !important;
}

#adviceModal textarea.form-control {
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  padding: 12px !important;
  font-size: 14px !important;
  color: #334155 !important;
  transition: all 0.2s ease !important;
  box-shadow: none !important;
}

#adviceModal textarea.form-control:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
  outline: none !important;
}

#adviceModal .modal-footer {
  background-color: #f8fafc !important;
  padding: 16px 20px !important;
  border-top: 1px solid #f1f5f9 !important;
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  margin-top: 0 !important; /* Resets global styles.css margin-top: -120px override! */
}

#adviceModal .modal-footer .btn {
  margin: 0 !important;
  padding: 8px 16px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  transition: all 0.2s ease !important;
  height: 38px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#adviceModal .modal-footer .btn-default {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: none !important;
}

#adviceModal .modal-footer .btn-default:hover {
  background: #e2e8f0 !important;
  color: #1e293b !important;
}

#adviceModal .modal-footer .btn-primary {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.15) !important;
}

#adviceModal .modal-footer .btn-primary:hover {
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25) !important;
  transform: translateY(-1px) !important;
}

#adviceModal .modal-footer .btn-primary:active {
  transform: translateY(0) !important;
}

/* ===== RESPONSIVE BREADCRUMB ADJUSTMENTS ===== */
/* Moved globally to styles.css to apply to all pages */

/* ===== PRODUCT DETAIL IMAGE GALLERY OVERRIDES & STRETCH FIXES ===== */

/* 1. Main image wrapper/stage - elegant fixed height and centering */
.product-page-product-wrap.jqzoom-stage {
  border: 1px solid #e2f0e6 !important;
  border-radius: 12px !important;
  padding: 15px !important;
  background-color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.03) !important;
  position: relative !important;
  margin-bottom: 15px !important;
  overflow: hidden !important;
  height: 380px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Ensure the layout structure inside doesn't stretch or break flexbox centering */
.product-page-product-wrap.jqzoom-stage .clearfix {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  overflow: visible !important;
  padding: 0 !important;
  margin: 0 !important;
}

.product-page-product-wrap.jqzoom-stage a {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  position: relative !important;
}

/* 2. zoomPad must shrink-wrap the image exactly, with no flex-stretch or extra empty space */
.product-page-product-wrap.jqzoom-stage .zoomPad {
  display: inline-block !important;
  position: relative !important;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 auto !important;
}

/* 3. Main product image size constraints - preserve aspect ratio, prevent stretching */
.product-detail-main-img,
.product-page-product-wrap.jqzoom-stage img,
.zoomPad > img {
  max-width: 100% !important;
  max-height: 350px !important; /* Slightly smaller than 380px container height to fit padding */
  width: auto !important;
  height: auto !important;
  display: block !important;
  margin: 0 auto !important;
  border-radius: 8px !important;
  object-fit: contain !important; /* Prevents compression or vertical stretching */
  transition: none !important; /* Disable all transitions to prevent size jittering during zoom tracking */
}

/* Prevent hover zoom conflict with jqzoom plug-in */
.product-page-product-wrap.jqzoom-stage:hover img {
  transform: none !important;
}

/* 3. jqzoom Innerzoom Layout Fixes (Override the hardcoded left positions in general stylesheet) */
.zoomWindow {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  background: #ffffff !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
  pointer-events: none !important; /* Prevent hover event interception */
}

.zoomWrapper {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

.zoomWrapperImage {
  width: 100% !important;
  height: 100% !important;
  display: block !important; /* Must be standard block to allow absolute positioning of large image */
  position: relative !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

.zoomWrapperImage img {
  position: absolute !important; /* Ensure absolute positioning works for panning calculations */
  max-width: none !important; /* Do NOT restrict large image size to container limits */
  max-height: none !important; /* Do NOT restrict large image size to container limits */
  width: auto !important;
  height: auto !important;
  border-radius: 0 !important;
  object-fit: fill !important; /* Allow the image to render at natural dimensions */
  transition: none !important; /* Prevent coordinate panning lag */
  pointer-events: none !important;
}

/* Mobile responsive dimensions for the stage and main image */
@media (max-width: 767px) {
  .product-page-product-wrap.jqzoom-stage {
    height: 280px !important;
    clear: both !important;
    margin-top: 15px !important;
  }
  .product-detail-main-img,
  .product-page-product-wrap.jqzoom-stage img,
  .zoomPad > img {
    max-height: 250px !important;
  }
}

/* ===== NEW PREMIUM COMPONENT CONSTANTS ===== */
.product-detail-price-box {
  max-width: 480px !important;
}

.product-price-locked-box {
  max-width: 480px !important;
}

.drug-classification-detail-box {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  border: 1px solid #e2e8f0 !important;
}
.drug-classification-detail-box:hover {
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03) !important;
}
.drug-classification-detail-box a.collapsed .fa-chevron-down {
  transform: rotate(0deg) !important;
}
.drug-classification-detail-box a:not(.collapsed) .fa-chevron-down {
  transform: rotate(180deg) !important;
}

/* ===== HORIZONTAL SCROLL FOR PROMO COUPONS ===== */
.coupon-box {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin-bottom: 12px !important;
  width: 100% !important;
}

.coupon-list {
  display: flex !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding-bottom: 5px !important;
  flex-grow: 1 !important;
  min-width: 0 !important;
  scrollbar-width: thin !important;
  scrollbar-color: #cbd5e1 transparent !important;
}

.coupon-list::-webkit-scrollbar {
  height: 4px !important;
}

.coupon-list::-webkit-scrollbar-track {
  background: transparent !important;
}

.coupon-list::-webkit-scrollbar-thumb {
  background: #cbd5e1 !important;
  border-radius: 10px !important;
}

.coupon-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8 !important;
}

.coupon-tag {
  flex: 0 0 auto !important; /* Prevent tags from shrinking or stretching */
}

