/* ================================================================
   frontend/css/global.css — Z-PACT Brand Identity
================================================================ */

:root {
  /* Z-PACT Premium Palette */
  --primary:        #38bdf8; /* Neon Sky */
  --primary-dark:   #0ea5e9;
  --primary-glow:   rgba(56, 189, 248, 0.4);
  --primary-light:  rgba(56, 189, 248, 0.12);
  --secondary:      #818cf8; /* Electric Indigo */
  --accent:         #f472b6; /* Cyber Pink */
  
  --danger:         #f43f5e;
  --danger-light:   rgba(244, 63, 94, 0.12);
  --success:        #10b981;
  --success-light:  rgba(16, 185, 129, 0.12);
  --warning:        #f59e0b;
  --warning-light:  rgba(245, 158, 11, 0.12);

  /* Neutrals & Surfaces */
  --bg-page:        #0f172a; /* Deep Space */
  --bg-card:        rgba(30, 41, 59, 0.7); /* Glass Slate */
  --bg-input:       rgba(15, 23, 42, 0.6);
  --bg-sidebar:     #1e293b;
  
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --text-inverse:   #0f172a;

  --border:         rgba(255, 255, 255, 0.1);
  --border-focus:   #38bdf8;

  /* Glows & Shadows */
  --shadow-sm:      0 2px 4px rgba(0,0,0,0.2);
  --shadow-md:      0 8px 16px rgba(0,0,0,0.3);
  --shadow-lg:      0 12px 32px rgba(0,0,0,0.4);
  --glass-blur:     blur(12px);

  /* Dimensions */
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      20px;
  --radius-xl:      28px;
  
  /* Fonts */
  --font-ar:        'Cairo', sans-serif;
  --font-en:        'Outfit', sans-serif;
  --font:           var(--font-ar);
}

/* body is defined once below after the reset */

/* ---------------------------------------------------------------
   Reset
--------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family:      var(--font);
  background:       var(--bg-page);
  color:            var(--text-primary);
  direction:        rtl;
  line-height:      1.6;
  min-height:       100vh;
}

/* ---------------------------------------------------------------
   Custom Scrollbar (Premium Mac-Style)
--------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
  /* خفي وشفاف في الوضع العادي، لون أزرق خافت */
  background: rgba(56, 189, 248, 0.2); 
  border-radius: 10px;
  border: 3px solid var(--bg-page);
}

::-webkit-scrollbar-thumb:hover {
  /* يظهر ويضيء عندما يقترب الماوس منه */
  background: rgba(56, 189, 248, 0.8); 
}

::-webkit-scrollbar-thumb:active {
  background: var(--primary);
}

a  { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea {
  font-family: var(--font);
  font-size:   14px;
  outline:     none;
  direction:   rtl;
}

/* ---------------------------------------------------------------
   مكونات مشتركة
--------------------------------------------------------------- */

/* البطاقة */
.card {
  background:    var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border:        1px solid var(--border);
  border-radius: var(--radius-lg);
  padding:       1.5rem;
  box-shadow:    var(--shadow-md);
}

/* الأزرار */
.btn {
  display:         inline-flex;
  align-items:     center;
  gap:             8px;
  padding:         10px 20px;
  border-radius:   var(--radius-md);
  font-size:       14px;
  font-weight:     600;
  border:          none;
  transition:      background 0.2s, transform 0.1s, box-shadow 0.2s;
  white-space:     nowrap;
}
.btn:active { transform: scale(0.98); }

.btn-primary { 
  background: linear-gradient(135deg, var(--primary), var(--secondary)); 
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover { 
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
  opacity: 0.9;
}

.btn-secondary {
  background: var(--bg-input);
  color:      var(--text-primary);
  border:     1px solid var(--border);
  backdrop-filter: var(--glass-blur);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-ghost {
  background: transparent;
  color:      var(--text-secondary);
  border:     1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-input); color: var(--text-primary); }

.btn-sm  { padding: 6px 14px; font-size: 13px; }
.btn-lg  { padding: 13px 28px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }

.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after {
  content:       '';
  position:      absolute;
  width:         16px; height: 16px;
  border:        2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation:     spin 0.7s linear infinite;
}

/* حقول الإدخال */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.form-input {
  width:         100%;
  background:    var(--bg-input);
  border:        1px solid var(--border);
  border-radius: var(--radius-md);
  padding:       10px 14px;
  color:         var(--text-primary);
  font-size:     14px;
  transition:    border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
  border-color: var(--border-focus);
  box-shadow:   0 0 0 3px var(--primary-glow);
  background:   var(--bg-card);
}
.form-input.error { border-color: var(--danger); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-hint  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* الشارات */
.badge {
  display:       inline-block;
  padding:       3px 10px;
  border-radius: 20px;
  font-size:     12px;
  font-weight:   600;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger);  }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-muted   { background: var(--bg-input);      color: var(--text-muted); }

/* رسائل التنبيه */
.alert {
  padding:       12px 16px;
  border-radius: var(--radius-md);
  font-size:     14px;
  display:       flex;
  align-items:   center;
  gap:           10px;
  margin-bottom: 1rem;
}
.alert-error   { background: var(--danger-light);  color: #fca5a5; border: 1px solid rgba(244,63,94,0.3); }
.alert-success { background: var(--success-light); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.alert-info    { background: var(--primary-light); color: var(--primary);      border: 1px solid rgba(56,189,248,0.3); }

/* اللودر */
.spinner {
  width:  24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-lg { width: 48px; height: 48px; border-width: 4px; }

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: skeleton-slide 1.2s infinite;
  border-radius: var(--radius-md);
}

/* Modal */
.modal-overlay {
  position:    fixed; inset: 0;
  background:  rgba(0,0,0,0.5);
  z-index:     1000;
  display:     flex;
  align-items: center;
  justify-content: center;
  padding:     1rem;
  opacity:     0;
  transition:  opacity 0.2s;
  pointer-events: none;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background:    var(--bg-card);
  border-radius: var(--radius-xl);
  padding:       2rem;
  max-width:     520px;
  width:         100%;
  transform:     translateY(20px);
  transition:    transform 0.2s;
  max-height:    90vh;
  overflow-y:    auto;
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  margin-bottom:   1.5rem;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  background: var(--bg-input); border: none;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 18px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}

/* Divider */
.divider { height: 1px; background: var(--border); margin: 1rem 0; }

/* Grid مشترك */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr;     gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; }

/* Animations */
@keyframes spin          { to { transform: rotate(360deg); } }
@keyframes skeleton-slide { to { background-position: -200% 0; } }
@keyframes fadeIn        { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.3s ease forwards; }

/* Utilities */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.font-bold   { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }

/* Z-PACT Coin Icon */
.coin-icon {
  width:          22px;
  height:         22px;
  object-fit:     contain;
  vertical-align: middle;
  margin-bottom:  2px;
  display:        inline-block;
  flex-shrink:    0;
  clip-path:      circle(50%);  /* يقطع الزوايا البيضاء حتى لو الصورة مش transparent */
}

/* ===== Shared Notifications styles ===== */
.notif-bell {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.2s;
}
.notif-bell:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}
.notif-badge {
  position: absolute;
  top: 0px;
  right: 0px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: bold;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}
.notif-dropdown {
  position: absolute;
  top: 60px;
  left: 20px;
  width: 320px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 10px 25px rgba(0,0,0,0.4);
  display: none;
  flex-direction: column;
  z-index: 2000;
}
.notif-dropdown.show {
  display: flex;
}
.notif-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
}
.notif-list {
  max-height: 300px;
  overflow-y: auto;
}
.notif-item {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.2s;
}
.notif-item:hover {
  background: rgba(255, 255, 255, 0.03);
}
.notif-item.unread {
  border-right: 3px solid var(--primary);
  background: rgba(56, 189, 248, 0.02);
}

/* ===== Premium Z-PACT Navbar ===== */
.navbar {
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem; height: 72px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 1000;
}
.navbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary-glow), transparent);
}
.nav-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 26px; font-weight: 900; letter-spacing: -1px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(56,189,248,0.3));
}
.nav-links { display: flex; gap: 0.5rem; }
.nav-links a {
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  padding: 8px 16px; border-radius: var(--radius-md);
  transition: all 0.25s;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(56,189,248,0.08);
  color: var(--primary);
}
.nav-actions { display: flex; align-items: center; gap: 1rem; }

.coins-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(245,158,11,0.05));
  border: 1px solid rgba(245,158,11,0.3);
  padding: 4px 10px; border-radius: 20px;
  font-size: 13px; font-weight: 700; color: #f59e0b;
}
.user-pill {
  background: rgba(255,255,255,0.04);
  padding: 6px 16px; border-radius: 30px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); font-size: 13px;
}
