/* SelectO - Mobile-First PWA Styles */

/* ============================================
   CSS Variables
   ============================================ */
:root {
  /* Brand — aliased to LEARNature-ly Design System v1 tokens.
     SelectO's teal #1f7268 IS the per-app accent (data-app="selecto").
     Hardcoded fallbacks preserve rendering if tokens.v1.css fails to load. */
  --primary: var(--ln-accent, #1f7268);
  --primary-dark: var(--ln-accent-hover, #1F7A6E);
  --primary-text: var(--ln-accent, #1A6B60);
  --secondary: var(--ln-bg-secondary, #1a1a2e);
  --accent: var(--ln-bg-elevated, #16213e);
  --success: var(--ln-status-success, #10b981);
  --warning: var(--ln-status-warning, #f59e0b);
  --error: var(--ln-status-danger, #ef4444);
  --white: var(--ln-bg-card, #ffffff);
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #4b5563;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --radius-sm: var(--ln-radius-md, 8px);
  --radius-md: var(--ln-radius-lg, 12px);
  --radius-lg: var(--ln-radius-xl, 16px);
  --radius-xl: var(--ln-radius-2xl, 24px);
  --radius-full: var(--ln-radius-full, 9999px);

  --shadow-sm: var(--ln-shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
  --shadow-md: var(--ln-shadow-md, 0 4px 6px rgba(0, 0, 0, 0.1));
  --shadow-lg: var(--ln-shadow-lg, 0 10px 15px rgba(0, 0, 0, 0.1));
  --shadow-xl: var(--ln-shadow-xl, 0 20px 25px rgba(0, 0, 0, 0.15));

  --header-height: var(--ln-topbar-height, 64px);
  --bottom-safe: env(safe-area-inset-bottom, 0px);
}

/* ============================================
   Reset & Base
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background: var(--ln-bg-primary, var(--gray-50));
  color: var(--ln-text-primary, var(--gray-900));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================
   Screens
   ============================================ */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

/* ============================================
   Loading Screen
   ============================================ */
#loading-screen {
  justify-content: center;
  align-items: center;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: var(--white);
}

.loading-content {
  text-align: center;
}

.loading-content .logo {
  width: 200px;
  margin-block-end: 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   Error Screen
   ============================================ */
#error-screen {
  justify-content: center;
  align-items: center;
  padding: 2rem;
  text-align: center;
}

.error-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--error);
  color: var(--white);
  font-size: 3rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

/* ============================================
   Header
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--white);
  border-block-end: 1px solid var(--gray-200);
  height: var(--header-height);
}

.header.simple {
  justify-content: center;
}

.header.simple h1 {
  flex: 1;
  text-align: center;
  font-size: 1.125rem;
}

.header-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.header-center {
  flex: 1;
  text-align: center;
  padding: 0 0.5rem;
}

.header-center h1 {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-badge {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* ============================================
   Icon Buttons
   ============================================ */
.icon-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: background 0.2s;
  position: relative;
}

.icon-btn:hover {
  background: var(--gray-100);
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.cart-btn .badge {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-btn .badge:empty,
.cart-btn .badge[data-count="0"] {
  display: none;
}

/* ============================================
   Language Selector
   ============================================ */
.lang-select {
  -webkit-appearance: none;
  appearance: none;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  color: var(--gray-700);
}

/* ============================================
   Highlights Row (Stories)
   ============================================ */
.highlights-row {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.highlights-row::-webkit-scrollbar {
  display: none;
}

.highlight-item {
  flex: 0 0 auto;
  width: 80px;
  text-align: center;
  cursor: pointer;
}

.highlight-image {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  padding: 2px;
  background: var(--white);
}

.highlight-name {
  font-size: 0.7rem;
  margin-block-start: 0.375rem;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   Categories Filter
   ============================================ */
.categories-filter {
  display: flex;
  gap: 0.5rem;
  padding: 0 1rem 1rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.categories-filter::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex: 0 0 auto;
  padding: 0.5rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-full);
  background: var(--white);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.category-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.category-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* ============================================
   Products Grid
   ============================================ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 0 1rem 2rem;
  padding-bottom: calc(2rem + var(--bottom-safe));
}

@media (min-width: 640px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 1200px;
    margin: 0 auto;
  }
}

/* ============================================
   Product Card
   ============================================ */
.product-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.product-card:active {
  transform: scale(0.98);
}

.product-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.product-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--gray-100);
}

.product-info {
  padding: 0.75rem;
}

.product-name {
  font-size: 0.875rem;
  font-weight: 600;
  margin-block-end: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 600;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 48px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-800);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

/* ============================================
   Modal
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}

.modal.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  position: relative;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  inset-inline-end: 1rem;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--gray-100);
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
}

/* Product Detail in Modal */
.product-detail-image {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}

.product-detail-content {
  padding: 1.5rem;
}

.product-detail-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-block-end: 0.5rem;
}

.product-detail-description {
  color: var(--gray-600);
  margin-block-end: 1rem;
}

.product-detail-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-block-end: 1.5rem;
}

.modifiers-section {
  margin-block-end: 1.5rem;
}

.modifiers-title {
  font-weight: 600;
  margin-block-end: 0.75rem;
}

.modifier-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-block-end: 1px solid var(--gray-100);
}

.modifier-item label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.modifier-price {
  color: var(--gray-500);
  font-size: 0.875rem;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-block-end: 1.5rem;
}

.quantity-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--white);
  font-size: 1.25rem;
  cursor: pointer;
}

.quantity-value {
  font-size: 1.25rem;
  font-weight: 600;
  min-width: 3rem;
  text-align: center;
}

/* ============================================
   Cart Sidebar
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  inset-inline-end: -100%;
  width: 100%;
  max-width: 400px;
  height: 100vh;
  background: var(--white);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transition: inset-inline-end 0.3s ease;
}

.sidebar.active {
  inset-inline-end: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-block-end: 1px solid var(--gray-200);
}

.sidebar-header h2 {
  font-size: 1.25rem;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.cart-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-block-end: 1px solid var(--gray-100);
}

.cart-item-image {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  object-fit: cover;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-weight: 600;
  margin-block-end: 0.25rem;
}

.cart-item-modifiers {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.cart-item-price {
  color: var(--primary);
  font-weight: 600;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cart-item-qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
}

.cart-item-remove {
  color: var(--error);
  cursor: pointer;
  font-size: 0.875rem;
}

.cart-footer {
  padding: 1rem;
  border-block-start: 1px solid var(--gray-200);
  padding-bottom: calc(1rem + var(--bottom-safe));
}

.cart-totals {
  margin-block-end: 1rem;
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  color: var(--gray-600);
}

.total-final {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  border-block-start: 1px solid var(--gray-200);
  padding-block-start: 0.75rem;
  margin-block-start: 0.5rem;
}

.cart-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}

/* ============================================
   Checkout Screen
   ============================================ */
.checkout-content {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  padding-bottom: calc(2rem + var(--bottom-safe));
}

.checkout-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-block-end: 1rem;
}

.checkout-section h3 {
  font-size: 1rem;
  margin-block-end: 1rem;
  color: var(--gray-700);
}

.fulfillment-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fulfillment-option {
  display: block;
  cursor: pointer;
}

.fulfillment-option input {
  display: none;
}

.option-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.fulfillment-option input:checked + .option-content {
  border-color: var(--primary);
  background: rgba(42, 157, 143, 0.05);
}

.option-icon {
  font-size: 1.5rem;
}

.option-label {
  font-weight: 600;
}

.option-desc {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-inline-start: auto;
}

.checkout-section textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  resize: none;
}

.checkout-total {
  background: var(--primary);
  color: var(--white);
}

.checkout-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.25rem;
  font-weight: 700;
}

/* ============================================
   Confirmation Screen
   ============================================ */
.confirmation-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success);
  color: var(--white);
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-block-end: 1.5rem;
}

.confirmation-content h2 {
  font-size: 1.75rem;
  margin-block-end: 0.5rem;
}

#order-number {
  font-size: 1.25rem;
  color: var(--primary);
  font-weight: 600;
  margin-block-end: 0.5rem;
}

.timeline {
  width: 100%;
  max-width: 300px;
  margin: 2rem 0;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gray-300);
}

.timeline-dot.active {
  background: var(--success);
}

.timeline-text {
  font-size: 0.875rem;
}

/* Status badges (My Orders) */
.badge-status {
  color: #fff;
}
.badge-info {
  background: var(--primary);
}
.badge-warning {
  background: #f59e0b;
}
.badge-success {
  background: var(--success);
}
.badge-muted {
  background: var(--gray-400);
}
.badge-danger {
  background: var(--error);
}

/* ============================================
   Overlay
   ============================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.overlay.active {
  display: block;
}

/* ============================================
   Utilities
   ============================================ */
.hidden {
  display: none !important;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* ============================================
   Accessibility
   ============================================ */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   LEARNature-ly Branding Footer
   ============================================ */
.learnature-footer {
  text-align: center;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--gray-600);
  border-top: 1px solid var(--gray-200);
  margin-top: auto;
}

/* ============================================
   Toast Notification
   ============================================ */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
  font-size: 14px;
  max-width: 90vw;
  text-align: center;
}

/* ============================================
   Menu Error State
   ============================================ */
.menu-error-state {
  text-align: center;
  padding: 40px;
  color: var(--gray-500);
}

.menu-error-icon {
  font-size: 48px;
  margin-block-end: 12px;
}

.menu-error-retry {
  margin-block-start: 16px;
}

/* ============================================
   Promotion Banner & Checkout Discount
   ============================================ */
.promo-banner {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.promo-banner::-webkit-scrollbar {
  display: none;
}

.promo-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #e6f5f3, #f0faf8);
  border: 1px solid var(--primary, #2A9D8F);
  border-radius: 20px;
  padding: 6px 14px;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 13px;
}

.promo-chip-badge {
  background: var(--primary, #2A9D8F);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.promo-chip-name {
  color: var(--gray-700, #374151);
  font-weight: 500;
}

.checkout-discount-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  color: var(--primary, #2A9D8F);
  font-weight: 500;
  font-size: 14px;
}

.discount-amount {
  font-weight: 700;
  color: #16a34a;
}

/* ============================================
   Bill Screen
   ============================================ */
#bill-screen .checkout-content {
  padding-bottom: calc(2rem + var(--bottom-safe));
}

/* ============================================
   Tip Buttons
   ============================================ */
.tip-btn,
.checkout-tip-btn {
  transition: all 0.2s;
  font-size: 0.9375rem;
  font-weight: 600;
}

.tip-btn.active,
.checkout-tip-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* ============================================
   Name Modal Overlay
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay .modal-card {
  animation: slideUpSmall 0.3s ease;
}

@keyframes slideUpSmall {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ============================================
   Split Sheet (Bottom Sheet)
   ============================================ */
#split-sheet {
  align-items: flex-end;
}

.split-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: var(--white);
  cursor: pointer;
  width: 100%;
  text-align: start;
  transition: border-color 0.2s, background 0.2s;
}

.split-option:hover {
  border-color: var(--primary);
  background: rgba(42, 157, 143, 0.04);
}

/* ============================================
   Bill FAB
   ============================================ */
#bill-fab:hover {
  transform: scale(1.08);
}

#bill-fab:active {
  transform: scale(0.95);
}

/* ============================================
   Checkout Item
   ============================================ */
.checkout-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9375rem;
}

.checkout-item + .checkout-item {
  border-top: 1px solid var(--gray-100);
}

/* =============================================================
   RTL support — triggered when <html dir="rtl"> (Arabic locale)
   Kept at the end so it overrides LTR defaults.
   ============================================================= */

html[dir="rtl"] body,
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select,
html[dir="rtl"] button { text-align: right; font-family: inherit; }

/* Flip generic inline margins/padding (safety net for values still in left/right) */
html[dir="rtl"] .cart-item-image,
html[dir="rtl"] .product-image,
html[dir="rtl"] .highlight-image { margin-right: 0; margin-left: 12px; }

/* Sidebars, slide-in panels — flip the anchor */
html[dir="rtl"] .sidebar,
html[dir="rtl"] .cart-sidebar,
html[dir="rtl"] .menu-sidebar { left: auto; right: 0; }
html[dir="rtl"] .sidebar.open,
html[dir="rtl"] .cart-sidebar.open { transform: translateX(0); }
html[dir="rtl"] .sidebar:not(.open),
html[dir="rtl"] .cart-sidebar:not(.open) { transform: translateX(100%); }

/* Close buttons on modals and drawers */
html[dir="rtl"] .modal-close,
html[dir="rtl"] .sidebar-close,
html[dir="rtl"] .close-btn { right: auto; left: 12px; }

/* Timeline dots — flip the pseudo line direction */
html[dir="rtl"] .timeline-item { flex-direction: row-reverse; }
html[dir="rtl"] .timeline-dot { margin-left: 0; margin-right: 12px; }

/* Chevrons in lists and nav → rotate on RTL so they point inward */
html[dir="rtl"] .chevron-right,
html[dir="rtl"] .back-btn svg,
html[dir="rtl"] svg.rtl-flip { transform: scaleX(-1); }

/* Form fields — align label/icon to the right */
html[dir="rtl"] .form-row,
html[dir="rtl"] .cart-item-info,
html[dir="rtl"] .product-detail-content { text-align: right; }

/* Number badges in cart/quantity — stay LTR for digits but flip container order */
html[dir="rtl"] .cart-item { flex-direction: row-reverse; }
html[dir="rtl"] .quantity-selector { flex-direction: row-reverse; }

/* Currency + price — keep numbers LTR even in RTL layout */
html[dir="rtl"] .price,
html[dir="rtl"] .product-detail-price,
html[dir="rtl"] .cart-total,
html[dir="rtl"] .order-total { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* Toast / alert — slide in from the left on RTL */
html[dir="rtl"] .toast { right: auto; left: 16px; }

/* Topbar nav pill alignment */
html[dir="rtl"] .topbar-nav { flex-direction: row-reverse; }

/* Location bar on discover — keep search icon and text aligned */
html[dir="rtl"] .location-icon { left: auto; right: 12px; }
html[dir="rtl"] .location-input { padding-left: 12px; padding-right: 40px; }
