/* ═══════════════════════════════════════════════════════════════
   BE-IT Design System — Shopify Admin Style
   Light Mode (default) + Dark Mode
   ═══════════════════════════════════════════════════════════════ */

/* ── Google Fonts via @import fallback ──────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Cairo:wght@300;400;500;600;700&display=swap');

/* ── Light Mode Tokens ─────────────────────── */
:root {
  /* Background */
  --bg-primary:       #f6f6f7;
  --bg-surface:       #ffffff;
  --bg-surface-hover: #f1f2f3;
  --bg-overlay:       rgba(0,0,0,.5);

  /* Borders */
  --border-default:   #e1e3e5;
  --border-focus:     #005bd3;
  --border-subdued:   #c9cccf;

  /* Text */
  --text-primary:     #202223;
  --text-secondary:   #6d7175;
  --text-disabled:    #8c9196;
  --text-inverse:     #ffffff;
  --text-link:        #005bd3;

  /* Brand / Action */
  --action-primary:        #404040;
  --action-primary-hover:  #2a2a2a;
  --action-primary-text:   #ffffff;
  --action-secondary:      #ffffff;
  --action-secondary-hover:#f1f2f3;
  --action-secondary-text: #202223;

  /* Interactive blue */
  --interactive:       #005bd3;
  --interactive-hover: #004bb4;
  --interactive-light: #e8f0fd;

  /* Status */
  --success:     #007f5f;
  --success-bg:  #e3f1ec;
  --warning:     #916a00;
  --warning-bg:  #fff5cc;
  --critical:    #d72c0d;
  --critical-bg: #fce4e4;
  --info:        #005bd3;
  --info-bg:     #e8f0fd;

  /* Highlight / Nav */
  --nav-bg:      #1a1a1a;
  --nav-text:    #ffffffb3;
  --nav-active:  #ffffff;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(26,26,26,.08);
  --shadow-sm:  0 2px 4px rgba(26,26,26,.1);
  --shadow-md:  0 4px 12px rgba(26,26,26,.12);
  --shadow-lg:  0 8px 24px rgba(26,26,26,.14);

  /* Radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-full:9999px;

  /* Spacing */
  --space-1:  4px;  --space-2:  8px;  --space-3: 12px;
  --space-4: 16px;  --space-5: 20px;  --space-6: 24px;
  --space-8: 32px;  --space-10:40px;  --space-12:48px;
  --space-16:64px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-arabic: 'Cairo', 'Segoe UI', sans-serif;
  --text-xs:   11px; --text-sm: 13px; --text-base:14px;
  --text-md:   16px; --text-lg: 20px; --text-xl:  24px;
  --text-2xl:  28px; --text-3xl:32px;
  --leading-tight: 1.25; --leading-base: 1.5; --leading-loose: 1.75;

  /* Transitions */
  --transition-fast: 100ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ── Dark Mode Tokens ──────────────────────── */
[data-theme="dark"] {
  --bg-primary:       #111213;
  --bg-surface:       #1a1a1a;
  --bg-surface-hover: #232526;
  --border-default:   #333537;
  --border-focus:     #70abff;
  --border-subdued:   #404346;
  --text-primary:     #e3e3e3;
  --text-secondary:   #9ba1a6;
  --text-disabled:    #5c6166;
  --text-inverse:     #1a1a1a;
  --text-link:        #70abff;
  --action-primary:        #e3e3e3;
  --action-primary-hover:  #c9c9c9;
  --action-primary-text:   #1a1a1a;
  --action-secondary:      #2a2a2a;
  --action-secondary-hover:#333537;
  --action-secondary-text: #e3e3e3;
  --interactive:       #70abff;
  --interactive-hover: #5a95f5;
  --interactive-light: #1c2a3d;
  --success:    #3ab78f;
  --success-bg: #0d2b22;
  --warning:    #ffd66e;
  --warning-bg: #2b2200;
  --critical:   #ff6b6b;
  --critical-bg:#2b0d0d;
  --info:        #70abff;
  --info-bg:     #1c2a3d;
  --shadow-xs:  0 1px 2px rgba(0,0,0,.3);
  --shadow-sm:  0 2px 4px rgba(0,0,0,.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.6);
}

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: var(--leading-base);
  transition: background var(--transition-slow), color var(--transition-slow);
}
.rtl body, body.rtl { font-family: var(--font-arabic); }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Navigation ─────────────────────────────── */
.site-nav {
  background: var(--nav-bg);
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 0 rgba(255,255,255,.08);
}
.nav-container {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--nav-active);
  font-weight: 600;
  font-size: var(--text-md);
  text-decoration: none;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.nav-link {
  color: var(--nav-text);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.nav-link:hover { color: var(--nav-active); background: rgba(255,255,255,.08); text-decoration: none; }
.nav-link--logout { color: #ff8f8f; }
.lang-toggle, .theme-toggle {
  background: rgba(255,255,255,.1);
  border: none;
  color: var(--nav-text);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  display: flex;
  align-items: center;
}
.lang-toggle:hover, .theme-toggle:hover { background: rgba(255,255,255,.18); color: #fff; }

/* ── Layout ─────────────────────────────────── */
.site-main { min-height: calc(100vh - 56px - 64px); }
.page-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}
.page-header {
  margin-bottom: var(--space-6);
}
.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: var(--leading-tight);
}
.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ── Cards ──────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow var(--transition-base);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-default);
}
.card-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
}
.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}
.card-body { padding: var(--space-6); }
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-default);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--action-primary);
  color: var(--action-primary-text);
  border-color: transparent;
}
.btn-primary:hover:not(:disabled) {
  background: var(--action-primary-hover);
  text-decoration: none;
}
.btn-secondary {
  background: var(--action-secondary);
  color: var(--action-secondary-text);
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--action-secondary-hover);
  text-decoration: none;
}
.btn-interactive {
  background: var(--interactive);
  color: #fff;
  border-color: transparent;
}
.btn-interactive:hover:not(:disabled) { background: var(--interactive-hover); text-decoration: none; }
.btn-critical { background: var(--critical); color: #fff; border-color: transparent; }
.btn-sm { padding: 6px 12px; font-size: var(--text-xs); }
.btn-lg { padding: 12px 24px; font-size: var(--text-md); }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; min-width: 36px; }
.btn .spinner { animation: spin .6s linear infinite; }

/* ── Form Elements ──────────────────────────── */
.form-group { margin-bottom: var(--space-5); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.form-label .required { color: var(--critical); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  line-height: 1.5;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-disabled); }
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: var(--border-subdued); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0,91,211,.12);
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236d7175' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
}
.rtl .form-select { background-position: left 10px center; padding-right: 12px; padding-left: 36px; }
.form-textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: var(--text-xs); color: var(--text-secondary); margin-top: var(--space-1); }
.form-error { font-size: var(--text-xs); color: var(--critical); margin-top: var(--space-1); }
.form-input.error, .form-select.error, .form-textarea.error { border-color: var(--critical); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ── Range Slider ───────────────────────────── */
.form-range {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border-default);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}
.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--interactive);
  border: 2px solid var(--bg-surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

/* ── Badges ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}
.badge-success  { background: var(--success-bg);  color: var(--success);  }
.badge-warning  { background: var(--warning-bg);  color: var(--warning);  }
.badge-critical { background: var(--critical-bg); color: var(--critical); }
.badge-info     { background: var(--info-bg);     color: var(--info);     }
.badge-neutral  { background: var(--bg-surface-hover); color: var(--text-secondary); }

/* ── Banner / Alert ─────────────────────────── */
.banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
}
.banner-success  { background: var(--success-bg);  color: var(--success);  border-left: 3px solid var(--success); }
.banner-critical { background: var(--critical-bg); color: var(--critical); border-left: 3px solid var(--critical); }
.banner-warning  { background: var(--warning-bg);  color: var(--warning);  border-left: 3px solid var(--warning); }
.banner-info     { background: var(--info-bg);     color: var(--info);     border-left: 3px solid var(--info); }
.rtl .banner { border-left: none; border-right: 3px solid; }

/* ── Divider ─────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-5) 0;
}
.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  margin: var(--space-5) 0;
}
.divider-text::before, .divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-default);
}

/* ── Table ──────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
thead { background: var(--bg-primary); }
th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border-default);
}
td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  color: var(--text-primary);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-surface-hover); }
.rtl th, .rtl td { text-align: right; }

/* ── Progress ────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-default);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--interactive);
  border-radius: var(--radius-full);
  transition: width .4s ease;
}

/* ── Skeleton Loader ─────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface-hover) 25%, var(--border-default) 50%, var(--bg-surface-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ── Spinner ─────────────────────────────────── */
.spinner-overlay {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .7s linear infinite; }

/* ── Auth Pages ──────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: var(--space-6);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}
.auth-logo span { font-size: var(--text-xl); font-weight: 700; color: var(--text-primary); }
.auth-title { font-size: var(--text-xl); font-weight: 700; text-align: center; margin-bottom: var(--space-2); }
.auth-subtitle { font-size: var(--text-sm); color: var(--text-secondary); text-align: center; margin-bottom: var(--space-8); }
.auth-footer { margin-top: var(--space-6); text-align: center; font-size: var(--text-sm); color: var(--text-secondary); }
.auth-footer a { color: var(--text-link); font-weight: 500; }

/* ── Footer ──────────────────────────────────── */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  height: 64px;
  display: flex;
  align-items: center;
}
.footer-container {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; color: var(--text-primary); }
.footer-copy { font-size: var(--text-xs); color: var(--text-secondary); }

/* ── Utilities ──────────────────────────────── */
.text-xs     { font-size: var(--text-xs); }
.text-sm     { font-size: var(--text-sm); }
.text-base   { font-size: var(--text-base); }
.text-md     { font-size: var(--text-md); }
.text-lg     { font-size: var(--text-lg); }
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-success   { color: var(--success); }
.text-critical  { color: var(--critical); }
.text-link      { color: var(--text-link); }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.hidden { display: none !important; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }

/* ── MBP Tool Step Indicator ─────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--space-8);
  overflow-x: auto;
  padding-bottom: var(--space-2);
}
.step-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  border: 2px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: all var(--transition-base);
}
.step-dot.active  { border-color: var(--interactive); background: var(--interactive); color: #fff; }
.step-dot.done    { border-color: var(--success); background: var(--success); color: #fff; }
.step-label { font-size: var(--text-xs); font-weight: 500; color: var(--text-secondary); white-space: nowrap; }
.step-label.active { color: var(--interactive); }
.step-label.done   { color: var(--success); }
.step-connector { width: 32px; height: 2px; background: var(--border-default); flex-shrink: 0; }
.step-connector.done { background: var(--success); }

/* ── Plan Output Styles ───────────────────────── */
.plan-output {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  line-height: var(--leading-loose);
}
.plan-output h1 { font-size: var(--text-2xl); font-weight: 700; margin-bottom: var(--space-6); color: var(--text-primary); }
.plan-output h2 { font-size: var(--text-lg); font-weight: 700; margin: var(--space-8) 0 var(--space-4); color: var(--text-primary); padding-bottom: var(--space-2); border-bottom: 2px solid var(--interactive); display: inline-block; }
.plan-output h3 { font-size: var(--text-md); font-weight: 600; margin: var(--space-5) 0 var(--space-2); color: var(--text-primary); }
.plan-output p  { margin-bottom: var(--space-3); color: var(--text-primary); }
.plan-output ul, .plan-output ol { padding-left: var(--space-6); margin-bottom: var(--space-3); }
.rtl .plan-output ul, .rtl .plan-output ol { padding-left: 0; padding-right: var(--space-6); }
.plan-output li { margin-bottom: var(--space-1); color: var(--text-primary); }
.plan-output table { width: 100%; margin: var(--space-4) 0; }
.plan-output strong { color: var(--text-primary); }
.plan-output .highlight-box {
  background: var(--interactive-light);
  border-left: 3px solid var(--interactive);
  padding: var(--space-4) var(--space-5);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: var(--space-4) 0;
}
.rtl .plan-output .highlight-box { border-left: none; border-right: 3px solid var(--interactive); border-radius: var(--radius-md) 0 0 var(--radius-md); }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
  .page-wrapper { padding: var(--space-5) var(--space-4); }
  .auth-card    { padding: var(--space-8) var(--space-6); }
  .nav-container { padding: 0 var(--space-4); }
  .page-title   { font-size: var(--text-xl); }
}
