/* ==========================================================================
   فرصة - منصة وتطبيق التوظيف والفرص المهنية والكفاءات (Mobile & WebView Edition)
   ========================================================================== */

:root {
  --primary: #1967d2;
  --primary-hover: #1352aa;
  --primary-light: #eef4fc;
  --primary-glow: rgba(25, 103, 210, 0.25);
  
  --dark: #17171d;
  --dark-light: #24242e;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --accent: #f59e0b;
  --accent-light: #fef3c7;
  
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --whatsapp: #25D366;
  --whatsapp-hover: #20ba59;
  
  --bg-app: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px -3px rgba(25, 103, 210, 0.12);
  --shadow-sheet: 0 -10px 30px rgba(0,0,0,0.15);
  
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #0f172a;
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
}

/* حاوية الجوال والـ WebView */
.device-wrapper {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  background-color: var(--bg-app);
  position: relative;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  padding-bottom: calc(80px + var(--safe-bottom));
}

@media (max-width: 480px) {
  .device-wrapper {
    max-width: 100%;
    box-shadow: none;
  }
}

/* لوحة الإدارة والتحكم - واجهة متجاوبة للشاشات الكبيرة واللوحية */
.device-wrapper.admin-wrapper {
  max-width: 1050px;
}

@media (min-width: 768px) {
  .device-wrapper.admin-wrapper {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    margin: 20px auto;
    border-radius: var(--radius-lg);
    min-height: calc(100vh - 40px);
  }
  .device-wrapper.admin-wrapper .admin-nav {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .device-wrapper.admin-wrapper .stats-grid {
    grid-template-columns: repeat(6, 1fr) !important;
  }
}

/* شريط التطبيق العلوي (Top Bar) */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: calc(12px + var(--safe-top)) 16px 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.2;
}

.brand-text span {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.icon-btn:active {
  transform: scale(0.92);
  background: var(--primary-light);
  color: var(--primary);
}

/* شارات وشريط النقاط */
.points-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fef3c7;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
}

/* شريط الترحيب والبطاقة العلوية */
.welcome-card {
  margin: 14px 16px;
  padding: 16px;
  background: linear-gradient(135deg, var(--dark) 0%, #1e3a8a 100%);
  border-radius: var(--radius-lg);
  color: #fff;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.welcome-card::after {
  content: '';
  position: absolute;
  top: -30px;
  left: -30px;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.welcome-card h2 {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 4px;
}

.welcome-card p {
  font-size: 12px;
  opacity: 0.85;
}

/* شبكة الإحصائيات (Stat Cards) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 16px 14px 16px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-box .num {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  display: block;
}

.stat-box .label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

/* النماذج وحقول الإدخال */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  margin: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* الأزرار الرئيسية */
.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: 0 4px 12px var(--primary-glow);
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:active {
  background: var(--primary-hover);
  transform: scale(0.98);
}

.btn-secondary {
  padding: 10px 14px;
  background: var(--border-light);
  color: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
}

/* بطاقات الوظائف */
.job-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  position: relative;
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.job-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 3px;
}

.job-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

.job-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.tag {
  font-size: 11px;
  background: var(--border-light);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.tag-success {
  background: var(--success-light);
  color: var(--success);
}

.tag-warning {
  background: var(--accent-light);
  color: var(--accent);
}

.tag-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.job-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
  margin-top: 6px;
}

.job-salary {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--primary);
}

/* بطاقات المتقدمين والحرفيين */
.applicant-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.applicant-top {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.applicant-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
}

.applicant-info h3 {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--dark);
}

.applicant-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

/* شريط التنقل السفلي */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 4px calc(8px + var(--safe-bottom)) 4px;
  z-index: 200;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 6px;
  cursor: pointer;
  position: relative;
  min-width: 55px;
}

.nav-item i {
  font-size: 18px;
  margin-bottom: 3px;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 16px;
  height: 3px;
  background: var(--primary);
  border-radius: var(--radius-full);
}

/* رسائل التنبيه (Alerts) */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin: 12px 16px;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success {
  background: var(--success-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-danger {
  background: var(--danger-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* بطاقة الإحالة ونسخ الرابط */
.referral-box {
  background: #f0fdf4;
  border: 1px dashed var(--success);
  border-radius: var(--radius-md);
  padding: 14px;
  margin: 14px 0;
  text-align: center;
}

.referral-code {
  font-size: 20px;
  font-weight: 900;
  color: #15803d;
  letter-spacing: 2px;
  margin: 6px 0;
}

/* ==========================================================================
   شاشة البداية والتحميل (App Splash Screen - Mobile & WebView)
   ========================================================================== */
.splash-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 35%, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  direction: rtl;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s ease, visibility 0.45s ease;
  user-select: none;
}

.splash-screen.splash-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-container {
  text-align: center;
  padding: 24px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.splash-logo-container {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.splash-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  object-fit: contain;
  background: #ffffff;
  padding: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 2;
  animation: splashPulse 2s infinite ease-in-out;
}

.splash-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 24px;
  border: 2px solid rgba(25, 103, 210, 0.4);
  animation: splashRing 2s infinite ease-in-out;
}

.splash-brand-title {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  margin: 0 0 4px 0;
}

.splash-brand-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  margin: 0 0 24px 0;
}

.splash-loader-bar {
  width: 140px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  margin-bottom: 24px;
}

.splash-progress {
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, #1967d2, #f59e0b);
  border-radius: 9999px;
  position: absolute;
  animation: splashProgress 1.4s infinite ease-in-out;
}

.splash-footer-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
}

.splash-footer-info i {
  color: #10b981;
}

@keyframes splashPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes splashRing {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.12); opacity: 0; }
}

@keyframes splashProgress {
  0% { left: -45%; }
  100% { left: 100%; }
}

/* زر واتساب العائم المتوافق مع WebView وتطبيقات الموبايل */
.floating-whatsapp-btn {
  position: fixed;
  bottom: calc(76px + var(--safe-bottom, 0px));
  left: max(16px, calc((100vw - 440px) / 2 + 16px));
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #ffffff !important;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.45), 0 2px 6px rgba(0, 0, 0, 0.15);
  z-index: 195;
  text-decoration: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 440px) {
  .floating-whatsapp-btn {
    left: 16px;
  }
}

/* إذا لم يكن هناك شريط تنقل سفلي في الصفحة، يرتفع بمقدار طبيعي */
body:not(:has(.bottom-nav)) .floating-whatsapp-btn {
  bottom: calc(20px + var(--safe-bottom, 0px));
}

.floating-whatsapp-btn:hover,
.floating-whatsapp-btn:active {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
  color: #ffffff !important;
}

.floating-whatsapp-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  border: 2px solid #25D366;
  opacity: 0.8;
  animation: waPulse 2.4s infinite;
  pointer-events: none;
}

@keyframes waPulse {
  0% { transform: scale(1); opacity: 0.8; }
  70% { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}


