/* ============================================
   APPLICATION CLIENT - MARCHÉ SUPERMARCHÉ
   Styles de la boutique en ligne
   ============================================ */

:root {
  --green: #006633;
  --green-light: #008844;
  --green-pale: #e8f5ee;
  --red: #CC0000;
  --gold: #f9a825;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f4;
  --gray-200: #e8eaed;
  --gray-300: #dadce0;
  --gray-500: #9aa0a6;
  --gray-700: #5f6368;
  --gray-900: #202124;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
  padding-bottom: 80px;
  overflow-x: hidden;
}

body.rtl {
  direction: rtl;
  font-family: 'Cairo', sans-serif;
}

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }

/* ====== APP HEADER ====== */
.app-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.app-header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.header-logo img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8f8f8;
  padding: 2px;
}

.header-brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--green);
  line-height: 1;
}

.header-sub {
  font-size: 10px;
  color: var(--gray-500);
  line-height: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-currency-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--gray-100);
  border-radius: 20px;
  padding: 3px 6px;
}

.mini-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-700);
  padding: 3px 7px;
  border-radius: 14px;
  transition: all 0.2s;
}

.mini-btn.active {
  background: var(--green);
  color: white;
}

.app-cart-btn {
  position: relative;
  background: var(--green-pale);
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 16px;
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.app-cart-btn:hover { background: var(--green); color: white; }

.cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.btn-login {
  background: var(--green);
  color: white;
  border: none;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-login:hover { background: var(--green-light); }

/* ====== HERO BANNER ====== */
.hero-banner {
  background: linear-gradient(135deg, var(--green) 0%, #008844 100%);
  padding: 40px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  min-height: 300px;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.hero-content {
  max-width: 450px;
  color: white;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  margin-bottom: 12px;
  backdrop-filter: blur(4px);
}

.hero-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 10px;
}

.hero-sub {
  font-size: 14px;
  opacity: 0.85;
  margin-bottom: 20px;
}

.hero-search {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 30px;
  padding: 6px 8px 6px 16px;
  gap: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.hero-search i { color: var(--gray-500); }

.hero-search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--gray-900);
  background: none;
}

.hero-search button {
  background: var(--green);
  border: none;
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.hero-search button:hover { background: var(--green-light); transform: scale(1.05); }

.hero-img-side {
  z-index: 1;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .hero-img-side { display: none; }
  .hero-title { font-size: 22px; }
  .hero-banner { min-height: 220px; }
}

/* ====== CATEGORIES ====== */
.categories-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 8px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 14px;
}

.categories-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
}

.categories-bar::-webkit-scrollbar { display: none; }

.cat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 24px;
  border: 1.5px solid var(--gray-200);
  background: white;
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.cat-chip:hover { border-color: var(--green); color: var(--green); }
.cat-chip.active { background: var(--green); color: white; border-color: var(--green); }
.cat-chip i { font-size: 13px; }

/* ====== PRODUCTS SECTION ====== */
.products-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

.app-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* ====== APP PRODUCT CARD ====== */
.app-product-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: all 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.app-product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.app-product-img {
  position: relative;
  height: 130px;
  overflow: hidden;
  background: var(--gray-100);
  flex-shrink: 0;
}

.app-product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.app-product-card:hover .app-product-img img {
  transform: scale(1.06);
}

.sold-out-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 1px;
}

.tva-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--gold);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.app-product-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.app-product-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 3px;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.app-product-cat {
  font-size: 10px;
  color: var(--gray-500);
  margin-bottom: 6px;
}

.app-product-price-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 8px;
}

.app-product-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--green);
}

.app-product-unit {
  font-size: 10px;
  color: var(--gray-500);
}

.app-add-btn {
  background: var(--green);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s;
  margin-top: auto;
}

.app-add-btn:hover { background: var(--green-light); }
.app-add-btn:active { transform: scale(0.97); }

.app-qty-ctrl {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--green);
  border-radius: 8px;
  overflow: hidden;
  margin-top: auto;
}

.app-qty-ctrl button {
  background: var(--green-pale);
  border: none;
  color: var(--green);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-qty-ctrl button:hover { background: var(--green); color: white; }

.app-qty-ctrl span {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--green);
}

.out-label {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--red);
  padding: 6px;
  background: #fdecea;
  border-radius: 6px;
  margin-top: auto;
}

/* ====== VIEW HEADER ====== */
.view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 57px;
  z-index: 50;
}

.back-btn {
  background: var(--gray-100);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.back-btn:hover { background: var(--gray-200); }

.view-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
}

/* ====== CART ====== */
.cart-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

.cart-item {
  background: white;
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.cart-item-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--gray-100);
  flex-shrink: 0;
}

.cart-item-info { flex: 1; min-width: 0; }

.cart-item-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}

.cart-item-qty button {
  background: var(--gray-100);
  border: none;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 11px;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.cart-item-qty button:hover { background: var(--green); color: white; }
.cart-item-qty span { font-size: 13px; font-weight: 700; min-width: 22px; text-align: center; }

.cart-item-total {
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
  min-width: 65px;
  text-align: right;
}

.cart-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-300);
  font-size: 14px;
  padding: 4px;
  transition: color 0.2s;
}

.cart-item-remove:hover { color: var(--red); }

.cart-total-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 12px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
}

.cart-total-row:last-child { border-bottom: none; }

.cart-total-row.grand {
  font-size: 16px;
  font-weight: 700;
  padding-top: 12px;
  border-top: 2px solid var(--gray-200);
  border-bottom: none;
}

.btn-checkout {
  width: 100%;
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(0,102,51,0.3);
}

.btn-checkout:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(0,102,51,0.4); }
.btn-checkout:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.btn-shop {
  background: var(--green-pale);
  color: var(--green);
  border: 1.5px solid var(--green);
  border-radius: var(--radius);
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
  transition: all 0.2s;
}

.btn-shop:hover { background: var(--green); color: white; }

/* ====== AUTH ====== */
.auth-container {
  max-width: 420px;
  margin: 20px auto;
  padding: 0 16px;
}

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.auth-tab.active { color: var(--green); border-bottom-color: var(--green); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.form-grp label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 5px;
}

.form-grp input,
.form-grp textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 14px;
  color: var(--gray-900);
  background: white;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-grp input:focus,
.form-grp textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0,102,51,0.1);
}

.form-grp textarea { resize: vertical; min-height: 70px; }

.btn-auth {
  background: var(--green);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  width: 100%;
}

.btn-auth:hover { background: var(--green-light); }

/* ====== CHECKOUT ====== */
.checkout-container {
  max-width: 580px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.checkout-section {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.checkout-section-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.payment-options { display: flex; flex-direction: column; gap: 8px; }

.payment-opt { cursor: pointer; }
.payment-opt input[type="radio"] { display: none; }

.payment-opt-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  transition: all 0.2s;
}

.payment-opt-body i { font-size: 16px; color: var(--gray-500); }
.payment-opt input:checked + .payment-opt-body { border-color: var(--green); background: var(--green-pale); color: var(--green); }
.payment-opt input:checked + .payment-opt-body i { color: var(--green); }

.co-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--gray-100);
}

.co-totals { margin-top: 10px; }

.co-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 7px 0;
  border-bottom: 1px solid var(--gray-100);
}

.co-total-row.grand { font-size: 15px; font-weight: 700; border: none; padding-top: 12px; }

/* ====== CONFIRMED ====== */
.confirmed-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 50px 20px;
  text-align: center;
}

.confirmed-icon {
  font-size: 72px;
  color: #43a047;
  margin-bottom: 20px;
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0% { transform: scale(0); }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.confirmed-container h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 10px;
}

.confirmed-container p {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 20px;
}

.confirmed-tracking {
  margin: 20px 0;
}

/* ====== PRODUCT DETAIL ====== */
.product-detail {
  max-width: 700px;
  margin: 0 auto;
  padding: 16px;
}

.product-detail-img {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  height: 260px;
  background: var(--gray-100);
}

.product-detail-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-detail-category {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.product-detail-name {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.2;
}

.product-detail-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 12px;
}

.product-detail-desc {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.6;
  margin-bottom: 16px;
}

.product-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  background: var(--gray-100);
  padding: 5px 10px;
  border-radius: 20px;
  color: var(--gray-700);
}

/* ====== ORDERS LIST ====== */
.order-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.order-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.order-number { font-size: 14px; font-weight: 700; }
.order-date { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

.order-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  display: inline-block;
}

.order-items-preview {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-total { font-size: 16px; font-weight: 800; color: var(--green); }
.order-track { font-size: 11px; color: var(--gray-500); display: flex; align-items: center; gap: 4px; }

/* ====== PROGRESS TRACKER ====== */
.order-progress {
  display: flex;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
  overflow-x: auto;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  color: var(--gray-300);
  text-align: center;
  min-width: 55px;
  transition: color 0.3s;
}

.progress-step.done { color: var(--green); }
.progress-step i { font-size: 16px; }

.progress-line {
  flex: 1;
  height: 2px;
  background: var(--gray-200);
  min-width: 20px;
  transition: background 0.3s;
}

.progress-line.done { background: var(--green); }

/* ====== ORDER DETAIL ====== */
.detail-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-50);
}

.detail-row:last-child { border-bottom: none; }

/* ====== PROFILE ====== */
.app-avatar-lg {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}

/* ====== BOTTOM NAV ====== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--gray-200);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  height: 64px;
}

.bottom-nav-item {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  color: var(--gray-500);
  font-weight: 600;
  transition: color 0.2s;
  position: relative;
  padding: 8px 4px;
}

.bottom-nav-item i { font-size: 18px; }
.bottom-nav-item.active { color: var(--green); }
.bottom-nav-item:active { transform: scale(0.95); }

.nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 16px);
  background: var(--red);
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* ====== RTL ADJUSTMENTS ====== */
body.rtl .hero-banner { flex-direction: row-reverse; }
body.rtl .view-header { flex-direction: row-reverse; }
body.rtl .back-btn i { transform: scaleX(-1); }
body.rtl .cart-item { flex-direction: row-reverse; }
body.rtl .cart-total-row { flex-direction: row-reverse; }
body.rtl .order-card-header { flex-direction: row-reverse; }
body.rtl .co-item { flex-direction: row-reverse; }
body.rtl .order-card-footer { flex-direction: row-reverse; }
body.rtl .detail-row { flex-direction: row-reverse; }
body.rtl .hero-search { flex-direction: row-reverse; }
body.rtl .app-header-inner { flex-direction: row-reverse; }
body.rtl .header-actions { flex-direction: row-reverse; }
body.rtl input, body.rtl textarea { text-align: right; }

/* ====== RESPONSIVE ====== */
@media (max-width: 480px) {
  .app-products-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 20px; }
  .hero-search input { font-size: 13px; }
}

@media (min-width: 768px) {
  .app-products-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .app-products-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ====== ANIMATIONS ====== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-product-card { animation: fadeUp 0.3s ease both; }
.order-card { animation: fadeUp 0.3s ease both; }

/* ====== SAFE AREA (Notch) ====== */
.bottom-nav {
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: calc(64px + env(safe-area-inset-bottom, 0px));
}

body { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

/* ====== QUANTITY MANUAL INPUT ====== */
.qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-100);
  border-radius: 24px;
  padding: 4px 6px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  background: white;
  color: var(--green);
  box-shadow: var(--shadow-sm);
}

.qty-btn:hover { background: var(--green); color: white; }
.qty-btn:active { transform: scale(0.9); }

.qty-manual-input {
  width: 40px;
  text-align: center;
  border: 1.5px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-900);
  padding: 3px 4px;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  -moz-appearance: textfield;
}

.qty-manual-input::-webkit-inner-spin-button,
.qty-manual-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.qty-manual-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0,102,51,0.12);
}

/* Cart specific qty input */
.cart-qty-input {
  width: 48px;
  text-align: center;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  padding: 4px 6px;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  -moz-appearance: textfield;
}

.cart-qty-input::-webkit-inner-spin-button,
.cart-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.cart-qty-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0,102,51,0.12);
}

/* ====== REAL-TIME INDICATORS ====== */
.realtime-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #43a047;
  background: rgba(67,160,71,0.1);
  border-radius: 20px;
  padding: 3px 10px;
  border: 1px solid rgba(67,160,71,0.2);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #43a047;
  display: inline-block;
  animation: pulseDot 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
}

/* ====== ORDER CARD REAL-TIME UPDATE FLASH ====== */
@keyframes cardFlash {
  0% { background: white; }
  30% { background: rgba(67,160,71,0.08); border-color: rgba(67,160,71,0.3); }
  100% { background: white; border-color: var(--gray-200); }
}

.order-card-updated {
  animation: cardFlash 1.2s ease forwards;
}

/* ====== ORDER PROGRESS BAR (horizontal — dans cards liste) ====== */
.order-progress-bar {
  display: flex;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
  gap: 0;
  overflow: visible;
}

.prog-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 1;
  min-width: 52px;
}

.prog-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.3s;
  border: 2px solid var(--gray-200);
  background: white;
  color: var(--gray-300);
}

.prog-step.done .prog-icon {
  background: var(--green);
  border-color: var(--green);
  color: white;
  box-shadow: 0 2px 8px rgba(0,102,51,0.3);
}

.prog-step.active .prog-icon {
  background: white;
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 2px 8px rgba(0,102,51,0.2);
  animation: activePulse 2s ease-in-out infinite;
}

@keyframes activePulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(0,102,51,0.2); }
  50% { box-shadow: 0 2px 16px rgba(0,102,51,0.45); }
}

.prog-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--gray-400);
  text-align: center;
  line-height: 1.1;
  max-width: 52px;
  white-space: normal;
}

.prog-step.done .prog-label { color: var(--green); }
.prog-step.active .prog-label { color: var(--green); font-weight: 700; }

.prog-line {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--gray-200);
  transition: background 0.4s ease;
  margin: 0 2px;
  margin-bottom: 14px;
}

.prog-line.done { background: var(--green); }

/* ====== ORDER DETAIL — VERTICAL TIMELINE ====== */
.detail-progress {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0;
}

.detail-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
}

.detail-step-icon-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  width: 36px;
}

.detail-step-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 2px solid var(--gray-200);
  background: white;
  color: var(--gray-300);
  transition: all 0.3s;
  position: relative;
  z-index: 1;
}

.detail-step.done .detail-step-icon {
  background: var(--green);
  border-color: var(--green);
  color: white;
  box-shadow: 0 3px 10px rgba(0,102,51,0.3);
}

.detail-step.active .detail-step-icon {
  background: white;
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 3px 10px rgba(0,102,51,0.25);
  animation: activePulse 2s ease-in-out infinite;
}

.detail-step.cancelled .detail-step-icon {
  background: #fff5f5;
  border-color: var(--red);
  color: var(--red);
}

.detail-vline {
  width: 2px;
  height: 28px;
  background: var(--gray-200);
  border-radius: 1px;
  margin: 0 auto;
  transition: background 0.3s;
}

.detail-vline.done { background: var(--green); }

.detail-step-info {
  padding: 6px 0 20px;
  flex: 1;
}

.detail-step-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-400);
  line-height: 1.2;
  transition: color 0.3s;
}

.detail-step.done .detail-step-label { color: var(--green); }
.detail-step.active .detail-step-label { color: var(--gray-900); }
.detail-step.cancelled .detail-step-label { color: var(--red); }

.detail-step-sub {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* RTL adjustments for new elements */
body.rtl .qty-control { flex-direction: row-reverse; }
body.rtl .order-progress-bar { flex-direction: row-reverse; }
body.rtl .detail-step { flex-direction: row-reverse; }
body.rtl .realtime-dot { flex-direction: row-reverse; }
