/**
 * Samarth Sarees — user storefront responsive layout (mobile + laptop)
 */

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

img,
video,
iframe {
  max-width: 100%;
}

/* Bootstrap .px-xl-5 only applies at ≥1200px — add gutters below xl */
@media (max-width: 1199.98px) {
  .row.px-xl-5,
  .d-flex.px-xl-5 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

@media (min-width: 576px) and (max-width: 1199.98px) {
  .row.px-xl-5,
  .d-flex.px-xl-5 {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }
}

/* Topbar */
@media (max-width: 991.98px) {
  .topbar-row {
    flex-wrap: wrap;
  }
  .topbar-search-col {
    flex: 0 0 100%;
    max-width: 100%;
    order: 1;
  }
  .topbar-actions-col {
    flex: 0 0 100%;
    max-width: 100%;
    order: 2;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
  }
}

@media (max-width: 767.98px) {
  .topbar-actions-col {
    justify-content: center;
  }
}

/* Navbar collapse — full width on mobile */
@media (max-width: 991.98px) {
  .navbar.navbar-expand-lg {
    flex-wrap: wrap;
  }
  .navbar.navbar-expand-lg > .navbar-toggler {
    margin-left: auto;
  }
  #navbarCollapse {
    flex-basis: 100%;
    width: 100%;
  }
  #navbarCollapse .navbar-nav {
    width: 100%;
  }
  #navbarCollapse .dropdown-menu {
    border: none;
    padding-left: 0.75rem;
    box-shadow: none;
  }
  .navbar-nav.ml-auto {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }
}

/* Hero / page headers */
@media (max-width: 991.98px) {
  #header-carousel .carousel-caption h3.display-4 {
    font-size: 1.65rem;
  }
  #header-carousel .carousel-caption h4 {
    font-size: 0.85rem;
  }
}

@media (max-width: 767.98px) {
  .page-hero-minh {
    min-height: 200px !important;
  }
  .page-hero-minh h1,
  .page-hero-minh .h3 {
    font-size: 1.35rem;
    text-align: center;
    padding: 0 0.75rem;
  }
}

/* Shop toolbar */
.shop-toolbar-form {
  flex-direction: column;
  align-items: stretch !important;
  gap: 0.75rem;
}

.shop-toolbar-form .input-group,
.shop-toolbar-form .shop-sort-select {
  width: 100% !important;
  max-width: 100%;
  margin-left: 0 !important;
}

@media (min-width: 768px) {
  .shop-toolbar-form {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center !important;
  }
  .shop-toolbar-form .input-group {
    flex: 1 1 280px;
    width: auto !important;
  }
  .shop-toolbar-form .shop-sort-select {
    flex: 0 1 220px;
    width: auto !important;
  }
}

/* Cart — card rows on small screens */
@media (max-width: 767.98px) {
  .cart-page-table thead {
    display: none;
  }
  .cart-page-table,
  .cart-page-table tbody,
  .cart-page-table tr,
  .cart-page-table td {
    display: block;
    width: 100%;
  }
  .cart-page-table tr {
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: #fff;
  }
  .cart-page-table td {
    text-align: right !important;
    border: none !important;
    padding: 0.35rem 0 !important;
    white-space: normal !important;
    font-size: 14px;
  }
  .cart-page-table td::before {
    content: attr(data-label);
    float: left;
    font-weight: 600;
    color: #1c1c1c;
    text-align: left;
    max-width: 45%;
  }
  .cart-page-table td.align-middle.text-left {
    text-align: left !important;
    padding-bottom: 0.65rem !important;
    border-bottom: 1px dashed #eee !important;
    margin-bottom: 0.35rem;
  }
  .cart-page-table td.align-middle.text-left::before {
    display: none;
  }
  .cart-page-table td .cart-qty-wrap {
    justify-content: flex-end;
  }
}

@media (min-width: 768px) {
  .cart-page-table td:first-child {
    white-space: normal;
    min-width: 160px;
    max-width: 280px;
  }
}

/* Checkout actions */
.checkout-footer-actions {
  gap: 0.75rem;
}

@media (max-width: 575.98px) {
  .checkout-footer-actions .btn {
    width: 100%;
    text-align: center;
  }
  .checkout-card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem;
  }
  .checkout-card-header .btn {
    align-self: stretch;
  }
}

/* Address cards on checkout */
@media (max-width: 767.98px) {
  .checkout-address-option .custom-control-label {
    font-size: 0.9rem;
  }
}

/* Profile / account pages */
@media (max-width: 991.98px) {
  .account-sidebar-nav {
    margin-bottom: 1.25rem;
  }
  .account-sidebar-nav .list-group-item {
    padding: 0.65rem 1rem;
  }
  .my__account--section {
    margin-top: 1.5rem !important;
    margin-bottom: 2.5rem !important;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .profile_edit {
    width: 100% !important;
  }
}

/* Order confirm / tables */
@media (max-width: 767.98px) {
  .order-summary-table td,
  .order-summary-table th {
    font-size: 13px;
    padding: 0.45rem;
  }
}

/* Contact map */
.contact-map-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 0.25rem;
}

.contact-map-wrap iframe {
  display: block;
  width: 100%;
  min-height: 280px;
  border: 0;
}

@media (min-width: 992px) {
  .contact-map-wrap iframe {
    min-height: 420px;
  }
}

/* Footer — compact on mobile (less top padding & column gaps) */
@media (max-width: 767.98px) {
  .site-footer {
    margin-top: 1.75rem !important;
    padding-top: 1rem !important;
    padding-bottom: 0.25rem;
  }
  .site-footer .site-footer-main {
    padding-top: 0 !important;
  }
  .site-footer .site-footer-brand {
    margin-bottom: 0.75rem !important;
    padding-right: 0 !important;
  }
  .site-footer .site-footer-brand img {
    max-height: 48px !important;
    margin-bottom: 0.5rem !important;
  }
  .site-footer .site-footer-brand > p:first-of-type {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    line-height: 1.45;
  }
  .site-footer .mb-5 {
    margin-bottom: 0.85rem !important;
  }
  .site-footer h5.mb-4 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem !important;
  }
  .site-footer .footer-contact-line,
  .site-footer .site-footer-brand p.mb-2 {
    margin-bottom: 0.35rem !important;
    font-size: 0.8125rem;
    line-height: 1.4;
  }
  .site-footer .footer-contact-icon {
    margin-right: 0.5rem !important;
    font-size: 0.9rem;
  }
  .site-footer a.text-dark.mb-2 {
    font-size: 0.8125rem;
    margin-bottom: 0.25rem !important;
  }
  .site-footer .footer-topbar {
    display: none;
  }
  .site-footer .footer-links-row {
    margin-top: 0.25rem;
  }
  .site-footer .site-footer-copy {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-top: 0.65rem !important;
    padding-bottom: 0.75rem !important;
  }
  .site-footer .site-footer-copy p {
    font-size: 0.75rem;
    line-height: 1.45;
    margin-bottom: 0.35rem;
  }
  .site-footer .site-footer-copy img.img-fluid {
    max-height: 26px;
    width: auto;
  }
}

@media (max-width: 991.98px) and (min-width: 768px) {
  .site-footer {
    padding-top: 2rem !important;
  }
  .site-footer .site-footer-main {
    padding-top: 0.5rem !important;
  }
  .site-footer .mb-5 {
    margin-bottom: 1.5rem !important;
  }
}

.back-to-top {
  right: max(16px, env(safe-area-inset-right)) !important;
  bottom: max(16px, env(safe-area-inset-bottom)) !important;
  z-index: 9998 !important;
}

@media (max-width: 767.98px) {
  .back-to-top {
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: max(72px, calc(72px + env(safe-area-inset-bottom))) !important;
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  body.has-floating-social .back-to-top {
    bottom: max(118px, calc(118px + env(safe-area-inset-bottom))) !important;
  }
}

/* Product grid — consistent card height on tablets */
@media (min-width: 992px) {
  .product-item .card-header.product-img img {
    height: 260px;
    object-fit: contain;
    background: #f8f9fa;
  }
}

/* Modal on small screens */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0.5rem;
  }
  .modal-fullscreen-sm-down {
    max-width: calc(100% - 1rem);
  }
}
