/* ===========================================================================
   LUMEO — نظام التصميم
   حقوق النشر محفوظة © شركة رامه الذكية للتجارة — ramh.sa
   ---------------------------------------------------------------------------
   لغة بصرية واحدة تحكم كل واجهات المنتج: أسود عميق مائل للأزرق، ولمسات ذهبية
   دافئة، وأسطح زجاجية بحواف شعرية. الهدف مظهر فاخر هادئ لا يتعب العين على
   شاشة تعمل ١٦ ساعة يومياً.
   ========================================================================= */

/* ------------------------------------------------------------------ الخطوط
   مُضمَّنة محلياً عمداً: سيرفر العميل قد يعمل بلا إنترنت، والخط من CDN خارجي
   يعني واجهة بلا هوية عند أول انقطاع. */
@font-face {
  font-family: 'Plex Arabic'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/plex-ar-arabic-400.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E;
}
@font-face {
  font-family: 'Plex Arabic'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/fonts/plex-ar-arabic-500.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E;
}
@font-face {
  font-family: 'Plex Arabic'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/plex-ar-arabic-600.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E;
}
@font-face {
  font-family: 'Plex Arabic'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/fonts/plex-ar-arabic-700.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E;
}
@font-face {
  font-family: 'Plex Arabic'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/plex-ar-latin-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Plex Arabic'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/fonts/plex-ar-latin-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Plex Arabic'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/plex-ar-latin-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Plex Arabic'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/fonts/plex-ar-latin-700.woff2') format('woff2');
}

/* ------------------------------------------------------------------ الرموز */
:root {
  color-scheme: dark;

  /* الأسطح — تدرّج من العمق إلى الأعلى، كل مستوى أفتح قليلاً */
  --ink-000: #05070D;   /* خلفية الصفحة */
  --ink-050: #080B14;
  --ink-100: #0C1120;   /* بطاقة */
  --ink-200: #121829;   /* بطاقة مرفوعة */
  --ink-300: #1A2238;   /* حقل إدخال */
  --ink-400: #242E48;   /* حدّ بارز */

  /* الحدود الشعرية */
  --line:        rgba(201, 162, 39, .10);
  --line-strong: rgba(201, 162, 39, .22);
  --line-cool:   rgba(148, 170, 214, .12);

  /* النص */
  --text:  #EEF2FA;
  --text-2:#B4C0D8;
  --muted: #7789A6;
  --faint: #4A5872;

  /* الذهب — هوية LUMEO */
  --gold:      #C9A227;
  --gold-lift: #E4C77A;
  --gold-deep: #8C6E14;
  --gold-wash: rgba(201, 162, 39, .12);

  /* دلالات */
  --ok:    #34D399;
  --warn:  #F5B84B;
  --danger:#F2584F;
  --info:  #6AA6F5;
  --ok-wash:     rgba(52, 211, 153, .12);
  --warn-wash:   rgba(245, 184, 75, .12);
  --danger-wash: rgba(242, 88, 79, .12);
  --info-wash:   rgba(106, 166, 245, .12);

  /* الشكل */
  --r-sm: 10px;
  --r:    16px;
  --r-lg: 22px;
  --r-xl: 30px;

  /* الظلال — عميقة وناعمة، لا حادّة */
  --shadow-1: 0 2px 10px rgba(0,0,0,.35);
  --shadow-2: 0 16px 44px -18px rgba(0,0,0,.85);
  --shadow-3: 0 34px 90px -30px rgba(0,0,0,.95);
  --glow:     0 0 0 1px var(--line-strong), 0 22px 60px -30px rgba(201,162,39,.55);

  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --font: 'Plex Arabic', ui-sans-serif, system-ui, 'Segoe UI', Tahoma, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;
}

/* ------------------------------------------------------------------- الأساس */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--ink-000);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01', 'kern';
}

/* هالتان دافئتان خلف كل الصفحات — العمق الذي يعطي الإحساس الفاخر */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(90rem 50rem at 78% -12%, rgba(201,162,39,.10), transparent 62%),
    radial-gradient(70rem 44rem at 8% 108%,  rgba(74,110,190,.10), transparent 60%);
}

img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold-lift); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: rgba(201,162,39,.30); color: #fff; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

/* شريط التمرير — جزء من الهوية لا عنصر نظام غريب */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ink-400);
  border-radius: 99px;
  border: 3px solid var(--ink-000);
}
::-webkit-scrollbar-thumb:hover { background: #33405f; }

/* ------------------------------------------------------------------ الطباعة */
.h1 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 700; letter-spacing: -.02em; line-height: 1.22; }
.h2 { font-size: clamp(20px, 2.2vw, 25px); font-weight: 700; letter-spacing: -.015em; line-height: 1.3; }
.h3 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.lead { font-size: 16px; color: var(--text-2); line-height: 1.8; }
.small { font-size: 13px; }
.tiny  { font-size: 11.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono  { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.nums  { font-variant-numeric: tabular-nums; }

/* عنوان قسم بحرف مُتباعد — توقيع بصري متكرّر عبر الواجهات */
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .18em;
  color: var(--gold); text-transform: uppercase;
}

/* --------------------------------------------------------------- التخطيط */
.stack   { display: flex; flex-direction: column; gap: 14px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.stack-l { display: flex; flex-direction: column; gap: 26px; }
.row     { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.grow    { flex: 1 1 auto; min-width: 0; }
.center  { display: grid; place-items: center; }
.wrap    { width: min(1240px, 100% - 40px); margin-inline: auto; }
.wrap-narrow { width: min(640px, 100% - 32px); margin-inline: auto; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* --------------------------------------------------------------- البطاقات */
.card {
  background: linear-gradient(168deg, var(--ink-100), var(--ink-050));
  border: 1px solid var(--line-cool);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-2);
  position: relative;
}

/* خيط ضوء علوي — التفصيلة التي تجعل السطح يبدو مصقولاً */
.card::before {
  content: '';
  position: absolute; inset-inline: 22px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,162,39,.34), transparent);
  pointer-events: none;
}

.card-gold { border-color: var(--line-strong); box-shadow: var(--glow); }
.card-flat { box-shadow: none; background: var(--ink-050); }
.card-pad-s { padding: 16px; }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line-cool);
}

.divider { height: 1px; background: var(--line-cool); border: 0; margin: 18px 0; }

/* ---------------------------------------------------------------- الأزرار */
.btn {
  --btn-bg: var(--ink-300);
  --btn-fg: var(--text);
  --btn-line: var(--line-cool);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .16s var(--ease), box-shadow .2s var(--ease),
              background .2s var(--ease), border-color .2s var(--ease), opacity .2s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--line-strong); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .42; cursor: not-allowed; }

.btn-primary {
  --btn-bg: linear-gradient(160deg, var(--gold-lift), var(--gold));
  --btn-fg: #16120A;
  --btn-line: transparent;
  font-weight: 700;
  box-shadow: 0 14px 34px -18px rgba(201,162,39,.9);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 20px 44px -18px rgba(201,162,39,1); }

.btn-ghost { --btn-bg: transparent; --btn-line: var(--line-cool); }
.btn-ghost:hover:not(:disabled) { --btn-bg: rgba(255,255,255,.035); }

.btn-danger { --btn-bg: var(--danger-wash); --btn-fg: #FFB9B3; --btn-line: rgba(242,88,79,.32); }
.btn-danger:hover:not(:disabled) { --btn-bg: rgba(242,88,79,.2); }

.btn-sm { padding: 7px 13px; font-size: 12.5px; border-radius: 10px; }
.btn-lg { padding: 14px 28px; font-size: 15.5px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; width: 38px; height: 38px; border-radius: 11px; }

/* مؤشّر انشغال داخل الزر — بديل عن تجميد الواجهة */
.btn[data-busy='1'] { pointer-events: none; opacity: .75; }
.btn[data-busy='1']::after {
  content: ''; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- الحقول */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.hint  { font-size: 12px; color: var(--muted); line-height: 1.7; }

.input, .select, .textarea {
  width: 100%;
  background: var(--ink-300);
  border: 1px solid var(--line-cool);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14.5px;
  color: var(--text);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-wash);
  background: var(--ink-200);
}
.input:disabled, .select:disabled { opacity: .55; cursor: not-allowed; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.7; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237789A6' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-inline-start: 14px;
  padding-inline-end: 38px;
}

.input-lg { padding: 15px 18px; font-size: 17px; border-radius: 14px; }

/* مفتاح تبديل */
.switch { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 46px; height: 26px; border-radius: 99px; flex: none;
  background: var(--ink-400);
  border: 1px solid var(--line-cool);
  position: relative;
  transition: background .22s var(--ease), border-color .22s var(--ease);
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; inset-inline-start: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #8FA0BE;
  transition: transform .24s var(--ease-out), background .22s var(--ease);
}
.switch input:checked + .track { background: var(--gold); border-color: var(--gold); }
.switch input:checked + .track::after { background: #16120A; transform: translateX(-20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--gold-wash); }
.switch .switch-label { font-size: 14px; font-weight: 500; }

/* مجموعة أزرار اختيار — بديل أنيق عن قوائم الاختيار الصغيرة */
.segment {
  display: inline-flex; padding: 4px; gap: 3px;
  background: var(--ink-050);
  border: 1px solid var(--line-cool);
  border-radius: 13px;
  flex-wrap: wrap;
}
.segment button {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 15px; border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.segment button:hover { color: var(--text-2); }
.segment button[aria-pressed='true'] {
  background: var(--gold-wash);
  color: var(--gold-lift);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* ---------------------------------------------------------------- الشارات */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  border: 1px solid var(--line-cool);
  background: var(--ink-200);
  color: var(--text-2);
  white-space: nowrap;
}
.badge-gold   { background: var(--gold-wash);   border-color: var(--line-strong);        color: var(--gold-lift); }
.badge-ok     { background: var(--ok-wash);     border-color: rgba(52,211,153,.3);       color: #6EE7B7; }
.badge-warn   { background: var(--warn-wash);   border-color: rgba(245,184,75,.3);       color: #FBCF7E; }
.badge-danger { background: var(--danger-wash); border-color: rgba(242,88,79,.3);        color: #FFA79F; }
.badge-info   { background: var(--info-wash);   border-color: rgba(106,166,245,.3);      color: #A5C8FA; }

/* نقطة حالة نابضة */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot-ok     { background: var(--ok);     box-shadow: 0 0 0 3px var(--ok-wash); }
.dot-warn   { background: var(--warn);   box-shadow: 0 0 0 3px var(--warn-wash); }
.dot-danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-wash); }
.dot-live   { animation: livePulse 2.4s var(--ease) infinite; }
@keyframes livePulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* --------------------------------------------------------------- التنبيهات */
.notice {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 15px 17px;
  border-radius: var(--r);
  border: 1px solid var(--line-cool);
  background: var(--ink-100);
  font-size: 13.5px; line-height: 1.75;
}
.notice .notice-icon { flex: none; font-size: 17px; line-height: 1.4; }
.notice-ok     { background: var(--ok-wash);     border-color: rgba(52,211,153,.28); }
.notice-warn   { background: var(--warn-wash);   border-color: rgba(245,184,75,.28); }
.notice-danger { background: var(--danger-wash); border-color: rgba(242,88,79,.28); }
.notice-info   { background: var(--info-wash);   border-color: rgba(106,166,245,.28); }
.notice b { color: var(--text); }

/* --------------------------------------------------------------- الشعار */
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--gold-lift), var(--gold-deep));
  color: #14100A; font-weight: 800; font-size: 19px;
  box-shadow: 0 10px 26px -12px rgba(201,162,39,.85);
}
.brand-name {
  font-size: 20px; font-weight: 700; letter-spacing: .13em;
  background: linear-gradient(100deg, #FFF3D0, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .05em; }

/* --------------------------------------------------------------- الحركات */
.rise { animation: rise .5s var(--ease-out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.fade { animation: fadeIn .4s var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* هيكل تحميل بدل الشاشة الفارغة */
.skeleton {
  background: linear-gradient(100deg, var(--ink-200) 30%, var(--ink-300) 50%, var(--ink-200) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* ------------------------------------------------------------- المساعدات */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.scroll-x { overflow-x: auto; overscroll-behavior-x: contain; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------- التذييل */
.legal-footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--faint);
  line-height: 2;
  padding: 26px 0 18px;
}
.legal-footer a { color: var(--muted); }
.legal-footer strong { color: var(--muted); font-weight: 600; }

/* ------------------------------------------------ احترام تفضيلات المستخدم */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
