/* ============================================================
   Site-wide responsive layer (loads after modern-styles.css)
   ============================================================ */

/* ── Base / global ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

iframe {
  max-width: 100%;
}

.container,
.section-container,
.main-container,
.page-wrapper,
.checkout-container,
.profile-container,
.cart-container {
  width: 100%;
  max-width: 100%;
}

.resp-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

/* Prevent long text overflow */
h1, h2, h3, h4, p, a, td, th, label, span {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ── Mobile nav drawer ── */
.techiestore-mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.techiestore-mobile-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: #111;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.techiestore-mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.techiestore-mobile-overlay.open {
  opacity: 1;
  visibility: visible;
}

.techiestore-mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(320px, 88vw);
  height: 100vh;
  height: 100dvh;
  background: #fff;
  z-index: 10060;
  transform: translateX(-105%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
}

.techiestore-mobile-drawer.open {
  transform: translateX(0);
}

.techiestore-mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #f0f0f0;
}

.techiestore-mobile-drawer-title {
  font-family: var(--font-display, 'Syne', sans-serif);
  font-weight: 700;
  font-size: 1.1rem;
}

.techiestore-mobile-drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: #374151;
}

.techiestore-mobile-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0 24px;
  -webkit-overflow-scrolling: touch;
}

.techiestore-mobile-section {
  padding: 8px 18px 16px;
}

.techiestore-mobile-section h4 {
  margin: 0 0 10px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
}

.techiestore-mobile-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.techiestore-mobile-links a {
  display: block;
  padding: 11px 12px;
  border-radius: 8px;
  color: #111827;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.techiestore-mobile-links a:hover {
  background: #fff8f0;
  color: #ff8c00;
}

body.techiestore-mobile-menu-open {
  overflow: hidden;
}

/* ── Header / nav ── */
@media (max-width: 1024px) {
  .techiestore-nav-inner {
    gap: 12px !important;
    flex-wrap: nowrap !important;
  }

  .techiestore-search {
    width: auto !important;
    max-width: none !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .techiestore-search-input {
    font-size: 14px !important;
  }

  .techiestore-nav-end {
    gap: 10px !important;
  }

  .techiestore-top-promo-inner {
    padding: 8px 40px 8px 16px !important;
    font-size: 13px !important;
  }
}

@media (max-width: 768px) {
  .techiestore-mobile-menu-btn {
    display: inline-flex;
    order: 1;
  }

  .techiestore-logo {
    order: 2;
    flex: 0 1 auto;
    min-width: 0;
  }

  .techiestore-nav-inner {
    padding: 10px 12px !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
  }

  .techiestore-logo img {
    max-height: 36px !important;
  }

  .techiestore-nav-links {
    display: none !important;
  }

  .techiestore-nav-end {
    order: 3;
    flex-shrink: 0 !important;
    margin-left: auto;
  }

  .techiestore-nav-center {
    order: 4;
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .techiestore-search {
    width: 100% !important;
    max-width: 100% !important;
  }

  .techiestore-search-dropdown {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .techiestore-search-grid {
    grid-template-columns: 1fr !important;
  }

  .techiestore-products-grid {
    grid-template-columns: 1fr !important;
  }

  .techiestore-sidebar-container {
    width: 100% !important;
    max-width: 100% !important;
  }

  .techiestore-user-dropdown {
    right: 0 !important;
    left: auto !important;
    min-width: 260px !important;
  }
}

@media (max-width: 480px) {
  .techiestore-nav-end .techiestore-nav-icon {
    width: 36px !important;
    height: 36px !important;
  }

  .techiestore-top-promo-text {
    font-size: 12px !important;
    line-height: 1.35 !important;
  }
}

/* ── Homepage hero ── */
@media (max-width: 992px) {
  .hs-content h1,
  .hero-slider .hs-content h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem) !important;
    line-height: 1.15 !important;
  }

  .hs-content p {
    font-size: 15px !important;
    max-width: 100% !important;
  }

  .hs-ctas {
    flex-wrap: wrap;
    gap: 10px;
  }

  .hs-visual {
    display: none !important;
  }

  .best-sellers-grid .product-card,
  .category-scroll .product-card {
    min-width: min(220px, 72vw) !important;
    width: min(220px, 72vw) !important;
  }
}

@media (max-width: 576px) {
  .hs-content h1,
  .hero-slider .hs-content h1 {
    font-size: clamp(1.5rem, 7vw, 2rem) !important;
  }

  .hs-btn-primary,
  .hs-btn-secondary {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .hs-arrow {
    width: 36px !important;
    height: 36px !important;
  }
}

/* ── Product detail ── */
@media (max-width: 960px) {
  .product-detail-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  .gallery {
    position: static !important;
  }

  .sticky-buy-bar {
    display: flex !important;
  }

  body {
    padding-bottom: 80px;
  }
}

@media (max-width: 576px) {
  .page-wrapper {
    padding: 12px 12px 80px !important;
  }

  .tabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
  }

  .tabs-bar .tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .wholesale-tiers-row {
    grid-template-columns: 1fr !important;
  }
}

/* ── Profile ── */
@media (max-width: 992px) {
  .profile-section {
    padding: 12px !important;
  }

  .profile-container {
    flex-direction: column !important;
    gap: 20px !important;
    padding: 0 !important;
  }

  .profile-sidebar {
    max-width: 100% !important;
    width: 100% !important;
  }

  .profile-nav {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
  }

  .profile-nav li {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
    padding: 10px 8px !important;
    font-size: 0.85rem !important;
  }
}

@media (max-width: 768px) {
  .profile-card {
    padding: 16px !important;
  }

  .form-row,
  .profile-form .form-row {
    flex-direction: column !important;
    gap: 0 !important;
  }

  .form-group {
    width: 100% !important;
  }

  .address-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .address-grid {
    grid-template-columns: 1fr !important;
  }

  /* Orders / quotations tables → scroll wrapper */
  .orders-table-wrap,
  .profile-card .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding-bottom: 4px;
  }

  .orders-table {
    min-width: 640px;
  }

  .orders-table th,
  .orders-table td {
    padding: 10px 8px !important;
    font-size: 0.82rem !important;
  }

  .action-toggle {
    min-width: auto !important;
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
  }
}

@media (max-width: 480px) {
  .profile-nav li {
    flex: 1 1 100%;
  }

  .profile-avatar img {
    width: 80px !important;
    height: 80px !important;
  }
}

/* ── Modals (address, checkout, profile) ── */
@media (max-width: 768px) {
  .modal {
    align-items: flex-start !important;
    justify-content: center !important;
    padding: 12px !important;
  }

  .modal-panel,
  #addressModal.modal,
  #addressModal .modal-panel,
  .checkout-wrapper .modal-content {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
    overflow-y: auto !important;
    margin: 12px !important;
    padding: 18px 16px !important;
  }

  .modal-body .d-flex.flex-column.gap-20,
  .modal-body .w-100 {
    width: 100% !important;
  }

  .modal-actions,
  .checkout-wrapper .modal-actions {
    flex-direction: column-reverse !important;
    gap: 10px !important;
  }

  .modal-actions .btn-primary,
  .modal-actions .btn-secondary,
  .modal-actions button {
    width: 100% !important;
  }
}

/* ── Checkout ── */
@media (max-width: 1024px) {
  .checkout-wrapper .checkout-container {
    flex-direction: column !important;
    padding: 16px !important;
    gap: 20px !important;
    margin-top: 16px !important;
  }

  .checkout-wrapper .checkout-summary {
    position: static !important;
    top: auto !important;
    width: 100% !important;
  }

  .checkout-wrapper .checkout-card,
  .checkout-wrapper .summary-card {
    padding: 18px !important;
  }
}

@media (max-width: 600px) {
  .checkout-wrapper .option-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .checkout-wrapper .btn-primary,
  .checkout-wrapper .btn-secondary,
  .checkout-wrapper .checkout-btn,
  .checkout-wrapper #placeOrder {
    width: 100% !important;
  }

  .checkout-wrapper .addr-map-canvas {
    height: 220px !important;
  }

  .phone-group {
    flex-wrap: nowrap !important;
  }
}

/* ── Cart ── */
@media (max-width: 992px) {
  .cart-section,
  .cart-container {
    flex-direction: column !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .cart-summary {
    position: static !important;
    width: 100% !important;
  }
}

@media (max-width: 768px) {
  .cart-table thead {
    display: none;
  }

  .cart-table,
  .cart-table tbody,
  .cart-table tr,
  .cart-table td {
    display: block;
    width: 100%;
  }

  .cart-table tr.cart-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    overflow: hidden;
  }

  .cart-item .cart-image,
  .cart-item .cart-details {
    display: inline-block;
    width: 50%;
    vertical-align: top;
    padding: 10px 12px;
  }

  .cart-table td.cart-model,
  .cart-table td.cart-brand,
  .cart-table td.cart-qty-col,
  .cart-table td.cart-price {
    padding: 10px 12px;
    border-top: 1px solid #eef2f7;
  }

  .cart-table td.cart-model,
  .cart-table td.cart-brand {
    display: inline-block !important;
    width: 50% !important;
  }

  .cart-table td.cart-qty-col,
  .cart-table td.cart-price {
    display: inline-block;
    width: 50%;
    vertical-align: top;
  }

  .cart-table td.cart-model::before { content: "Model"; font-weight: 600; color: #475569; display: block; margin-bottom: 4px; font-size: 0.78rem; }
  .cart-table td.cart-brand::before { content: "Brand"; font-weight: 600; color: #475569; display: block; margin-bottom: 4px; font-size: 0.78rem; }
  .cart-table td.cart-qty-col::before { content: "Qty"; font-weight: 600; color: #475569; display: inline; margin-right: 6px; font-size: 0.78rem; }
  .cart-table td.cart-price::before { content: "Price"; font-weight: 600; color: #475569; display: inline; margin-right: 6px; font-size: 0.78rem; }

  .cart-price .remove-btn-table {
    position: static !important;
    transform: none !important;
    margin-left: 8px;
  }
}

/* ── Wishlist ── */
@media (max-width: 768px) {
  .wishlist-page {
    padding: 0 12px;
    margin-bottom: 32px;
  }

  .wishlist-container {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
    gap: 14px;
  }

  .wishlist-card {
    padding: 12px;
  }

  .wishlist-card img {
    height: 140px;
  }
}

@media (max-width: 480px) {
  .wishlist-container {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .wishlist-card h3 {
    font-size: 0.82rem;
  }
}

/* ── Wallet ── */
@media (max-width: 768px) {
  .wallet-page,
  .wallet-container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .wallet-summary-grid,
  .wallet-cards-row {
    grid-template-columns: 1fr !important;
  }
}

/* ── Footer ── */
@media (max-width: 992px) {
  .footer-main,
  .footer-inner .footer-main {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 24px !important;
  }
}

@media (max-width: 768px) {
  .footer-inner {
    padding: 24px 16px !important;
  }

  .footer-main,
  .footer-inner .footer-main {
    grid-template-columns: 1fr !important;
  }

  .footer-bottom {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    text-align: left !important;
  }

  .footer-bottom-links {
    flex-wrap: wrap;
    gap: 10px;
  }

  .footer-col.collapsed .footer-links {
    display: none;
  }

  .footer-col .footer-col-title {
    cursor: pointer;
  }
}

/* ── Catalog / search / CMS pages ── */
@media (max-width: 768px) {
  .product-grid,
  .products-grid,
  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)) !important;
    gap: 12px !important;
  }

  .page-header,
  .section-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }

  .policy-content,
  .cms-content {
    padding: 20px 16px !important;
  }

  .filter-sidebar,
  .catalog-sidebar,
  .page-layout .sidebar {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .page-layout {
    grid-template-columns: 1fr !important;
    padding: 16px 12px !important;
  }

  .catalog-layout {
    flex-direction: column !important;
  }
}

/* ── Forms ── */
@media (max-width: 576px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea,
  .form-input,
  .form-select {
    font-size: 16px !important; /* prevent iOS zoom */
  }

  .btn-primary,
  .btn-secondary,
  .btn {
    min-height: 44px;
  }
}

/* ── Tables (generic fallback) ── */
@media (max-width: 768px) {
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table:not(.cart-table) {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Utility ── */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}
