/* Tegin Shop Bootstrap 5.3 compatibility and migration layer. */
:root {
  --ts-primary: #0e9f8e;
  --ts-primary-dark: #0a6f62;
  --ts-surface: #ffffff;
  --ts-border: #e2e8f0;
  --ts-text: #0f172a;
  --ts-muted: #64748b;
  --ts-radius: 0.875rem;
}

/* Prevent Bootstrap/legacy flex and grid children from forcing viewport overflow. */
.row > *, .d-flex > *, .d-grid > *, [class*="col-"] { min-width: 0; }
img, svg, video, canvas, iframe { max-width: 100%; }
button, input, select, textarea { max-width: 100%; }

/* Consistent focus treatment for keyboard and touch users. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(14, 159, 142, .35);
  outline-offset: 2px;
}

/* Shared migration primitives used by converted storefront pages. */
.ts-section { padding-block: clamp(2.5rem, 6vw, 5rem); }
.ts-card {
  background: var(--ts-surface);
  border: 1px solid var(--ts-border);
  border-radius: var(--ts-radius);
  box-shadow: 0 0.375rem 1rem rgba(15, 23, 42, .06);
}
.ts-stack { display: flex; flex-direction: column; gap: var(--ts-stack-gap, 1rem); }
.ts-grid { display: grid; gap: var(--ts-grid-gap, 1rem); min-width: 0; }
.ts-media { width: 100%; height: auto; object-fit: cover; }
.ts-nowrap-safe { white-space: normal; overflow-wrap: anywhere; }
.ts-overflow-table { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ts-overflow-table > table { min-width: 42rem; }

/* Bootstrap nav/dropdown/offcanvas and legacy drawer must never exceed the viewport. */
.dropdown-menu, .offcanvas, .modal-dialog { max-width: 100vw; }
.navbar, .offcanvas, .modal, .popover, .toast { z-index: 1050; }

/* Mobile-first form ergonomics. */
.ts-form .form-control, .ts-form .form-select { min-height: 2.75rem; }
.ts-form .form-label { margin-bottom: .375rem; font-weight: 600; }
.ts-form .form-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

@media (max-width: 575.98px) {
  .container { --bs-gutter-x: 1.25rem; }
  .ts-section { padding-block: 2.5rem; }
  .ts-form .form-actions > .btn,
  .ts-form .form-actions > button,
  .ts-form .form-actions > a { flex: 1 1 100%; width: 100%; }
  .btn { white-space: normal; }
  .table-responsive { border-radius: .75rem; }
}

@media (min-width: 576px) and (max-width: 991.98px) {
  .ts-section { padding-block: 3.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
