/* ==========================================================================
   gs-ui.css — واجهات عصرية موحّدة (غيرلي شوب)
   1) حقول اختيار اللون (مظهر المربع الملوّن)
   2) منتقي الألوان العصري المستوحى من cssgradient.io
   3) نافذة الحفظ (جارٍ الحفظ / تم الحفظ / تعذّر الحفظ)
   4) تحسين نوافذ AlertDialog الجاهزة لتطابق تصميم الموقع
   الخط: يُؤخذ تلقائياً من خط الموقع الفعلي (font-family لـ body)
   ========================================================================== */

/* إخفاء إشعارات sonner الخاصة بعملية حفظ تُعرض بدلاً عنها نافذة الحفظ */
[data-gsx-hide] { display: none !important; }

/* ---------- 1) مظهر حقل اللون ---------- */
input[type="color"] {
  -webkit-appearance: none; appearance: none;
  padding: 3px !important; cursor: pointer;
  border-radius: 12px; background: #fff;
  border: 1px solid rgba(124, 58, 237, .28);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
  transition: box-shadow .18s ease, transform .18s ease;
}
input[type="color"]:hover { box-shadow: 0 4px 14px rgba(124, 58, 237, .22); transform: translateY(-1px); }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 9px; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 9px; }

/* ---------- 2) منتقي الألوان ---------- */
.gsx-cp-backdrop {
  position: fixed; inset: 0; z-index: 10000001;
  pointer-events: auto !important;
  background: transparent;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.gsx-cp-backdrop.gsx-sheet { background: rgba(15, 23, 42, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: gsModalFadeIn .2s ease forwards; }
.gsx-cp {
  position: fixed; z-index: 10000002; width: 316px; max-width: calc(100vw - 16px);
  box-sizing: border-box; padding: 14px; direction: rtl; text-align: start;
  background: #fff; color: #0f172a; border-radius: 22px;
  border: 1px solid rgba(124, 58, 237, .14);
  box-shadow: 0 30px 70px -18px rgba(76, 29, 149, .45), 0 4px 14px rgba(15, 23, 42, .10);
  animation: gsxCpIn .22s cubic-bezier(.16, 1, .3, 1) both;
  pointer-events: auto !important;
  max-height: calc(100vh - 16px); overflow-y: auto; overscroll-behavior: contain;
}
.gsx-cp *, .gsx-cp *::before, .gsx-cp *::after { box-sizing: border-box; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.gsx-cp input { -webkit-user-select: text; user-select: text; }
@keyframes gsxCpIn { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes gsxSheetIn { from { transform: translateY(100%); } to { transform: none; } }
.gsx-cp.gsx-sheet-box {
  left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important;
  width: 100%; max-width: none; border-radius: 26px 26px 0 0;
  max-height: 92vh; overflow-y: auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  animation: gsxSheetIn .28s cubic-bezier(.16, 1, .3, 1) both;
}
.gsx-cp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.gsx-cp-title { margin: 0; font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.gsx-cp-title i { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, #7c3aed, #ec4899); display: inline-block; }
.gsx-cp-x {
  width: 30px; height: 30px; border: 0; border-radius: 50%; background: #f1f5f9; color: #64748b;
  font-size: 18px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, transform .2s;
}
.gsx-cp-x:hover { background: #e2e8f0; transform: rotate(90deg); }

/* مساحة التشبّع/السطوع */
.gsx-sv {
  position: relative; width: 100%; height: 168px; border-radius: 16px; cursor: crosshair; touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12);
  background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0)), linear-gradient(to right, #fff, rgba(255, 255, 255, 0));
}
.gsx-thumb {
  position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 3px 8px rgba(0, 0, 0, .35);
  pointer-events: none; transition: transform .12s ease;
}
.gsx-dragging .gsx-thumb { transform: scale(1.18); }

/* الشرائح (درجة اللون) */
.gsx-rail { position: relative; height: 14px; margin: 14px 0 4px; border-radius: 99px; cursor: pointer; touch-action: none; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .1); }
.gsx-hue { background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%); }
.gsx-rail .gsx-thumb { top: 50%; width: 22px; height: 22px; }

/* المعاينة + أدوات */
.gsx-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.gsx-preview { flex: none; width: 52px; height: 40px; border-radius: 12px; overflow: hidden; display: flex; box-shadow: 0 0 0 1px rgba(15, 23, 42, .14); }
.gsx-preview b { flex: 1; display: block; }
.gsx-tabs { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; border-radius: 12px; background: #f1f5f9; }
.gsx-tab { height: 32px; border: 0; border-radius: 9px; background: transparent; color: #64748b; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; letter-spacing: .4px; transition: all .15s; }
.gsx-tab.on { background: #fff; color: #6d28d9; box-shadow: 0 1px 4px rgba(15, 23, 42, .14); }
.gsx-eye { flex: none; width: 40px; height: 40px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; color: #475569; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all .15s; }
.gsx-eye:hover { border-color: #a78bfa; color: #6d28d9; }
.gsx-fields { display: grid; gap: 8px; margin-top: 10px; }
.gsx-fields.c1 { grid-template-columns: 1fr; }
.gsx-fields.c3 { grid-template-columns: repeat(3, 1fr); }
.gsx-f { display: flex; flex-direction: column; gap: 4px; }
.gsx-f label { font-size: 10px; font-weight: 800; color: #94a3b8; text-align: center; letter-spacing: .6px; }
.gsx-f input {
  width: 100%; height: 38px; padding: 0 8px; border: 1.5px solid #e2e8f0; border-radius: 11px; background: #fff; color: #0f172a;
  font: inherit; font-size: 13px; font-weight: 700; text-align: center; direction: ltr; outline: none; transition: border-color .15s, box-shadow .15s;
}
.gsx-f input:focus { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139, 92, 246, .18); }
.gsx-f input.bad { border-color: #f43f5e; box-shadow: 0 0 0 3px rgba(244, 63, 94, .15); }
.gsx-sec { margin: 14px 0 6px; font-size: 11px; font-weight: 800; color: #94a3b8; }
.gsx-sw { display: grid; grid-template-columns: repeat(9, 1fr); gap: 7px; }
.gsx-sw button { aspect-ratio: 1; width: 100%; border-radius: 9px; border: 0; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .16); transition: transform .12s ease; }
.gsx-sw button:hover { transform: scale(1.14); }
.gsx-sw button.on { box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .16), 0 0 0 2px #fff, 0 0 0 4px #7c3aed; }
.gsx-foot { display: flex; gap: 10px; margin-top: 16px; }
.gsx-btn { flex: 1; height: 42px; border: 0; border-radius: 13px; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; transition: transform .15s, box-shadow .15s; -webkit-user-select: none; user-select: none; }
.gsx-btn:hover { transform: translateY(-1px); }
.gsx-btn.ghost { background: #f8fafc; color: #475569; border: 1px solid #cbd5e1; }
.gsx-btn.main { background: linear-gradient(135deg, #7c3aed 0%, #9333ea 50%, #c026d3 100%); color: #fff; box-shadow: 0 6px 16px rgba(124, 58, 237, .35); }

html.dark .gsx-cp { background: #1b1740; color: #f8fafc; border-color: rgba(139, 92, 246, .3); }
html.dark .gsx-cp-x, html.dark .gsx-tabs { background: #2a2566; color: #cbd5e1; }
html.dark .gsx-tab.on { background: #3b3590; color: #fff; }
html.dark .gsx-f input, html.dark .gsx-eye { background: #14113a; color: #f8fafc; border-color: #3b3590; }
html.dark .gsx-btn.ghost { background: #2a2566; color: #e2e8f0; border-color: #4338ca; }

/* ---------- 3) نافذة الحفظ ---------- */
.gsx-save-ring {
  width: 34px; height: 34px; border-radius: 50%;
  border: 4px solid rgba(124, 58, 237, .18); border-top-color: #7c3aed;
  animation: gsxSpin .8s linear infinite;
}
@keyframes gsxSpin { to { transform: rotate(360deg); } }
.gsx-svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.gsx-svg path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: gsxDraw .5s .12s ease forwards; }
@keyframes gsxDraw { to { stroke-dashoffset: 0; } }
.gsx-autobar { position: absolute; inset: auto 0 0 0; height: 4px; background: linear-gradient(90deg, #16a34a, #22c55e); transform-origin: right; animation: gsxBar var(--gsx-ms, 2200ms) linear forwards; }
@keyframes gsxBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- 4) AlertDialog الجاهزة: نفس مظهر نوافذ الموقع ---------- */
html body [role="alertdialog"] {
  border-radius: 28px !important; padding: 30px 24px 22px !important; max-width: 420px !important;
  border: 1px solid rgba(124, 58, 237, .12) !important;
  box-shadow: 0 30px 80px -20px rgba(76, 29, 149, .45) !important;
  text-align: center; font-family: inherit; overflow: hidden;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
html body [role="alertdialog"] > div:first-child { text-align: center !important; }
html body [role="alertdialog"] h2 { font-size: 19px; font-weight: 800; }
html body [role="alertdialog"] [class*="sm:justify-end"] { justify-content: center !important; gap: 12px; flex-direction: row-reverse !important; }
html body [role="alertdialog"] [class*="sm:justify-end"] > * { flex: 1; margin: 0 !important; height: 46px; border-radius: 14px !important; font-weight: 800; }
html body [role="alertdialog"] button.bg-destructive,
html body [role="alertdialog"] [class*="bg-destructive"] {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important; color: #fff !important; border: 0 !important;
  box-shadow: 0 6px 16px rgba(225, 29, 72, .35) !important;
}

/* ==========================================================================
   GS stable-render: منع الوميض
   ========================================================================== */
/* أثناء الإقلاع تبقى الصفحة مخفية حتى تجهز الإعدادات والألوان (تُرفع الفئة من index.html) */
html.gs-boot #root { opacity: 0 !important; }
html:not(.gs-boot) #root { opacity: 1; }
/* القائمة الجانبية: لا انتقال تدريجي في الألوان/الخلفيات (يسبب نصاً أبيض ثم أسود) — الحركة تبقى للانزلاق فقط */
[role="dialog"][class*="w-[300px]"],
[role="dialog"][class*="w-[300px]"] *,
[role="dialog"][class*="w-[280px]"],
[role="dialog"][class*="w-[280px]"] * {
  transition-property: transform, opacity !important;
}
/* الشريط السفلي والشريط العلوي: لا انتقال لون عند أول ظهور */
.gs-dock, .gs-dock-in { transition-property: transform !important; }
header, header * { transition-property: transform, opacity, box-shadow !important; }

/* ===== GS-DESKTOP: استغلال عرض الشاشات الكبيرة (الصفحة الرئيسية) + أزرار تمرير الفئات ===== */
@media (min-width: 1100px) {
  html.gs-home .max-w-5xl,
  html.gs-home .max-w-4xl,
  html.gs-home:not(.dark) main.max-w-5xl,
  html.gs-home main.max-w-5xl { max-width: min(1480px, 94vw); }
  html.gs-home main .grid[class*="lg:grid-cols-"] { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
.gs-hs-btn {
  position: fixed; z-index: 30; width: 38px; height: 38px; border-radius: 50%;
  border: 0; padding: 0; cursor: pointer; display: none; align-items: center; justify-content: center;
  background: #fff; color: #6d3fd9; box-shadow: 0 4px 14px rgba(60, 30, 140, .28);
  transition: opacity .15s, transform .15s;
}
.gs-hs-btn:hover { transform: scale(1.08); background: #f6f1ff; }
.gs-hs-btn:active { transform: scale(.95); }
.gs-hs-btn svg { width: 20px; height: 20px; pointer-events: none; }

/* اللوغو المائي داخل نافذة "جارٍ الحفظ" */
.gs-modal-icon-badge .gs-ll-box { --s: 52px; }

/* تبديل الوضع الليلي/النهاري: تغيير فوري بدون انتقال تدريجي للألوان */
html.theme-instant,
html.theme-instant *,
html.theme-instant *::before,
html.theme-instant *::after {
  transition: none !important;
}

/* ===== GS-FIELDS: وضوح خانات الإدخال (الاسم/الهاتف/الولاية/البلدية/العنوان...) داخل البطاقات =====
   المشكلة: الخانة كانت بنفس لون الخلفية تقريباً فلا تظهر.
   الحل: لون الخانة مشتق من لون النص (foreground) ممزوجاً مع لون البطاقة، فيعمل في الوضعين
   وحتى مع ألوان المتاجر المخصصة. حدود أوضح + نفس حدود التحقق (أخضر/أحمر) تبقى كما هي. */
html:not(#gs-x) {
  --gs-field-bg: #f1eef8;          /* نهاري: رمادي بنفسجي فاتح */
  --gs-field-bd: #cfc6e2;
}
html.dark:not(#gs-x) {
  --gs-field-bg: #241d3d;          /* ليلي: أفتح قليلاً من البطاقة */
  --gs-field-bd: #4a3f78;
}
@supports (background: color-mix(in srgb, red, blue)) {
  html:not(#gs-x) {
    --gs-field-bg: color-mix(in srgb, hsl(var(--foreground)) 6%, hsl(var(--card)));
    --gs-field-bd: color-mix(in srgb, hsl(var(--foreground)) 24%, hsl(var(--card)));
  }
  html.dark:not(#gs-x) {
    --gs-field-bg: color-mix(in srgb, hsl(var(--foreground)) 10%, hsl(var(--card)));
    --gs-field-bd: color-mix(in srgb, hsl(var(--foreground)) 26%, hsl(var(--card)));
  }
}
html:not(#gs-x) .bg-card:not(header *) input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]),
html:not(#gs-x) .bg-card:not(header *) textarea,
html:not(#gs-x) .bg-card:not(header *) button[role="combobox"],
html:not(#gs-x) [role="dialog"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]),
html:not(#gs-x) [role="dialog"] textarea,
html:not(#gs-x) [role="dialog"] button[role="combobox"] {
  background-color: var(--gs-field-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
/* الحدود: لا نلمس حالات التحقق (أخضر/أحمر) ولا حالة التركيز */
html:not(#gs-x) .bg-card:not(header *) input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]):not(:focus):not([class*="border-green"]):not([class*="border-destructive"]),
html:not(#gs-x) .bg-card:not(header *) textarea:not(:focus):not([class*="border-green"]):not([class*="border-destructive"]),
html:not(#gs-x) .bg-card:not(header *) button[role="combobox"]:not(:focus):not([class*="border-green"]):not([class*="border-destructive"]),
html:not(#gs-x) [role="dialog"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]):not(:focus):not([class*="border-green"]):not([class*="border-destructive"]),
html:not(#gs-x) [role="dialog"] textarea:not(:focus):not([class*="border-green"]):not([class*="border-destructive"]),
html:not(#gs-x) [role="dialog"] button[role="combobox"]:not(:focus):not([class*="border-green"]):not([class*="border-destructive"]) {
  border-color: var(--gs-field-bd);
}

/* ===== GS-SWITCH: مفاتيح ON/OFF — الحالة المفعّلة تبقى بلونها، والمعطّلة حمراء ===== */
html:not(#gs-x) .gs-sw:not([data-state="checked"]):not([aria-checked="true"]),
html:not(#gs-x) .gsmwa-sw[aria-checked="false"] {
  background: linear-gradient(90deg, #ff9a8f 0%, #ef4444 50%, #c81e1e 100%);
  filter: none;
}
html:not(#gs-x) .gsca-sw:not(.on) { background: #ef4444; }


/* ==========================================================================
   أزرار الدخول — تصميم عصري (زر القائمة «تسجيل الدخول» + زر «دخول» في صفحة الحساب)
   ========================================================================== */
html body .gs-login-btn{
  position:relative;isolation:isolate;overflow:hidden;border:0 !important;color:#fff !important;
  border-radius:16px !important;
  background:linear-gradient(135deg,#6d4aff 0%,#3f5fe0 55%,#1fa3ff 100%) !important;
  box-shadow:0 12px 24px -12px rgba(63,95,224,.8),inset 0 1px 0 rgba(255,255,255,.38) !important;
  transition:filter .15s ease,box-shadow .15s ease;-webkit-tap-highlight-color:transparent;transform:none !important;
}
html body .gs-login-btn::before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(120% 100% at 0% 0%,rgba(255,255,255,.30),transparent 55%)}
html body .gs-login-btn>div:first-child{background:rgba(255,255,255,.2) !important;border:1px solid rgba(255,255,255,.4);border-radius:12px !important;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);box-shadow:inset 0 1px 0 rgba(255,255,255,.35)}
html body .gs-login-btn::after{
  content:"";margin-inline-start:auto;flex:none;width:18px;height:18px;background:currentColor;opacity:.9;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center/contain no-repeat;
          mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center/contain no-repeat;
}
[dir=rtl] .gs-login-btn::after{transform:scaleX(-1)}
html body .gs-login-btn:active{filter:brightness(.93)}
@media (hover:hover){html body .gs-login-btn:hover{filter:brightness(1.07);opacity:1 !important}}
html body .gs-login-btn:focus{outline:none}
html body .gs-login-btn:focus-visible{outline:2px solid #1fa3ff;outline-offset:2px}
/* النسخة الخفيفة (القائمة الثانوية) */
html body .gs-login-btn--soft{
  color:#3b34b8 !important;border:1px solid rgba(109,74,255,.28) !important;
  background:linear-gradient(135deg,rgba(109,74,255,.12),rgba(31,163,255,.10)) !important;box-shadow:none !important;
}
html body .gs-login-btn--soft::before{display:none}
html body .gs-login-btn--soft>div:first-child{background:linear-gradient(160deg,#6d4aff,#3f5fe0) !important;border:0;box-shadow:0 8px 14px -8px rgba(63,95,224,.9)}
html body .gs-login-btn--soft>div:first-child svg{color:#fff !important}
html.dark body .gs-login-btn--soft{color:#dfe6ff !important;border-color:rgba(160,140,255,.35) !important}

/* زر «دخول» في صفحة تسجيل الدخول */
html body .gs-a-btn{
  height:52px;border-radius:14px;gap:10px;letter-spacing:.2px;position:relative;overflow:hidden;
  box-shadow:0 14px 26px -12px rgba(63,95,224,.85),inset 0 1px 0 rgba(255,255,255,.4);
  transition:filter .15s ease,box-shadow .15s ease;-webkit-tap-highlight-color:transparent;
}
html body .gs-a-btn:active{transform:none;filter:brightness(.93)}
html body .gs-a-btn:focus{outline:none}html body .gs-a-btn:focus-visible{outline:2px solid #fff;outline-offset:-4px}
html body .gs-a-btn-login{background:linear-gradient(135deg,#6d4aff 0%,#3f5fe0 55%,#1fa3ff 100%)}
html body .gs-a-btn-login:not(:disabled)::before{
  content:"";flex:none;width:20px;height:20px;background:currentColor;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4'/%3E%3Cpath d='m10 17 5-5-5-5'/%3E%3Cpath d='M15 12H3'/%3E%3C/svg%3E") center/contain no-repeat;
          mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4'/%3E%3Cpath d='m10 17 5-5-5-5'/%3E%3Cpath d='M15 12H3'/%3E%3C/svg%3E") center/contain no-repeat;
}
[dir=rtl] .gs-a-btn-login::before{transform:scaleX(-1)}
html body .gs-a-btn-signup{background:linear-gradient(135deg,#f070c8 0%,#9a4bf0 55%,#6d4aff 100%)}
