/* ==========================================================================
   OutArrow - Core Stylesheet
   Path: assets/css/core.css
   ========================================================================== */

:root {
  --outarrow-blue: #0066cc;
  --outarrow-gold: #f59e0b;
  --outarrow-dark: #0f172a;
  --uhg-red: #dc2626;

  --bg-main: #f8fafc;
  --bg-header: rgba(255, 255, 255, 0.96);
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --topbar-bg: #0b1329;
  --topbar-text: #e2e8f0;
  
  --card-shadow: 0 4px 14px rgba(13, 30, 58, 0.05);
  --transition-core: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

[data-theme="dark"] {
  --outarrow-blue: #3b82f6;
  --outarrow-gold: #fbbf24;
  --uhg-red: #ef4444;

  --bg-main: #050b14;
  --bg-header: rgba(7, 17, 33, 0.95);
  --bg-surface: #0a1324;
  --bg-surface-elevated: #0f1c33;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --topbar-bg: #02050a;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-user-select: none !important; user-select: none !important;
}
input, textarea, select { user-select: auto !important; }

html, body {
  margin: 0; padding: 0; width: 100%; overflow-x: hidden !important;
  background-color: var(--bg-main); color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6; transition: background-color 0.3s, color 0.3s;
}

[dir="rtl"] body { font-family: 'Cairo', Tahoma, sans-serif; }
a { text-decoration: none; color: inherit; }

/* --------------------------------------------------------------------------
   1. شريط أعلام الدول (Global Flags Ticker) - الحل الجذري للدوران اللانهائي
   -------------------------------------------------------------------------- */
.global-flags-ticker {
  background: #020617;
  height: 32px;
  display: flex;
  align-items: center;
  overflow: hidden;
  direction: ltr !important; /* فرض الاتجاه من اليسار لليمين لتجنب أعطال الـ RTL */
  position: relative;
  mask-image: linear-gradient(to right, transparent, black 2%, black 98%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 2%, black 98%, transparent);
}

.flags-track {
  display: flex;
  white-space: nowrap;
}

/* تحريك العناصر نفسها بنسبة 100% بدلاً من تحريك الأب لتكوين حلقة لا نهائية حقيقية */
.flags-set {
  display: flex;
  gap: 15px;
  padding-right: 15px; /* لضمان تطابق المسافة عند الالتفاف */
  flex-shrink: 0;
  animation: scrollFlags 100s linear infinite;
}

.flags-set img {
  width: 26px; 
  height: 18px; 
  border-radius: 2px; 
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.global-flags-ticker:hover .flags-set { 
  animation-play-state: paused; 
}

@keyframes scrollFlags { 
  0% { transform: translateX(0); } 
  100% { transform: translateX(-100%); } 
}

/* --------------------------------------------------------------------------
   2. شاشة التحميل (Preloader)
   -------------------------------------------------------------------------- */
#uhg-preloader { position: fixed; inset: 0; background: var(--bg-main); z-index: 999999; display: flex; align-items: center; justify-content: center; transition: opacity 0.5s, visibility 0.5s; }
#uhg-preloader.loaded { opacity: 0; visibility: hidden; }
.preloader-orbit { position: relative; width: 180px; height: 180px; display: flex; align-items: center; justify-content: center; }
.preloader-core-logo { width: 110px; animation: corePulse 2s infinite alternate ease-in-out; }
.orbit-ring { position: absolute; border-radius: 50%; border: 2px solid transparent; }
.orbit-ring-outer { width: 180px; height: 180px; border-top-color: var(--outarrow-blue); animation: spinRight 2s linear infinite; }
.orbit-ring-inner { width: 140px; height: 140px; border-bottom-color: var(--outarrow-gold); animation: spinLeft 1.5s linear infinite; }
@keyframes spinRight { 100% { transform: rotate(360deg); } }
@keyframes spinLeft { 100% { transform: rotate(-360deg); } }
@keyframes corePulse { 0% { transform: scale(0.95); } 100% { transform: scale(1.05); } }

/* --------------------------------------------------------------------------
   3. الشريط العلوي التفاعلي
   -------------------------------------------------------------------------- */
.uhg-topbar { background: var(--topbar-bg); color: var(--topbar-text); height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; font-size: 12.5px; z-index: 1002; position: relative; }
.visitor-locale-pill, .live-clock-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, 0.08); padding: 4px 10px; border-radius: 6px; font-weight: 700; }
.topbar-controls { display: flex; align-items: center; gap: 14px; width:100%; justify-content: flex-end; }

.lang-btn, .theme-toggle-trigger { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15); color: #fff; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-weight: 700; display:flex; align-items:center; gap:8px; }
.lang-selector-dropdown { position: relative; }
.lang-menu { position: absolute; top: calc(100% + 8px); right: 0; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 12px; width: 200px; max-height: 320px; overflow-y: auto; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: var(--transition-core); z-index: 9999; padding: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
[dir="rtl"] .lang-menu { right: auto; left: 0; }
.lang-selector-dropdown.open .lang-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.lang-item { background: transparent; border: none; padding: 10px; display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer; border-radius: 6px; color: var(--text-primary); font-weight: 600; transition: var(--transition-core); }
[dir="rtl"] .lang-item { text-align: right; }
.lang-item:hover, .lang-item.active { background: var(--bg-surface-elevated); color: var(--outarrow-blue); }

/* --------------------------------------------------------------------------
   4. الترويسة الرئيسية
   -------------------------------------------------------------------------- */
.site-header { background: var(--bg-header); border-bottom: 1px solid var(--border-subtle); position: sticky; top: 0; z-index: 1000; backdrop-filter: blur(12px); }
.navbar-container { max-width: 1320px; margin: 0 auto; padding: 0 24px; height: 80px; display: flex; justify-content: space-between; align-items: center; }
.brand-box { display: flex; align-items: center; gap: 14px; }
.brand-titles div:first-child { font-size: 20px; font-weight: 900; color: var(--outarrow-blue); }
.brand-titles div:last-child { font-size: 11px; font-weight: 700; color: var(--outarrow-gold); text-transform: uppercase; }
.nav-links { list-style: none; display: flex; gap: 28px; }
.nav-links a { font-weight: 700; color: var(--text-secondary); transition: var(--transition-core); }
.nav-links a:hover, .nav-links a.active { color: var(--outarrow-blue); }
.nav-btn-contact { background: var(--outarrow-blue); color: #fff !important; padding: 8px 20px; border-radius: 8px; }

/* --------------------------------------------------------------------------
   5. استجابة شاشات الموبايل
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .nav-links { display: none !important; }
  .uhg-topbar { padding: 10px; height: auto; justify-content: center; flex-wrap: wrap;}
  .topbar-controls { justify-content: center; }
}