/* =========================================
   ONE STEP — orders.css
   سجل الطلبات
========================================= */

.orders-page { background: var(--gray); min-height: calc(100vh - 64px); padding: 32px 0 64px; }

.orders-head { margin-bottom: 28px; }
.orders-head h1 { font-size: 30px; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.orders-head p { font-size: 14px; color: var(--muted); }

/* Filter tabs */
.orders-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.orders-tab {
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 22px;
  padding: 9px 20px;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; color: var(--muted);
  transition: all 0.18s;
}
.orders-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Order card */
.order-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 18px;
  transition: box-shadow 0.2s;
}
.order-card:hover { box-shadow: var(--shadow); }

.order-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.order-num-box .onb-label { font-size: 12px; color: var(--muted); }
.order-num-box .onb-num { font-size: 17px; font-weight: 800; color: var(--navy); }
.order-date { font-size: 13px; color: var(--muted); }

.order-status {
  font-size: 13px; font-weight: 700;
  padding: 7px 16px; border-radius: 18px;
}
.status-جديد       { background: rgba(68,96,239,0.12); color: #4460ef; }
.status-قيد-المعالجة { background: rgba(245,166,35,0.14); color: #d68910; }
.status-تم-الشحن    { background: rgba(120,199,103,0.14); color: var(--navy); }
.status-تم-التسليم  { background: rgba(39,174,96,0.12); color: hsl(145, 63%, 42%); }
.status-ملغي        { background: rgba(231,76,60,0.1); color: #e74c3c; }

/* Timeline */
.order-timeline {
  display: flex;
  align-items: center;
  margin: 20px 0;
  padding: 0 8px;
}
.tl-step { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; }
.tl-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--gray);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--muted);
  z-index: 2;
}
.tl-step.done .tl-dot { background: var(--green); border-color: var(--green); color: var(--on-green); }
.tl-step.current .tl-dot { background: var(--navy); border-color: var(--navy); color: #fff; animation: pulse 2s infinite; }
.tl-label { font-size: 11px; color: var(--muted); margin-top: 6px; text-align: center; }
.tl-step.done .tl-label, .tl-step.current .tl-label { color: var(--navy); font-weight: 700; }
.tl-line { position: absolute; top: 15px; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 1; }
.tl-step.done .tl-line { background: var(--green); }
.tl-step:first-child .tl-line { display: none; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(5,23,62,0.3); } 50% { box-shadow: 0 0 0 6px rgba(5,23,62,0); } }

/* Order items */
.order-items { display: flex; flex-direction: column; gap: 12px; margin: 18px 0; }
.order-item {
  display: flex; align-items: center; gap: 12px;
}
.order-item-icon {
  position: relative; overflow: hidden; flex-shrink: 0;
  width: 46px; height: 46px;
  background: var(--gray);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.order-item-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 3px; background: var(--photo-stage, #fff); }
.order-item-info { flex: 1; }
.order-item-name { font-size: 14px; font-weight: 700; color: var(--navy); }
.order-item-meta { font-size: 12px; color: var(--muted); }
.order-item-price { font-size: 14px; font-weight: 700; color: var(--green-d); }

.order-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.order-total-label { font-size: 14px; color: var(--muted); }
.order-total-val { font-size: 20px; font-weight: 800; color: var(--navy); }
.order-pay-method { font-size: 12.5px; color: var(--muted); }

/* Empty */
.orders-empty { text-align: center; padding: 80px 20px; }
.orders-empty h2 { font-size: 24px; color: var(--navy); margin-bottom: 8px; }
.orders-empty p { color: var(--muted); margin-bottom: 24px; }
.orders-empty a {
  display: inline-block; background: var(--navy); color: #fff;
  padding: 14px 32px; border-radius: 12px; font-weight: 700; font-size: 15px;
}

@media (max-width: 560px) {
  .orders-head h1 { font-size: 24px; }
  .tl-label { font-size: 9px; }
  .order-card { padding: 18px; }
}

/* ===== تقليل الحركة — احترام prefers-reduced-motion (PRODUCT.md §الإتاحة) =====
   المستخدم الذي يطلب تقليل الحركة (نظام التشغيل) تصبح كل الانتقالات/الحركات
   لحظية فعلياً بدل إلغائها — لا تُفقد أي وظيفة، فقط تختفي الحركة. */
@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;
  }
}

/* S4 · first-order gift */
.order-gift-tag { color: #8e44ad; font-weight: 700; }
.order-gift-note { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: rgba(142,68,173,0.08); color: #6c3483; font-size: 0.9rem; }

/* ===== S11.2 · «طلباتي»: the editing window, real step times, the order editor (owner, 2026-11-24) ===== */
.tl-label { font-size: 12px; }
.tl-when { font-size: 11px; color: var(--ink, #1a2238); margin-top: 3px; text-align: center; line-height: 1.45; padding: 0 2px; overflow-wrap: anywhere; }
.tl-step.current .tl-dot { animation: none; box-shadow: 0 0 0 4px rgba(5, 23, 62, 0.12); }
@media (max-width: 560px) { .tl-label { font-size: 11px; } .tl-when { font-size: 10.5px; } }

.order-edit-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin: 4px 0 18px; padding: 16px 18px; border-radius: 14px;
  background: rgba(120, 199, 103, 0.12); border: 1.5px solid var(--green);
}
.oeb-text { min-width: 0; flex: 1 1 260px; }
.oeb-title { font-size: 16px; font-weight: 800; color: var(--on-green); }
.oeb-q { font-size: 15px; font-weight: 700; color: var(--navy); margin-top: 2px; }
.oeb-desc { font-size: 14px; color: var(--ink, #1a2238); margin: 4px 0 0; line-height: 1.65; }
.oeb-side { display: flex; flex-direction: column; align-items: stretch; gap: 10px; flex: 0 1 260px; min-width: 0; }
.oeb-timer { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 700; color: var(--navy); }
.oeb-timer strong { font-size: 20px; font-variant-numeric: tabular-nums; color: var(--navy); }
.oeb-btn {
  min-height: 46px; border: 0; border-radius: 12px; background: var(--green); color: var(--on-green);
  font-family: inherit; font-size: 14.5px; font-weight: 800; cursor: pointer; padding: 0 16px;
}
.oeb-btn:hover { background: var(--green-d); }
.oeb-btn:focus-visible, .oe-save:focus-visible, .oe-cancel:focus-visible, .oe-close:focus-visible, .oe-add-btn:focus-visible, .oe-variant:focus-visible,
.oe-stepper .qty-btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.order-edit-closed {
  margin: 4px 0 18px; padding: 12px 16px; border-radius: 12px; background: var(--gray); border: 1px solid var(--border);
  color: var(--navy); font-weight: 700; font-size: 14px;
}
@media (max-width: 560px) { .oeb-side { flex-basis: 100%; } }
/* Owner design (2026-11-25): a filled green order-edit banner with white text and a clearly visible countdown.
   S12 accessibility: the fill is the design system's AA green --green-cta (#367029 — white text 5.99:1, WCAG AA for normal text) instead of
   the brand fresh green #77C767 (white 2.07:1); text uses --on-green (DESIGN.md Green Foreground Decision — no colour literal on green). */
.order-edit-banner {
  background: var(--green-cta);
  border-color: var(--green-cta);
}
.oeb-title,
.oeb-q,
.oeb-desc,
.oeb-timer,
.oeb-timer strong {
  color: var(--on-green);
}
/* on the dark-green banner the fresh-green button would blend in (fill 2.9:1 against the banner); inside the banner only it is inverted:
   white fill (5.99:1 against the banner) with AA-green text (5.99:1). The storefront's primary green buttons elsewhere are unchanged. */
.order-edit-banner .oeb-btn { background: var(--on-green); color: var(--green-cta); }
.order-edit-banner .oeb-btn:hover { background: var(--on-green); color: var(--green-cta-d); }

/* the editor sheet */
body.oe-open { overflow: hidden; }
.oe-overlay[hidden] { display: none; }
.oe-overlay {
  position: fixed; inset: 0; z-index: 1200; background: rgba(5, 23, 62, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.oe-sheet {
  background: #fff; border-radius: 20px; width: min(640px, 100%); max-height: min(92vh, 900px);
  display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow);
}
.oe-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--border); }
.oe-head h2 { font-size: 19px; font-weight: 800; color: var(--navy); margin: 0; }
.oe-timer { margin: 4px 0 0; font-size: 13.5px; font-weight: 700; color: var(--ink, #1a2238); }
.oe-timer strong { font-variant-numeric: tabular-nums; color: var(--navy); font-size: 15px; }
.oe-close { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); background: #fff; font-size: 22px; cursor: pointer; color: var(--navy); flex-shrink: 0; }
.oe-body { overflow-y: auto; padding: 8px 20px 12px; overscroll-behavior: contain; }
.oe-section { padding: 12px 0; border-bottom: 1px solid var(--border); }
.oe-section:last-child { border-bottom: 0; }
.oe-section h3 { font-size: 15px; font-weight: 800; color: var(--navy); margin: 0 0 10px; }
.oe-line { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.oe-line-media { position: relative; width: 52px; height: 52px; border-radius: 11px; background: var(--photo-stage, var(--gray)); flex-shrink: 0; overflow: hidden; }
.oe-line-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.oe-line-info { flex: 1; min-width: 0; }
.oe-line-name { font-size: 14px; font-weight: 700; color: var(--navy); line-height: 1.5; overflow-wrap: anywhere; }
.oe-line-variant { font-size: 12.5px; color: var(--ink, #1a2238); margin-top: 1px; }
.oe-line-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.oe-line-price { font-size: 14px; font-weight: 800; color: var(--green-d); white-space: nowrap; }
.oe-line-kept { padding-inline-start: 64px; }
.oe-stepper .qty-btn { width: 36px; height: 36px; border-radius: 10px; font-size: 18px; }
@media (pointer: coarse) { .oe-stepper .qty-btn { width: 44px; height: 44px; } }
.oe-search {
  width: 100%; min-height: 46px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--gray);
  padding: 0 14px; font-family: inherit; font-size: 15px; color: var(--text);
}
.oe-search:focus { outline: none; border-color: var(--green); background: #fff; }
.oe-results { display: grid; gap: 8px; margin-top: 10px; }
.oe-res { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 8px; min-width: 0; }
.oe-res-media { position: relative; width: 48px; height: 48px; border-radius: 10px; background: var(--photo-stage, var(--gray)); flex-shrink: 0; overflow: hidden; }
.oe-res-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.oe-res-info { flex: 1; min-width: 0; }
.oe-res-name { font-size: 13.5px; font-weight: 700; color: var(--navy); line-height: 1.45; overflow-wrap: anywhere; }
.oe-res-price { font-size: 13px; font-weight: 800; color: var(--green-d); }
.oe-add-btn, .oe-variant {
  min-height: 40px; border: 1.5px solid var(--green); background: #fff; color: var(--navy); border-radius: 10px;
  font-family: inherit; font-weight: 800; font-size: 13px; cursor: pointer; padding: 0 14px; flex-shrink: 0;
}
.oe-add-btn:hover, .oe-variant:hover { background: var(--green); color: var(--on-green); }
.oe-variants { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.oe-variant { min-height: 36px; padding: 0 10px; font-size: 12.5px; }
.oe-empty { font-size: 13.5px; color: var(--ink, #1a2238); margin: 6px 0; }
.oe-foot { border-top: 1px solid var(--border); padding: 12px 20px 16px; background: #fff; }
.oe-totals { margin: 0 0 8px; display: grid; gap: 4px; }
.oe-totals[aria-busy="true"] { opacity: 0.55; }
.oe-trow { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--ink, #1a2238); }
.oe-trow dt, .oe-trow dd { margin: 0; }
.oe-trow.oe-total { font-size: 16px; font-weight: 800; color: var(--navy); }
.oe-trow.oe-was { font-size: 12.5px; color: var(--muted); }
.oe-msg { min-height: 1.4em; margin: 0 0 8px; font-size: 13.5px; font-weight: 700; color: var(--navy); }
.oe-msg[data-kind="error"] { color: #b42318; }
.oe-actions { display: flex; gap: 10px; }
.oe-save { flex: 1; min-height: 48px; border: 0; border-radius: 12px; background: var(--green); color: var(--on-green); font-family: inherit; font-size: 15px; font-weight: 800; cursor: pointer; }
.oe-save:disabled { opacity: 0.5; cursor: not-allowed; }
.oe-cancel { min-height: 48px; padding: 0 18px; border: 1.5px solid var(--border); border-radius: 12px; background: #fff; color: var(--navy); font-family: inherit; font-weight: 700; cursor: pointer; }
@media (max-width: 560px) {
  .oe-overlay { padding: 0; align-items: flex-end; }
  .oe-sheet { border-radius: 18px 18px 0 0; max-height: 94vh; width: 100%; }
  .oe-head, .oe-body, .oe-foot { padding-inline: 16px; }
}
