/* ═══════════════════════════════════════════════════════════
   سعید زارع — Design System
   Premium Personal Travel Brand
   ═══════════════════════════════════════════════════════════ */

/* ── Color Tokens: Light ── */
:root {
  --color-bg: #f7f4ef;
  --color-bg-elevated: #ffffff;
  --color-bg-muted: #efe9df;
  --color-bg-subtle: #e8e0d4;
  --color-surface: #ffffff;
  --color-surface-hover: #faf8f5;
  --color-border: rgba(26, 35, 50, 0.1);
  --color-border-strong: rgba(26, 35, 50, 0.18);
  --color-text: #152030;
  --color-text-secondary: #4a5568;
  --color-text-muted: #7a8494;
  --color-text-inverse: #f5f0e8;
  --color-brand: #1a2838;
  --color-brand-soft: #2a3d52;
  --color-accent: #a67c52;
  --color-accent-soft: rgba(166, 124, 82, 0.12);
  --color-accent-hover: #8b6340;
  --color-gold: #c9a962;
  --color-success: #2d6a4f;
  --color-success-bg: rgba(45, 106, 79, 0.1);
  --color-warning: #b8860b;
  --color-warning-bg: rgba(184, 134, 11, 0.1);
  --color-danger: #9b2c2c;
  --color-danger-bg: rgba(155, 44, 44, 0.08);
  --color-info: #2c5282;
  --color-info-bg: rgba(44, 82, 130, 0.08);

  /* Typography system */
  --font-base: 'Vazirmatn', 'Tahoma', system-ui, -apple-system, sans-serif;
  --font-heading: 'Vazirmatn', 'Tahoma', system-ui, sans-serif;
  --font-sans: var(--font-base);
  --text-xs: clamp(0.7rem, 0.65rem + 0.2vw, 0.75rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);
  --text-md: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --text-base: var(--text-md);
  --text-lg: clamp(1.0625rem, 1rem + 0.3vw, 1.125rem);
  --text-xl: clamp(1.1875rem, 1.1rem + 0.4vw, 1.25rem);
  --text-2xl: clamp(1.375rem, 1.2rem + 0.6vw, 1.5rem);
  --text-3xl: clamp(1.625rem, 1.35rem + 1vw, 1.875rem);
  --text-4xl: clamp(1.875rem, 1.5rem + 1.4vw, 2.25rem);
  --text-5xl: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  --text-hero: clamp(2.25rem, 1.2rem + 4vw, 4.25rem);
  --line-tight: 1.2;
  --line-normal: 1.78;
  --line-loose: 2;
  --letter-spacing: 0;
  --letter-spacing-wide: 0.08em;
  --leading-tight: var(--line-tight);
  --leading-normal: var(--line-normal);
  --content-width: min(68rem, 90vw);
  --reading-width: min(36rem, 100%);
  --measure-wide: min(48rem, 100%);
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-28: 7rem;

  /* Radius — minimal */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(21, 32, 48, 0.05);
  --shadow-sm: 0 4px 16px rgba(21, 32, 48, 0.07);
  --shadow-md: 0 12px 32px rgba(21, 32, 48, 0.1);
  --shadow-lg: 0 20px 48px rgba(21, 32, 48, 0.12);
  --shadow-xl: 0 28px 64px rgba(21, 32, 48, 0.14);
  --shadow-glow: none;

  /* Layout */
  --header-h: 76px;
  --sidebar-w: 260px;
  --container: var(--content-width);
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  /* Legacy aliases */
  --bg: var(--color-bg);
  --bg-muted: var(--color-bg-muted);
  --surface: var(--color-surface);
  --text: var(--color-text);
  --text-muted: var(--color-text-muted);
  --border: var(--color-border-strong);
  --accent: var(--color-accent);
  --accent-hover: var(--color-accent-hover);
  --navy: var(--color-brand);
  --shadow: var(--shadow-md);
  --radius: var(--radius-lg);
  --font: var(--font-sans);
}

/* ── Color Tokens: Dark ── */
[data-theme="dark"] {
  --color-bg: #0f1419;
  --color-bg-elevated: #161d27;
  --color-bg-muted: #1c2533;
  --color-bg-subtle: #243044;
  --color-surface: #1a2332;
  --color-surface-hover: #222d3f;
  --color-border: rgba(245, 240, 232, 0.08);
  --color-border-strong: rgba(245, 240, 232, 0.14);
  --color-text: #f0ebe3;
  --color-text-secondary: #b8b0a4;
  --color-text-muted: #8a8278;
  --color-text-inverse: #152030;
  --color-brand: #e8e0d4;
  --color-brand-soft: #c9c0b4;
  --color-accent: #c9a962;
  --color-accent-soft: rgba(201, 169, 98, 0.15);
  --color-accent-hover: #dbb978;
  --color-gold: #c9a962;
  --color-success: #68d391;
  --color-success-bg: rgba(104, 211, 145, 0.12);
  --color-warning: #f6e05e;
  --color-warning-bg: rgba(246, 224, 94, 0.1);
  --color-danger: #fc8181;
  --color-danger-bg: rgba(252, 129, 129, 0.1);
  --color-info: #63b3ed;
  --color-info-bg: rgba(99, 179, 237, 0.1);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-base);
  font-size: var(--text-md);
  font-weight: var(--weight-normal);
  line-height: var(--line-normal);
  letter-spacing: var(--letter-spacing);
  color: var(--color-text);
  background: var(--color-bg);
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--line-tight);
}
p + p { margin-top: var(--space-4); }
.prose p { max-width: var(--reading-width); }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.container { width: var(--container); margin-inline: auto; }

/* ── Typography ── */
.eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-accent);
  margin: 0 0 var(--space-4);
}
.heading-display {
  font-size: var(--text-hero);
  font-weight: var(--weight-extrabold);
  line-height: var(--line-tight);
  letter-spacing: -0.03em;
  margin: 0;
  max-width: 22em;
}
.heading-1 { font-size: var(--text-3xl); font-weight: var(--weight-extrabold); line-height: var(--line-tight); letter-spacing: -0.02em; margin: 0; }
.heading-2 { font-size: var(--text-2xl); font-weight: var(--weight-extrabold); line-height: var(--line-tight); letter-spacing: -0.02em; margin: 0; }
.heading-3 { font-size: var(--text-xl); font-weight: var(--weight-bold); line-height: var(--line-tight); margin: 0; }
.text-lead { font-size: var(--text-lg); color: var(--color-text-secondary); line-height: var(--line-loose); max-width: var(--reading-width); font-weight: var(--weight-normal); }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: var(--text-sm); }
.text-price { font-variant-numeric: tabular-nums; font-weight: var(--weight-bold); letter-spacing: 0.01em; }
.text-date { font-variant-numeric: tabular-nums; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 0.72rem 1.4rem;
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  white-space: nowrap;
  line-height: 1.4;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--color-brand);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); color: var(--color-text-inverse); }
.btn-accent {
  background: var(--color-accent);
  color: #fff;
}
.btn-accent:hover { background: var(--color-accent-hover); color: #fff; }
.btn-outline {
  background: transparent;
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.btn-outline:hover { border-color: var(--color-accent); color: var(--color-accent); }
.btn-ghost { background: transparent; color: var(--color-text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--color-bg-muted); color: var(--color-text); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-sm { padding: 0.5rem 1rem; font-size: var(--text-xs); }
.btn-lg { padding: 0.95rem 1.75rem; font-size: var(--text-base); }
.btn-block { width: 100%; }
.btn-icon {
  width: 42px; height: 42px; padding: 0;
  border-radius: var(--radius-md);
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  text-decoration: none;
}
.btn-icon:hover { border-color: var(--color-accent); background: var(--color-accent-soft); }
.text-link {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.text-link:hover { opacity: 0.8; }

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition);
}
.card-padded { padding: var(--space-6); }
.card-interactive:hover { border-color: var(--color-border-strong); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.65rem;
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  border-radius: var(--radius-full);
  line-height: 1.5;
}
.badge-pending { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-confirmed, .badge-sent { background: var(--color-success-bg); color: var(--color-success); }
.badge-cancelled, .badge-failed { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-completed, .badge-processing { background: var(--color-info-bg); color: var(--color-info); }
.badge-accent { background: var(--color-accent-soft); color: var(--color-accent); }
.badge-neutral { background: var(--color-bg-muted); color: var(--color-text-secondary); }

/* ── Forms ── */
.form-group { margin-bottom: var(--space-5); }
.form-label {
  display: block;
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.form-hint { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}
.form-section {
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-6);
}
.form-error { font-size: var(--text-xs); color: var(--color-danger); margin-top: var(--space-1); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); }
.form-section-title {
  font-size: var(--text-lg); font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.checkbox-label { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; font-size: var(--text-sm); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); background: none; }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.data-table th {
  padding: var(--space-4) 0;
  text-align: start;
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: var(--letter-spacing-wide);
  background: none;
  border-bottom: 1px solid var(--color-border);
}
.data-table td {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: none; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Chips / Filters ── */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  padding: 0.4rem 0.9rem;
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.chip:hover, .chip.active { background: none; border-color: var(--color-text); color: var(--color-text); text-decoration: underline; }

/* ── Progress ── */
.progress { height: 8px; background: var(--color-bg-muted); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar { height: 100%; background: var(--color-accent); border-radius: var(--radius-full); transition: width var(--transition-slow); }

/* ── Stat blocks ── */
.stat-block {
  padding: var(--space-5) var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  color: var(--color-text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: var(--text-sm); color: var(--color-text-muted); margin-top: var(--space-2); font-weight: var(--weight-medium); }
.stat-trend { font-size: var(--text-xs); color: var(--color-success); margin-top: var(--space-1); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: var(--space-4); opacity: 0.4; }
.empty-state h3 { color: var(--color-text); margin-bottom: var(--space-2); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: var(--space-6); inset-inline-start: 50%;
  transform: translateX(-50%);
  padding: var(--space-4) var(--space-6);
  background: var(--color-text);
  color: var(--color-bg);
  border-radius: 0;
  box-shadow: none;
  z-index: 9999;
  font-size: var(--text-sm); font-weight: var(--weight-medium);
}
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(12px); } }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 20, 25, 0.55);
  backdrop-filter: blur(4px);
  z-index: 9000;
  display: none; align-items: center; justify-content: center;
  padding: var(--space-4);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 440px; width: 100%;
  box-shadow: var(--shadow-xl);
}
.modal-actions { display: flex; gap: var(--space-3); margin-top: var(--space-6); justify-content: flex-end; }

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--color-bg-muted) 25%, var(--color-bg-subtle) 50%, var(--color-bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Page header (panels) ── */
.page-header { margin-bottom: var(--space-8); }
.page-header h1 { margin: 0 0 var(--space-2); }
.page-header p { margin: 0; color: var(--color-text-muted); font-size: var(--text-sm); }
.page-header-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); }

/* ── Section ── */
.section { padding: var(--space-20) 0; }
.section-sm { padding: var(--space-12) 0; }
.section-muted { background: var(--color-bg-muted); }
.section-head { margin-bottom: var(--space-10); max-width: 640px; }
.section-head .eyebrow { margin-bottom: var(--space-3); }
.section-head h2 { margin-top: var(--space-2); }

/* ── Pipeline (admin) ── */
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); }
.pipeline-col {
  background: var(--color-bg-muted);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  min-height: 120px;
}
.pipeline-col-head { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text-muted); margin-bottom: var(--space-3); text-transform: uppercase; }
.pipeline-count { font-size: var(--text-2xl); font-weight: var(--weight-bold); }

/* ── Reading timeline (text-only) ── */
.reading-timeline { border-top: 1px solid var(--color-border); }
.reading-timeline-item {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: var(--space-6);
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--color-border);
}
.reading-timeline-day {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  letter-spacing: var(--letter-spacing-wide);
  padding-top: 0.15rem;
}
.reading-timeline-body h4 { font-size: var(--text-base); font-weight: var(--weight-semibold); margin: 0 0 var(--space-2); }
.reading-timeline-body p { margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); line-height: var(--line-loose); }
.timeline { border-top: 1px solid var(--color-border); }
.timeline-item { display: grid; grid-template-columns: 5rem 1fr; gap: var(--space-6); padding: var(--space-6) 0; border-bottom: 1px solid var(--color-border); }
.timeline-day { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text-muted); letter-spacing: var(--letter-spacing-wide); }

/* ── Editorial sections ── */
.editorial-section { padding: var(--space-20) 0; }
.editorial-section--muted { background: var(--color-bg-muted); }
.editorial-head { margin-bottom: var(--space-10); max-width: var(--reading-width); }
.editorial-head--wide { max-width: 56rem; }
.editorial-body { max-width: var(--reading-width); line-height: var(--line-loose); color: var(--color-text-secondary); }
.editorial-pullquote {
  margin: var(--space-10) 0;
  padding: var(--space-8) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-xl);
  font-weight: var(--weight-medium);
  line-height: var(--line-loose);
  color: var(--color-text);
  max-width: 48rem;
}
.editorial-meta { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: var(--weight-medium); letter-spacing: var(--letter-spacing-wide); }

@media (max-width: 640px) {
  .reading-timeline-item, .timeline-item { grid-template-columns: 1fr; gap: var(--space-2); }
}

/* ── Alert boxes ── */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  border: 1px solid;
}
.alert-warning { background: var(--color-warning-bg); border-color: var(--color-warning); color: var(--color-warning); }
.alert-info { background: var(--color-info-bg); border-color: var(--color-info); color: var(--color-info); }
.alert-success { background: var(--color-success-bg); border-color: var(--color-success); color: var(--color-success); }

/* ── Sticky action bar ── */
.sticky-actions {
  position: sticky; bottom: 0;
  padding: var(--space-4) var(--space-6);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-border);
  display: flex; gap: var(--space-3); justify-content: flex-end;
  z-index: 50;
}

/* ── Mobile bottom CTA ── */
.mobile-booking-bar {
  display: none;
  position: fixed; bottom: 0; inset-inline: 0;
  padding: var(--space-3) var(--space-4);
  background: color-mix(in srgb, var(--color-surface) 95%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--color-border);
  z-index: 200;
  gap: var(--space-3);
  align-items: center;
}
.mobile-booking-bar .price { flex: 1; font-weight: var(--weight-bold); }

@media (max-width: 768px) {
  .mobile-booking-bar.visible { display: flex; }
  body.has-mobile-bar { padding-bottom: 72px; }
}
