/* ==========================================================================
   DuckRiders Responsive Overrides (Mobile < 768px & Tablet 768px-991.98px)
   Strictly scoped below 992px so Desktop (>= 992px) remains unchanged.
   ========================================================================== */

@media (max-width: 991.98px) {
  /* 1. Unlock global .table 1000px min-width that clips spec/blog/cart tables */
  .table {
    min-width: 0 !important;
    width: 100%;
  }

  /* 2. Top-bar touch targets (>= 44px height) */
  .top-bar .top-bar-social a {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
  }

  .top-bar .menu-top-bar-right li a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
  }

  /* 3. Navbar toggler & collapsed drawer links (>= 44px height) */
  .ftco-navbar-light .navbar-toggler {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 14px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .ftco-navbar-light .navbar-nav > .nav-item > .nav-link {
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left !important;
    padding: 10px 16px !important;
  }

  .ftco-navbar-light .navbar-nav > .nav-item.cta > a {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 18px !important;
  }

  /* 4. Footer .block-23 icon/email overlap fix */
  .ftco-footer .block-23 ul li,
  .ftco-footer .block-23 ul li > a {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }

  .ftco-footer .block-23 ul li .icon {
    width: 20px;
    flex-shrink: 0;
    padding-top: 3px;
  }

  .ftco-footer .block-23 ul li .text {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .ftco-footer .ftco-footer-widget ul li a {
    min-height: 40px;
    display: flex !important;
    align-items: center;
  }

  /* 5. Hero bread banner padding & overlay cleanup */
  .hero-wrap.hero-bread {
    padding: 4.5em 0;
  }

  .hero-wrap .slider-text {
    padding: 2em 1.5em;
  }

  /* 6. Product detail tabs & tables wrapping */
  .tab-content,
  .fujimac-specification {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .tab-content table,
  .fujimac-specification table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .tab-content table td,
  .tab-content table th {
    padding: 10px 8px !important;
    white-space: normal !important;
    word-break: break-word;
  }

  /* 7. Product quantity +/- & FAQ touch targets */
  .quantity-left-minus,
  .quantity-right-plus {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #quantity {
    min-height: 44px;
  }

  #productFaqAccordion .btn,
  #productFaqAccordion button {
    min-height: 44px;
    white-space: normal;
    text-align: left;
  }

  /* 8. Tablet Cart Table fit within 768px without clipping */
  .cart-list {
    overflow-x: auto;
  }

  .cart-list .table {
    min-width: 0 !important;
    width: 100%;
  }

  .cart-list .table thead th,
  .cart-list .table tbody td {
    padding: 14px 6px !important;
  }

  .cart-list .table tbody tr td.image-prod .img {
    width: 72px !important;
    height: 72px !important;
  }

  .cart-list .table tbody tr td.quantity {
    width: 105px !important;
  }

  .cart-list .table thead th:last-child,
  .cart-list .table tbody tr td.total {
    min-width: 96px;
  }

  .cart-list .table tbody td.product-remove a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
  }

  /* 9. Prevent .ftco-animate sections from staying hidden before scroll */
  .ftco-animate {
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* 10. Carousel prev/next arrow contrast & touch target on Mobile/Tablet */
  #carouselExampleIndicators .carousel-control-prev,
  #carouselExampleIndicators .carousel-control-next {
    width: 48px;
  }

  #carouselExampleIndicators .carousel-control-prev-icon,
  #carouselExampleIndicators .carousel-control-next-icon {
    width: 40px;
    height: 40px;
    background-color: rgba(17, 24, 39, 0.55);
    background-size: 52% 52%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
  }

  /* 11. Blogs pagination & table responsiveness */
  .block-27 ul li a,
  .block-27 ul li span,
  .pagination .page-link {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  .drd-cal-nav-btn {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  .drd-cal-day {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
  }

  /* Blog comparison & article tables */
  .ftco-section .table-responsive,
  .drd-blog-content .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ftco-section table:not(.dr-cart-table),
  .drd-blog-content table {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 767.98px) {
  /* Mobile Hero sizing */
  .hero-wrap.hero-bread {
    padding: 3em 0;
  }

  .hero-wrap .slider-text {
    padding: 1.5em 1.25em;
  }

  .hero-wrap .slider-text .bread {
    font-size: 1.5em;
    letter-spacing: 1.5px;
  }

  /* Mobile Modal scrolling */
  .modal-dialog {
    margin: 12px auto;
    max-width: calc(100vw - 24px);
  }

  .modal-content {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }

  /* Mobile Cart: Card-style stacked rows (zero horizontal scroll) */
  .cart-list {
    overflow-x: visible !important;
  }

  .cart-list .table,
  .cart-list .table tbody,
  .cart-list .table tr,
  .cart-list .table td {
    display: block;
    width: 100% !important;
  }

  .cart-list .table thead {
    display: none;
  }

  .cart-list .table tbody tr {
    position: relative;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 14px 14px 14px;
    margin-bottom: 14px;
    text-align: left !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  }

  .cart-list .table tbody tr td {
    border: 0 !important;
    padding: 6px 0 !important;
    text-align: left !important;
  }

  .cart-list .table tbody tr td.product-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: auto !important;
    padding: 0 !important;
  }

  .cart-list .table tbody tr td.image-prod {
    padding-top: 0 !important;
  }

  .cart-list .table tbody tr td.image-prod .img {
    width: 96px;
    height: 96px;
    margin: 0 auto 8px 0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
  }

  .cart-list .table tbody tr td.product-name {
    padding-right: 44px !important;
  }

  .cart-list .table tbody tr td.product-name h3 {
    font-size: 1rem;
    margin-bottom: 4px;
  }

  .cart-list .table tbody tr td.price::before {
    content: "ราคา: ";
    font-weight: 600;
    color: #475569;
  }

  .cart-list .table tbody tr td.quantity {
    width: 100% !important;
  }

  .cart-list .table tbody tr td.quantity .input-group {
    margin-bottom: 0 !important;
    max-width: 140px;
  }

  .cart-list .table tbody tr td.quantity .input-number {
    min-height: 44px;
  }

  .cart-list .table tbody tr td.total::before {
    content: "รวม: ";
    font-weight: 600;
    color: #475569;
  }

  /* Cart toast on mobile */
  #cartToast {
    left: 12px !important;
    right: 12px !important;
    bottom: 16px !important;
    font-size: 13px !important;
    padding: 10px 14px !important;
  }

  /* Compact vertical spacing on Service & About pages */
  .py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
}
