/* ============================================================
   LaundryFlow — الأنماط المشتركة (style.css)
   مبنية على theme.css — يجب تحميل theme.css قبلها
   ============================================================ */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: var(--fs-base);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--accent-dark); }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--primary-soft); }

/* ---------- أدوات عامة ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-4);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-inline: auto;
  padding-inline: var(--sp-4);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--touch-target);
  padding: var(--sp-3) var(--sp-5);
  border: none;
  border-radius: var(--r-pill);
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px -4px rgba(13, 148, 136, 0.5);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--primary-dark);
  border: 2px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); background: var(--primary-50); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  min-height: 44px;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }

.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: var(--fs-lg); padding-inline: var(--sp-6); }

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- البطاقات ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.card-padded { padding: var(--sp-5); }

/* ---------- شارات الحالة ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0.2rem 0.75rem;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1.6;
  white-space: nowrap;
}
.badge.pending   { background: var(--warning-soft);  color: var(--st-pending); }
.badge.picked    { background: #FFEDD5;              color: var(--st-picked); }
.badge.collected { background: #CFFAFE;              color: var(--st-collected); }
.badge.washing   { background: #EDE9FE;              color: var(--st-washing); }
.badge.preparing { background: #E0E7FF;              color: var(--st-preparing); }
.badge.ready     { background: var(--primary-soft);  color: var(--st-ready); }
.badge.delivered { background: var(--info-soft);     color: var(--st-delivered); }

/* ---------- حقول النماذج ---------- */
.field { margin-bottom: var(--sp-4); }

.field > label {
  display: block;
  margin-bottom: var(--sp-2);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  color: var(--text);
}

.input, .select, .textarea {
  width: 100%;
  min-height: var(--touch-target);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.input::placeholder, .textarea::placeholder { color: var(--text-faint); }

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
  outline: none;
}

.textarea { min-height: 96px; resize: vertical; }

.select {
  appearance: none;
  background-image: url("/src/assets/icons/chevron-down.svg");
  background-repeat: no-repeat;
  background-position: left 0.9rem center; /* RTL: السهم يسار */
  background-size: 1.1em;
  padding-inline-end: var(--sp-4);
  padding-inline-start: 2.5rem;
}

/* حقول الأرقام/الجوال: أرقام لاتينية LTR */
.input-ltr { direction: ltr; text-align: right; }

.field-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--sp-1);
}

.field-error {
  font-size: var(--fs-xs);
  color: var(--danger);
  margin-top: var(--sp-1);
  display: none;
}
.field.has-error .field-error { display: block; }
.field.has-error .input,
.field.has-error .select { border-color: var(--danger); }

/* ---------- بطاقات الاختيار (Chips) ---------- */
.choice-grid {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 480px) {
  .choice-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

.choice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  min-height: var(--touch-target);
  padding: var(--sp-3) var(--sp-2);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: center;
  font-weight: var(--fw-medium);
  transition: border-color var(--dur) var(--ease),
              background var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.choice-card .choice-icon { font-size: 1.5rem; }
.choice-card .choice-sub { font-size: var(--fs-xs); color: var(--text-muted); font-weight: var(--fw-regular); }

.choice-card.selected {
  border-color: var(--primary);
  background: var(--primary-50);
  box-shadow: var(--shadow-focus);
  color: var(--primary-darker);
  font-weight: var(--fw-bold);
}

.choice-card.selected::after {
  content: '✓';
  position: absolute;
  top: 6px;
  inset-inline-start: 8px;
  width: 20px;
  height: 20px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 0.7rem;
  display: grid;
  place-items: center;
}

/* ---------- شريط علوي للتطبيق ---------- */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.app-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: var(--sp-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: var(--fw-black);
  font-size: var(--fs-lg);
  color: var(--text);
  text-decoration: none;
}

.brand .brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--r-md);
  font-size: 1.2rem;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--primary-darker) 0%, var(--primary) 55%, var(--accent-dark) 120%);
  color: #fff;
  padding: var(--sp-10) var(--sp-4) var(--sp-8);
  text-align: center;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% 15%, rgba(255,255,255,0.14) 0, transparent 45%),
    radial-gradient(circle at 10% 90%, rgba(255,255,255,0.10) 0, transparent 40%);
  pointer-events: none;
}

.hero > * { position: relative; }

.hero h1 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-black);
  line-height: 1.4;
  margin-bottom: var(--sp-3);
}

.hero p {
  font-size: var(--fs-base);
  opacity: 0.92;
  max-width: 540px;
  margin: 0 auto var(--sp-5);
}

.hero .cta-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  align-items: center;
}

.hero .btn-primary {
  background: #fff;
  color: var(--primary-darker);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.25);
}
.hero .btn-primary:hover { background: var(--primary-50); }

.hero .btn-outline-light {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
}
.hero .btn-outline-light:hover { background: rgba(255, 255, 255, 0.22); }

@media (min-width: 768px) {
  .hero { padding: 6rem var(--sp-4) 5rem; }
  .hero h1 { font-size: var(--fs-3xl); }
  .hero p { font-size: var(--fs-lg); }
  .hero .cta-group { flex-direction: row; justify-content: center; }
}

/* ---------- شريط الثقة ---------- */
.trust-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
  max-width: 720px;
  margin: calc(var(--sp-6) * -1) auto 0;
  padding-inline: var(--sp-4);
  position: relative;
  z-index: 2;
}

.trust-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: var(--sp-3) var(--sp-2);
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
}

.trust-item .trust-icon { font-size: 1.4rem; display: block; margin-bottom: var(--sp-1); }

/* ---------- الأقسام ---------- */
.section { padding: var(--sp-8) 0; }

.section-title {
  text-align: center;
  font-size: var(--fs-xl);
  font-weight: var(--fw-black);
  margin-bottom: var(--sp-2);
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-6);
}

@media (min-width: 768px) {
  .section-title { font-size: var(--fs-2xl); }
}

/* ---------- الخدمات ---------- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}

@media (min-width: 768px) {
  .service-grid { grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
}
@media (min-width: 1024px) {
  .service-grid { grid-template-columns: repeat(5, 1fr); }
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-3);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-soft);
}

.service-card .service-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--sp-2);
  display: grid;
  place-items: center;
  background: var(--primary-50);
  border-radius: var(--r-md);
  font-size: 1.6rem;
}

.service-card .service-name { font-weight: var(--fw-bold); }
.service-card .service-desc { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-1); }

/* ---------- خطوات العمل ---------- */
.how-section { background: var(--surface); border-block: 1px solid var(--border); }

.steps-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  max-width: 480px;
  margin: 0 auto;
  list-style: none;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  position: relative;
}

.step-item:not(:last-child)::before {
  content: '';
  position: absolute;
  top: 44px;
  inset-inline-start: 21px;
  bottom: calc(var(--sp-4) * -1);
  width: 2px;
  background: var(--border);
}

.step-num {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-darker);
  border-radius: 50%;
  font-weight: var(--fw-black);
  font-size: var(--fs-lg);
  position: relative;
  z-index: 1;
}

.step-body { padding-top: var(--sp-1); }
.step-body .step-title { font-weight: var(--fw-bold); }
.step-body .step-desc { font-size: var(--fs-sm); color: var(--text-muted); }

@media (min-width: 768px) {
  .steps-list { flex-direction: row; max-width: none; gap: var(--sp-3); }
  .step-item { flex-direction: column; align-items: center; text-align: center; flex: 1; }
  .step-item:not(:last-child)::before {
    top: 21px;
    inset-inline-start: calc(50% + 28px);
    width: calc(100% - 56px);
    height: 2px;
    bottom: auto;
  }
}

/* ---------- قسم CTA الختامي ---------- */
.cta-final {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
}

.cta-final h2 { font-size: var(--fs-xl); font-weight: var(--fw-black); margin-bottom: var(--sp-2); }
.cta-final p { color: var(--text-muted); margin-bottom: var(--sp-5); }

/* ---------- التذييل ---------- */
.site-footer {
  background: var(--text);
  color: var(--text-faint);
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
  font-size: var(--fs-sm);
}

.site-footer .brand { color: #fff; justify-content: center; margin-bottom: var(--sp-2); }

/* ---------- Toasts ---------- */
.toast-container {
  position: fixed;
  top: var(--sp-4);
  inset-inline: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding-inline: var(--sp-4);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  max-width: 420px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--text);
  color: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  pointer-events: auto;
  animation: toast-in 0.3s var(--ease);
}

.toast.leaving { animation: toast-out 0.25s var(--ease) forwards; }

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info    { background: var(--info); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-12px) scale(0.96); }
}

/* ---------- الحالات الفارغة ---------- */
.empty-state {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--sp-3);
  opacity: 0.6;
}

.empty-state .empty-title {
  font-weight: var(--fw-bold);
  color: var(--text);
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-1);
}

/* ---------- Skeleton تحميل ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.4s infinite;
  border-radius: var(--r-sm);
}

@keyframes skeleton-wave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- شريط الإرسال السفلي (Sticky) ---------- */
.sticky-submit-bar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-4);
  padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}

.sticky-submit-bar .price-chip {
  flex-shrink: 0;
  text-align: center;
}

.sticky-submit-bar .price-chip .price-value {
  font-size: var(--fs-lg);
  font-weight: var(--fw-black);
  color: var(--primary-darker);
  line-height: 1.2;
}

.sticky-submit-bar .price-chip .price-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ---------- Timeline متابعة الطلب ---------- */
.timeline {
  list-style: none;
  position: relative;
  margin: var(--sp-5) 0;
}

.timeline-item {
  position: relative;
  padding-inline-start: 52px;
  padding-bottom: var(--sp-5);
  min-height: 44px;
}

.timeline-item:last-child { padding-bottom: 0; }

/* الخط الواصل */
.timeline-item::before {
  content: '';
  position: absolute;
  inset-inline-start: 17px;
  top: 40px;
  bottom: -4px;
  width: 3px;
  border-radius: 2px;
  background: var(--border);
}

.timeline-item:last-child::before { display: none; }

.timeline-item.done::before { background: var(--primary); }

/* النقطة */
.timeline-dot {
  position: absolute;
  inset-inline-start: 0;
  top: 2px;
  width: 37px;
  height: 37px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 2px solid var(--border);
  color: var(--text-faint);
  font-size: 0.9rem;
  font-weight: var(--fw-bold);
  z-index: 1;
  transition: all var(--dur) var(--ease);
}

.timeline-item.done .timeline-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.timeline-item.current .timeline-dot {
  background: #fff;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 5px rgba(13, 148, 136, 0.18);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.20); }
  50%      { box-shadow: 0 0 0 8px rgba(13, 148, 136, 0.08); }
}

.timeline-body .timeline-title {
  font-weight: var(--fw-bold);
  color: var(--text-faint);
  padding-top: 6px;
}

.timeline-item.done .timeline-title { color: var(--text); }
.timeline-item.current .timeline-title { color: var(--primary-darker); font-size: var(--fs-lg); }

.timeline-body .timeline-note {
  font-size: var(--fs-xs);
  color: var(--text-faint);
}

.timeline-item.current .timeline-note { color: var(--text-muted); }

/* ---------- تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
