/* تم نقل تحميل خط Cairo إلى وسوم <link> داخل الرأس لتحسين الأداء والموثوقية */

:root {
  --bg: #0b0b0c;           /* خلفية سوداء عميقة */
  --panel: #141416;        /* لوحات سوداء/رمادية داكنة */
  --primary: #cfcfcf;      /* لون تمييز رمادي فضي للأزرار والروابط */
  --accent: #8a8a8a;       /* لون ثانوي رمادي داكن */
  --text: #e6e8f0;         /* نص فاتح قابل للقراءة */
  --muted: #b6bac4;        /* نص ثانوي رمادي محايد */
  --success: #2ecc71;
  --danger: #e74c3c;
  --overlay-bg: rgba(8, 8, 10, 0.85); /* تراكب أكثر سوادًا */
  --progress: #cfcfcf;     /* تقدم بلون فضي */
  --menu-pill-w: 180px;    /* عرض زر التصنيفات على الحاسوب */
  --gold: #f5b000;         /* لهجة ذهبية لزر البحث */
  --nav-h: 64px;           /* ارتفاع الشريط على الحاسوب لتعويض المحتوى عند التثبيت */
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 800px at 20% -10%, #101010 0%, var(--bg) 60%);
  background-color: var(--bg); /* منع أي بياض أثناء الارتداد */
  color: var(--text);
  font-family: 'Cairo', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden; /* منع التمرير الأفقي والاهتزاز على الهاتف */
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(14px, 3vw, 24px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(12px, 3vw, 24px);
  min-height: 64px; /* ثابت ومريح على الحاسوب */
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(4px);
}
.nav { position: sticky; top: 0; width: 100%; }
.nav { z-index: 1100; }
.nav .start { display: flex; align-items: center; gap: 12px; width: 100%; justify-content: center; }
.nav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.2;
  position: absolute;
  top: 50%;
  left: calc(14px + var(--safe-left) + var(--menu-pill-w) + 16px);
  transform: translateY(-50%);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.nav .brand:hover { opacity: 0.85; }
.brand-logo {
  width: clamp(28px, 6vw, 38px);
  height: clamp(28px, 6vw, 38px);
  display: block;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.brand-title {
  font-weight: 800;
  letter-spacing: 0.6px;
  font-size: clamp(16px, 4.4vw, 20px);
  background: linear-gradient(180deg, #f7f7f7, #c9cfda 60%, #8a8f99);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  display: inline-block; /* يمنع القص عند اختلاف الأسطر */
  padding-bottom: 2px; /* مسافة طفيفة أسفل الاسم لإزالة التقطيع المرئي */
}
.nav .links {
  display: flex;
  gap: clamp(8px, 2.4vw, 14px);
}
/* --- User menu button (far right) --- */
.user-menu { position: relative; }
.user-menu-btn {
  background: none;
  border: none;
  color: var(--text);
  padding: 6px 8px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
}
.user-menu-btn:focus { outline: 2px solid rgba(255,255,255,0.25); outline-offset: 2px; }
.user-icon { width: 22px; height: 22px; display: inline-block; position: relative; }
.user-icon::before, .user-icon::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 50%;
}
.user-icon::before { width: 12px; height: 12px; top: 0; }
.user-icon::after { width: 18px; height: 8px; bottom: 0; border-top-left-radius: 14px; border-top-right-radius: 14px; border-bottom: none; }
.user-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #0b0b0c;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  box-shadow: none;
  padding: 4px;
  min-width: 220px;
  z-index: 1200;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transition: opacity .18s ease, transform .22s cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-popover.active { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.user-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-align: left;
  padding: 6px 10px;
  border-radius: 0;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
  margin: 0;
  line-height: 1.1;
}
.user-item:hover {
  transform: none;
  background: transparent;
  box-shadow: none;
}
.user-item:active { transform: none; box-shadow: none; }
.user-item:focus { outline: 2px solid rgba(255,255,255,0.25); outline-offset: 2px; }


.btn {
  display: inline-block;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  color: var(--text);
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 44px; /* comfortable touch target */
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.3); }
.btn.primary { background: linear-gradient(180deg, rgba(180,180,180,0.18), rgba(160,160,160,0.12)); border-color: rgba(200,200,200,0.35); }

.hero {
  text-align: center;
  padding: 20px 20px 10px; /* تقليل المسافة العلوية لرفع العنوان أسفل الصورة */
}
.hero h1 { font-size: clamp(24px, 6vw, 42px); margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0 0 30px; }

.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  padding: 24px;
}

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

form .field { margin-bottom: 14px; }
label { display: block; margin-bottom: 6px; color: var(--muted); }
input[type="email"], input[type="password"], input[type="text"], input[type="tel"], select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  outline: none;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 16px; /* prevent iOS zoom, keep readability */
}

/* OTP inputs: numeric-only code entry */
.otp-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.otp-input {
  width: 54px;
  height: 64px;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.otp-input:focus {
  border-color: rgba(155,89,182,0.5);
  box-shadow: 0 0 0 2px rgba(155,89,182,0.25);
}

.countdown {
  color: var(--muted);
}
#countdown.tick {
  animation: tick 250ms ease;
}
@keyframes tick {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* Phone row: country code + number side by side */
.phone-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
  align-items: end;
}

.country-search { margin-bottom: 8px; }

.error { color: var(--danger); margin-bottom: 12px; }
.success { color: var(--success); margin-bottom: 12px; }

.card {
  padding: 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

/* Top progress bar */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--progress), var(--accent));
  box-shadow: 0 0 12px rgba(200,200,200,0.35);
  transition: width 0.25s ease;
  z-index: 1000;
}

/* Loading overlay */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
#loading-overlay.active { display: flex; }
#loading-overlay { pointer-events: none; }
.loading-box {
  text-align: center;
  padding: 24px 28px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
}
.loading-title { font-weight: 700; margin-bottom: 8px; }
.loading-sub { color: var(--muted); }

/* Spinner */
.spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--primary);
  border-right-color: var(--accent);
  animation: spin 0.9s linear infinite, glow 1.6s ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes glow {
  0% { box-shadow: 0 0 0 rgba(200,200,200,0.0); }
  50% { box-shadow: 0 0 16px rgba(200,200,200,0.35); }
  100% { box-shadow: 0 0 0 rgba(200,200,200,0.0); }
}

/* Responsive tweaks */
@media (max-width: 720px) {
  :root { --nav-h: 72px; } /* ارتفاع أكبر قليلًا على الهاتف */
  .nav { padding: 12px 14px; justify-content: center; min-height: 72px; }
  .nav .links { gap: 8px; }
  .container { padding: 16px; }
  .panel { padding: 18px; border-radius: 16px; }
  .grid { grid-template-columns: 1fr; }
  .phone-row { grid-template-columns: 1fr; }
  .otp-input { width: 48px; height: 58px; font-size: 24px; }
  :root { --menu-pill-w: 136px; } /* تصغير الزر أكثر على الهاتف */
  /* على الهاتف تبقى العلامة في المنتصف */
  .nav .brand { left: 50%; transform: translate(-50%, -50%); gap: 12px; flex-wrap: nowrap; align-items: center; }
  /* تكبير الشعار والاسم أكثر على الهاتف دون الخروج من الشريط */
  .brand-logo { width: clamp(40px, 10vw, 56px); height: clamp(40px, 10vw, 56px); }
  .brand-title { font-size: clamp(20px, 6.8vw, 28px); letter-spacing: 0.75px; white-space: nowrap; }
  /* ضبط زر التصنيفات وتقليل اتساع النص داخله */
  .menu-btn { height: 34px; padding: 0 10px; gap: 8px; }
  .menu-label { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .menu-line { width: 16px; height: 2px; margin: 2px 0; }
}

@media (max-width: 420px) {
  :root { --menu-pill-w: 128px; }
  .brand-title { letter-spacing: 0.7px; font-size: clamp(17px, 5.4vw, 22px); white-space: nowrap; }
  .brand-logo { width: 36px; height: 36px; }
  .menu-label { font-size: 12px; }
  .btn { padding: 12px 14px; }
  .hero { padding: 40px 14px 6px; }
  .hero p { margin-bottom: 22px; }
}

/* --- Ultra-compact phones (hide label, keep icon only) --- */
@media (max-width: 370px) {
  :root { --menu-pill-w: 44px; } /* زر صغير جدًا */
  .menu-btn { height: 34px; padding: 0 8px; gap: 0; } /* محاذاة الأيقونة وسط الزر */
  .menu-label { display: none; } /* إخفاء النص والاكتفاء بالخطوط */
  .menu-icon { display: flex; align-items: center; justify-content: center; }
  .menu-line { width: 18px; height: 2px; margin: 2px 0; }
  /* إبقاء الشعار والاسم كبيرين على أصغر الهواتف دون تجاوز الشريط */
  .brand-logo { width: clamp(36px, 11vw, 48px); height: clamp(36px, 11vw, 48px); }
  .brand-title { font-size: clamp(19px, 6vw, 26px); white-space: nowrap; }
}

/* Hide label on small iPhones (e.g., 390–430px widths) */
@media (max-width: 430px) {
  :root { --menu-pill-w: 52px; }
  .menu-btn { height: 34px; padding: 0 8px; gap: 0; }
  .menu-label { display: none; }
  .menu-icon { display: flex; align-items: center; justify-content: center; }
  .menu-line { width: 18px; height: 2px; margin: 2px 0; }
  /* تكبير آمن للشعار والاسم في نطاق هواتف آيفون الصغيرة */
  .brand-logo { width: clamp(36px, 10vw, 48px); height: clamp(36px, 10vw, 48px); }
  .brand-title { font-size: clamp(18px, 5.8vw, 26px); white-space: nowrap; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .spinner { animation: none; }
  #progress-bar { transition: none; }
}

/* ----- Mobile precise adjustments & iOS safe areas ----- */
/* Safe area vars for devices with notch */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

/* Prevent Safari auto-zoom and text resizing side-effects */
html, body { -webkit-text-size-adjust: 100%; }

/* --- Site protection: disable selection and image interactions (كما كان سابقًا) --- */
/* منع تحديد النص على معظم عناصر الواجهة */
body, .nav, .container, .panel, .grid, .hero, .search-bar, .footer, .drawer {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
/* السماح بالتحديد داخل الحقول كي لا تتأثر قابلية الاستخدام */
input, textarea, select {
  -webkit-user-select: text !important;
  user-select: text !important;
}
/* منع جرّ الصور والنقرات عليها لتقليل النسخ/التحميل */
img, .banner-img {
  pointer-events: none; /* تعطيل النقر/الضغط على الصور لمنع التحميل/التفاعل */
  -webkit-user-drag: none;
  user-select: none; /* إبقاء الصور غير قابلة للتحديد فقط */
}
/* إلغاء تمييز التحديد المرئي */
::selection { background: transparent; color: inherit; }

/* Truncate long email label inside nav button on mobile */
.nav .links .btn {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Override mobile layout to stack nav and ensure safe-area padding */
@media (max-width: 720px) {
  :root { --nav-h: 72px; } /* تأكيد التعويض على الهاتف */
  .nav {
    padding-top: calc(10px + var(--safe-top));
    padding-left: calc(14px + var(--safe-left));
    padding-right: calc(14px + var(--safe-right));
    /* نُرجع التمركز للوسط على الهاتف */
    justify-content: center;
    min-height: 64px; /* زيادة الارتفاع ليتسع الشعار والاسم */
    gap: 8px;
  }
  .nav .links {
    gap: 8px;
    /* إعادة الوضع الأفقي للأزرار على الهاتف */
  }
  /* لا نجبر الأزرار على العرض الكامل في الهاتف */
}

/* --- Menu Categorie (hamburger) --- */
.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  width: var(--menu-pill-w);
  padding: 0 12px;
  gap: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  color: var(--text);
  cursor: pointer;
  /* إزالة الانتقالات حتى لا يتحرك الزر */
  transition: none;
  position: absolute;
  left: calc(14px + var(--safe-left));
  top: 50%;
  transform: translateY(-50%);
  z-index: 960;
}
/* إزالة تأثير التحويم: يبقى ثابتًا دون تغيير */
.menu-btn:hover { transform: translateY(-50%); box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.menu-icon { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.menu-line {
  display: block;
  width: 18px;
  height: 2px;
  margin: 2px 0;
  border-radius: 2px;
  background: rgba(230,232,240,0.9);
}
.menu-label {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

/* ---- Categories Dropdown Menu ---- */
.categories-dropdown {
  position: fixed;
  top: 70px;
  left: calc(14px + var(--safe-left));
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 8px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 970;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(10px);
}

.categories-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.categories-dropdown .category-item {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  transition: background 0.2s ease;
  margin-bottom: 4px;
}

.categories-dropdown .category-item:last-child {
  margin-bottom: 0;
}

.categories-dropdown .category-item:hover {
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

.categories-dropdown .category-item:active {
  background: rgba(255,255,255,0.15);
}

/* Responsive styles for categories dropdown */
@media (max-width: 768px) {
  .categories-dropdown {
    top: 65px;
    left: calc(14px + var(--safe-left));
    min-width: 160px;
  }
}

@media (max-width: 430px) {
  .categories-dropdown {
    top: 60px;
    left: calc(12px + var(--safe-left));
    min-width: 150px;
    padding: 6px;
  }
  
  .categories-dropdown .category-item {
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* ---- Creators section ---- */
.creators {
  margin: 24px auto 10px;
  border-bottom: 2px solid rgba(255,255,255,0.22);
  padding-bottom: 16px;
}
.creators-list {
  display: flex;
  flex-direction: column;
  gap: 0; /* قائمة عمودية متماسكة مثل المثال */
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  overflow: hidden;
}
.creator-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 12px 16px;
}
.creator-card:last-child { border-bottom: none; }
.creator-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.creator-info { flex: 1; min-width: 0; }
.creator-name {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.name-text {
  /* لا تدفع الشارة إلى أقصى اليمين؛ اجعل النص يتقلص بدلًا من التمدد */
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc(100% - 22px); /* مساحة للشارة + الفجوة */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.verified-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.30);
}
.verified-badge .badge-icon { width: 16px; height: 16px; display: block; }
.creator-bio {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* Link button on far right (emoji, premium, no background) */
.creator-link {
  margin-left: auto;
  text-decoration: none;
  background: transparent;
  color: rgba(255,255,255,0.85);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: none;
  outline: none;
  transition: transform 160ms ease, color 160ms ease, filter 160ms ease;
  position: relative;
}
.creator-link:hover { color: #fff; transform: translateY(-1px) scale(1.06); }
.creator-link:active { transform: translateY(0) scale(0.96); }
.creator-link[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }

/* SVG icon style (Discord-like outline) */
.icon-link { width: 18px; height: 18px; }
.icon-link path { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Click pulse effect */
.creator-link::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  width: 24px; height: 24px;
  border-radius: 999px;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.0) 60%);
  pointer-events: none;
}
.creator-link.pulse::after {
  animation: linkPulse 220ms ease-out;
}
@keyframes linkPulse {
  0%   { opacity: .35; transform: translate(-50%, -50%) scale(.8); }
  100% { opacity: 0;   transform: translate(-50%, -50%) scale(1.15); }
}

@media (max-width: 720px) {
  .creator-avatar { width: 52px; height: 52px; }
}

/* ----- Decorative search bar under nav ----- */
.search-wrap {
  display: flex;
  justify-content: center;
  padding: 10px 16px 16px;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: clamp(320px, 72vw, 820px);
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  padding: 0 0 0 12px; /* إزالة الحشوة اليمنى ليلاصق الزر الطرف */
  overflow: hidden; /* قص داخلي لضمان اندماج الطرف الدائري للزر مع الحبة */
}
.search-cat { display: inline-flex; align-items: center; gap: 10px; padding-right: 6px; }
.search-icon-lines { display: inline-flex; flex-direction: column; gap: 4px; }
.search-icon-lines i { display:block; width: 18px; height: 2px; border-radius: 2px; background: rgba(220,222,230,0.75); }
.search-cat-label { color: var(--muted); font-weight: 600; font-size: 13px; opacity: 0.85; }
/* زر التصنيفات داخل شريط البحث ليبدو كنص قابل للنقر */
.search-cat-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  opacity: 0.85;
  cursor: pointer;
}
.search-cat-btn:hover { opacity: 0.92; }
.search-divider { width: 1px; height: 22px; background: rgba(255,255,255,0.15); }
.search-input { flex: 1; color: var(--muted); opacity: 0.72; font-size: 13px; }
.search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 100%;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, rgba(180,180,180,0.18), rgba(160,160,160,0.12));
  border-left: 1px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 0 0 rgba(0,0,0,0.0), 0 0 0 1px rgba(255,255,255,0.04);
  pointer-events: none; /* بدون وظيفة */
}
.search-glass {
  position: relative;
  width: 16px; height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
}
.search-glass::after {
  content: "";
  position: absolute;
  width: 9px; height: 2px;
  background: #fff;
  transform: rotate(40deg);
  right: -6px; bottom: -3px;
  border-radius: 2px;
}

@media (max-width: 720px) {
  .search-bar { width: 100%; height: 38px; } /* تجنب تجاوز العرض بسبب الحشوة الخارجية */
  .search-cat-label, .search-cat-btn { font-size: 12px; opacity: 0.8; }
  .search-input { font-size: 12px; opacity: 0.7; }
.search-submit { width: 46px; }
}

/* ----- Dynamic banner rotator ----- */
.banner-wrap {
  display: flex;
  justify-content: center;
  /* ترك مسافة واضحة بين البار والصورة */
  margin-top: 14px;
  padding: 8px 10px 4px;
}
.banner-rotator {
  position: relative;
  /* تقليص واضح على الحاسوب */
  width: clamp(520px, 78vw, 1000px);
  height: auto;
  /* نسبة ثابتة 2:1 لتتوافق مع صور 1000×500 */
  aspect-ratio: 2 / 1;
  margin-bottom: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  overflow: hidden;
}
.banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* ملء كامل المساحة بدون فراغات جانبية */
  object-position: center center; /* ضبط التركيز في المنتصف لتناسق القص من كل الجوانب */
  opacity: 0;
  transition: opacity 420ms ease;
}
.banner-img.active { opacity: 1; }

@media (max-width: 720px) {
  .banner-wrap { margin-top: 12px; padding-top: 8px; }
  .banner-rotator {
    width: 92vw; /* تقليص أوضح على الهاتف */
    max-width: 100%;
    /* نفس نسبة الصور: 2:1 لضمان ملاءمة كاملة بدون فراغ أو قص */
    aspect-ratio: 2 / 1;
    height: auto;
    border-radius: 20px;
    margin: 0 auto;
  }
}

/* هواتف صغيرة جدًا: مزيد من التصغير كي لا يغطّي مساحة كبيرة */
@media (max-width: 420px) {
  .banner-rotator {
    width: 90vw;
    aspect-ratio: 2 / 1; /* الحفاظ على نسبة 2:1 أيضًا على الهواتف الصغيرة جدًا */
    border-radius: 18px;
  }
}
/* Drawer and overlay */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 10, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 900;
}
.menu-overlay.active { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 40vw; /* Desktop ~40% */
  max-width: 720px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border-right: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
  transform: translateX(-110%);
  transition: transform .22s ease;
  z-index: 950;
  padding: calc(12px + var(--safe-top)) calc(12px) calc(12px + var(--safe-bottom)) calc(12px + var(--safe-left));
}
.drawer.active { transform: translateX(0); }

@media (max-width: 720px) {
  .drawer { width: 30vw; }
  .menu-btn { left: calc(12px + var(--safe-left)); }
}

/* Add safe-area padding at bottom to avoid overlap with iOS home indicator */
.footer { padding: calc(24px + var(--safe-bottom)); }
/* Hide label a bit earlier to prevent stacking under logo */
@media (max-width: 500px) {
  :root { --menu-pill-w: 60px; }
  .menu-btn { height: 34px; padding: 0 10px; gap: 0; }
  .menu-label { display: none; }
  .menu-icon { display: flex; align-items: center; justify-content: center; }
  .menu-line { width: 18px; height: 2px; margin: 2px 0; }
  /* Slightly shrink brand to keep alignment */
  .brand-logo { width: clamp(34px, 7.2vw, 44px); height: clamp(34px, 7.2vw, 44px); }
  .brand-title { font-size: clamp(17px, 4.8vw, 22px); }
}
/* ---- Insta center grid ---- */
.insta { margin: 18px auto 10px; }
.insta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.insta-card {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1; /* مربع ثابت لعنصر البطاقة */
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  box-shadow: 0 8px 18px rgba(0,0,0,0.30);
  transition: transform .15s ease, box-shadow .15s ease;
}
.insta-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.insta-card:hover { box-shadow: 0 12px 24px rgba(0,0,0,0.35); transform: translateY(-2px); }
.insta-card:active { transform: translateY(0); }
.insta-empty { background: rgba(255,255,255,0.02); border-style: dashed; border-color: rgba(255,255,255,0.12); }

@media (max-width: 720px) {
  .insta-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Dynamic strip below cards ---- */
.dyn-strip { margin: 14px auto 6px; }
.dyn-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.dyn-card {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9; /* مستطيل عريض للبنرات */
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  box-shadow: 0 8px 18px rgba(0,0,0,0.30);
}
.dyn-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dyn-empty { background: rgba(255,255,255,0.02); border-style: dashed; border-color: rgba(255,255,255,0.12); }

@media (max-width: 720px) {
  .dyn-grid { grid-template-columns: repeat(2, 1fr); }
}
/* Toast notifications */
.toast-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: var(--toast-top, 12px);
  z-index: 1000;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 86vw;
  background: #2f3336;
  color: #fff;
  padding: 10px 14px;
  border-radius: 1000px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.28);
  margin: 6px 0;
  pointer-events: auto;
  animation: toast-slide-in 220ms ease-out;
}
.toast.success .toast-icon { background: #22c55e; }
.toast.info .toast-icon { background: #3b82f6; }
.toast.error .toast-icon { background: #ef4444; }
.toast.warning .toast-icon { background: #f59e0b; }
.toast-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex: 0 0 22px;
}
.toast-icon::before { content: "✓"; font-weight: 700; }
.toast.error .toast-icon::before { content: "!"; }
.toast-text { font-size: 14px; font-weight: 600; }
.toast-close {
  margin-left: 8px;
  background: transparent;
  border: 0;
  color: #ddd;
  cursor: pointer;
  font-size: 14px;
}
@keyframes toast-slide-in {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes toast-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}