/* أنماط مشتركة بين كل صفحات الموقع (الشريط العلوي، الأزرار، التذييل، الألوان
   الأساسية) - كل صفحة تبقى ملفها الخاص بالكامل (HTML/CSS/JS منفصلة لكل صفحة
   كما طلب المطوّر)، وهذا الملف فقط يمنع تكرار نفس عشرات الأسطر (الشريط
   العلوي/الأزرار/الألوان) بكل صفحة على حدة ليبقى تصميم الموقع متسقًا بصريًا. */
:root {
  color-scheme: dark;
  --bg-0: #0d0f14;
  --surface: #1c1f26;
  --surface-2: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --text-primary: #e6edf3;
  --text-muted: #8b949e;
  --accent: #049dea;
  --accent-soft: rgba(4, 157, 234, 0.14);
  --gold: #f1c40f;
  --cash: #d97706;
  --networth: #10b981;
  --job: #38bdf8;
  --property: #fb7185;
  --subscription: #9b59b6;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* شريط تمرير أنيق موحّد: نحيف، دائري، يتوهّج بلون الموقع عند التمرير عليه */
* { scrollbar-width: thin; scrollbar-color: rgba(139, 148, 158, 0.35) transparent; }
*:hover { scrollbar-color: rgba(4, 157, 234, 0.55) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(139, 148, 158, 0.32);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
  transition: background-color 0.2s;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); background-clip: content-box; }
::-webkit-scrollbar-thumb:active { background: #38bdf8; background-clip: content-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 15% -10%, rgba(4, 157, 234, 0.16) 0%, transparent 45%),
    radial-gradient(circle at 100% 0%, rgba(241, 196, 15, 0.08) 0%, transparent 40%),
    linear-gradient(180deg, var(--bg-0) 0%, #090a0d 100%);
  background-attachment: fixed;
}

/* شبكة 3 أعمدة (شعار / تنقل / إجراءات) بدل flex+space-between السابقة، لأن
   space-between كانت تدفع "main-nav" لمكانه حسب عرض العنصرين المجاورين له
   فقط، فيبدو خارج منتصف الصفحة فعليًا كلما اختلف عرض الشعار عن عرض الأزرار.
   بالشبكة كل عمود مستقل: العمود الأوسط (auto) يتمركز فعليًا بمنتصف الشريط
   بغضّ النظر عن عرض الشعار أو الأزرار.
   مهم: "1fr" وحدها بقواعد Grid تُحسَب فعليًا كـ minmax(auto, 1fr) - أي أن
   حدّها الأدنى هو حجم محتواها نفسه. فحين يكبر محتوى عمود الإجراءات (زر
   الخروج + شريحة الترحيب معًا بعد تسجيل الدخول) عن محتوى عمود الشعار، يتثبّت
   ذلك العمود عند حجم محتواه ويستحوذ العمود الآخر الأخف على كل المساحة
   المتبقية بمفرده - فيتزحزح عمود التنقل الأوسط فعليًا نحو الجانب الأثقل
   بدل البقاء بمنتصف الشريط تمامًا (هذا ما لاحظه المطوّر). الحل: minmax(0,1fr)
   بدل 1fr المجردة يُلغي هذا الحدّ الأدنى المرتبط بالمحتوى، فيتساوى العمودان
   دائمًا ويبقى عمود التنقل بمنتصف الشريط فعليًا مهما اختلف محتوى الجانبين. */
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 18px clamp(16px, 5vw, 64px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(13, 15, 20, 0.75);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; text-decoration: none; color: var(--text-primary); justify-self: start; }
.brand img { width: 34px; height: 34px; border-radius: 9px; display: block; }

.main-nav { display: flex; align-items: center; gap: 22px; justify-self: center; }
.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: color 0.15s ease;
  white-space: nowrap;
}
.main-nav a:hover, .main-nav a.active { color: var(--text-primary); }

.top-actions { display: flex; align-items: center; gap: 12px; justify-self: end; }

/* ".nav-drawer" يلفّ main-nav + top-actions معًا (بطلب المطوّر: قائمة همبرغر
   بالجوال تعرض الصفحات وتسجيل الدخول/البروفايل معًا بقائمة واحدة). على
   الشاشات الواسعة "display:contents" يُلغي أثر هذا اللفّ تمامًا - العنصران
   يشاركان مباشرة بشبكة ".topbar" (brand/nav/actions) كأن الملفّ غير موجود،
   فتصميم الشريط العلوي بالشاشات الكبيرة يبقى بلا أي تغيير. */
.nav-drawer { display: contents; }

/* زر "☰" - يظهر فقط بالشاشات الضيقة (media query أدناه). */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.nav-toggle .icon { width: 22px; height: 22px; }
.nav-toggle:hover { border-color: var(--accent); }
.nav-toggle[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* شاشات ضيقة (جوال بالغالب): الشريط العلوي يصبح عمودين فقط (شعار + زر
   همبرغر)، وروابط التنقل + حالة الحساب (تسجيل الدخول/الترحيب بالعضو) تختفي
   من الصف وتنتقل لقائمة منسدلة واحدة (".nav-drawer") تحت الشريط، تُفتح
   وتُغلق بالزر (منطقها بـshared.js: fetch/tabs_toggle عبر "is-nav-open" على
   ".topbar"، مع إغلاق تلقائي عند اختيار رابط أو الضغط خارج القائمة). هذا
   يستبدل التصميم القديم (طيّ الشريط لسطرين ثابتين) الذي كان يزدحم على
   الشاشات الأضيق فعلًا. */
@media (max-width: 720px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand toggle";
    position: relative;
  }
  .brand { grid-area: brand; }
  .nav-toggle { display: inline-flex; grid-area: toggle; }

  .nav-drawer {
    display: none;
    grid-column: 1 / -1;
  }

  .topbar.is-nav-open .nav-drawer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 15;
    background: rgba(13, 15, 20, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 16px 16px;
    padding: 14px clamp(16px, 5vw, 64px) 20px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  }

  .topbar.is-nav-open .main-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-bottom: 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }
  .topbar.is-nav-open .main-nav a {
    padding: 12px 10px;
    border-radius: 10px;
    white-space: normal;
  }
  .topbar.is-nav-open .main-nav a:hover,
  .topbar.is-nav-open .main-nav a.active {
    background: var(--surface-2);
  }

  .topbar.is-nav-open .top-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .topbar.is-nav-open .top-actions .btn,
  .topbar.is-nav-open .top-actions .welcome-chip {
    justify-content: center;
    width: 100%;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
  font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #05131c; }
.btn-primary:hover { background: #29b0ee; }
.btn-ghost { background: transparent; color: var(--text-primary); border-color: var(--border); }

/* "welcome-chip" رابط فعلي لصفحة "/profile" (المرحلة ب) لا مجرد ترحيب ثابت -
   بلا تسطير أو لون رابط افتراضي (color: inherit) حتى يبقى شكله كشارة، مع
   تفاعل بسيط عند المرور (تغيّر لون الحد) يلمّح أنه قابل للنقر. */
.welcome-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.welcome-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.welcome-chip img { width: 26px; height: 26px; border-radius: 50%; }

/* أيقونات خطية بسيطة (SVG) بدل الإيموجي بكل الموقع (بطلب المطوّر) - كل
   أيقونة ترث لونها من "color" بالعنصر الحاوي (stroke="currentColor")، فنفس
   نمط تلوين الميزات بالمتغيرات (--job, --gold...) يعمل بلا أي تغيير إضافي. */
.icon {
  width: 24px;
  height: 24px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-hero { padding: 56px clamp(16px, 5vw, 64px) 20px; text-align: center; max-width: 900px; margin: 0 auto; }
.page-hero h1 { font-size: clamp(26px, 3.6vw, 38px); margin: 0 0 12px; font-weight: 800; }
.page-hero p { color: var(--text-muted); font-size: 15px; line-height: 1.9; margin: 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

/* تذييل غني بأعمدة (يشبه بنية مواقع بوتات ديسكورد المعروفة): شعار ووصف
   أعلى، ثم أعمدة روابط مصنّفة، ثم شريط حقوق سفلي - بدل سطر روابط واحد فقط.
   ".site-footer" نفسه بلا حدّ أقصى للعرض (خلفيته وخطّه العلوي يمتدّان كامل
   الشريط كالهيدر تمامًا)، لكن محتواه الفعلي (".footer-inner") محصور بنفس
   عرض محتوى الصفحة (1080px تقريبًا) - بدونه على شاشة عريضة كانت الأعمدة
   الثلاثة تتمدّد لتملأ الشاشة كاملة، فيبتعد كل عمود عن الآخر بفراغات ضخمة
   غير متوازنة (هذا ما لاحظه المطوّر مقارنة بتذييل Vetox المحصور بعرض معقول). */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 0 clamp(16px, 5vw, 64px);
  color: var(--text-muted);
  font-size: 13.5px;
}

.footer-inner { max-width: 1080px; margin: 0 auto; padding: 48px 0 28px; }

.footer-top { max-width: 420px; margin-bottom: 36px; }
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; text-decoration: none; color: var(--text-primary); margin-bottom: 10px; }
.footer-brand img { width: 30px; height: 30px; border-radius: 8px; }
.footer-tagline { margin: 0; line-height: 1.9; }

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 220px));
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.footer-col h4 { margin: 0 0 14px; font-size: 13px; color: var(--text-primary); font-weight: 800; }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-col a { color: var(--text-muted); text-decoration: none; font-size: 13.5px; width: fit-content; }
.footer-col a:hover, .footer-col a.active { color: var(--accent); }

.footer-bottom { padding-top: 20px; text-align: center; font-size: 12.5px; }


/* زر "لوحة التحكم" بالشريط العلوي العام (صفحات الموقع خارج قسم لوحة التحكم
   نفسه) - رابط تنقّل مباشر لـ"/dashboard" الآن (خطة الموقع، القسم 11.17)،
   بعد أن كان سابقًا يفتح لوحة جانبية هنا. تلك اللوحة (ومعها كل أنماط
   ".dashboard-panel"/".dashboard-overlay") انتقلت لملف "dashboardShell.css"
   الخاص بصفحات قسم لوحة التحكم فقط، حيث أصبحت تُستخدَم فعليًا. */
.dashboard-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
}


/* شريحة المستخدم بالشريط العلوي (صفحات الموقع العامة) */
.user-chip-wrap { position: relative; }
.user-chip { display: inline-flex; align-items: center; gap: 10px; padding: 5px 8px 5px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.user-chip:hover, .user-chip[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); }
.user-chip-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--accent-soft); }
.user-chip-initial { display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--accent); }
.user-chip-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-caret { width: 16px; height: 16px; color: var(--text-muted); transition: transform .15s; }
.user-chip[aria-expanded="true"] .user-chip-caret { transform: rotate(180deg); }
.user-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 190px; padding: 8px; border-radius: 14px; background: #0b0d12; border: 1px solid var(--border); box-shadow: 0 16px 40px rgba(0, 0, 0, .55); z-index: 60; display: flex; flex-direction: column; gap: 2px; }
.user-menu[hidden] { display: none; }
.user-menu a { display: block; padding: 10px 14px; border-radius: 10px; color: var(--text-primary); text-decoration: none; font-size: 14px; font-weight: 700; }
.user-menu a:hover { background: var(--surface-2); }
.user-menu a.is-danger { color: #ff6b6b; }
@media (max-width: 720px) {
  .user-chip-wrap { width: 100%; }
  .user-chip { width: 100%; justify-content: flex-start; }
  .user-chip-name { flex: 1; text-align: start; max-width: none; }
  .user-menu { position: static; margin-top: 8px; box-shadow: none; }
}

.btn-discord { background: #5865f2; color: #fff; }
.btn-discord:hover { background: #6d79f5; }
