/* ── Google Fonts ─────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;900&family=Tajawal:wght@300;400;500;700;900&display=swap');

/* ── CSS Custom Properties ────────────────────────────────────────────── */
:root {
  --gx-purple:       #3a0ca3;
  --gx-violet:       #7209b7;
  --gx-blue:         #4cc9f0;
  --gx-pink:         #f72585;
  --gx-dark:         #0a0015;
  --gx-dark2:        #110022;
  --gx-card-bg:      rgba(58, 12, 163, 0.18);
  --gx-border:       rgba(76, 201, 240, 0.25);
  --gx-text:         #e8e0ff;
  --gx-text-muted:   #9d8fc7;
  --gx-success:      #38e08a;
  --gx-warning:      #ffd166;
  --gx-danger:       #ef233c;
  --radius:          16px;
  --radius-lg:       24px;
  --shadow:          0 8px 32px rgba(114, 9, 183, 0.35);
  --shadow-lg:       0 16px 48px rgba(114, 9, 183, 0.55);
  --transition:      0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  font-family: 'Outfit', 'Tajawal', sans-serif;
  background: var(--gx-dark);
  color: var(--gx-text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Animated Background ──────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%,  rgba(114,9,183,0.35) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 90%,  rgba(58,12,163,0.45) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%,  rgba(76,201,240,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
  animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  from { opacity: 0.8; }
  to   { opacity: 1; }
}

/* ── Scrollbar ────────────────────────────────────────────────────────── */
::-webkit-scrollbar            { width: 6px; }
::-webkit-scrollbar-track      { background: var(--gx-dark2); }
::-webkit-scrollbar-thumb      { background: var(--gx-violet); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover{ background: var(--gx-blue); }

/* ── Typography ───────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.arabic { font-family: 'Tajawal', sans-serif; direction: rtl; text-align: right; }

/* ── Glass Card ───────────────────────────────────────────────────────── */
.glass {
  background: var(--gx-card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--gx-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.glass-lg {
  background: rgba(58, 12, 163, 0.22);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(76, 201, 240, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: 50px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gx-violet), var(--gx-purple));
  color: #fff;
  box-shadow: 0 4px 20px rgba(114, 9, 183, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(114, 9, 183, 0.65);
}

.btn-secondary {
  background: rgba(76, 201, 240, 0.12);
  color: var(--gx-blue);
  border: 1px solid rgba(76, 201, 240, 0.35);
}
.btn-secondary:hover {
  background: rgba(76, 201, 240, 0.22);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, #ef233c, #d00000);
  color: #fff;
  box-shadow: 0 4px 16px rgba(239, 35, 60, 0.4);
}
.btn-danger:hover { transform: translateY(-2px); }

.btn-success {
  background: linear-gradient(135deg, #38e08a, #059862);
  color: #fff;
  box-shadow: 0 4px 16px rgba(56, 224, 138, 0.35);
}
.btn-success:hover { transform: translateY(-2px); }

.btn-sm { padding: 8px 18px; font-size: 0.85rem; }
.btn-lg { padding: 16px 36px; font-size: 1.05rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Form Elements ────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gx-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input, .form-select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--gx-border);
  border-radius: 10px;
  color: var(--gx-text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--gx-blue);
  background: rgba(76, 201, 240, 0.08);
  box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.15);
}
.form-input::placeholder { color: var(--gx-text-muted); }
.form-select option { background: var(--gx-dark2); color: var(--gx-text); }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 4px;
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--gx-text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--gx-violet), var(--gx-purple));
  color: #fff;
  box-shadow: 0 4px 16px rgba(114, 9, 183, 0.4);
}
.tab-btn:hover:not(.active) { color: var(--gx-text); background: rgba(255,255,255,0.07); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeSlide 0.35s ease; }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Logo ─────────────────────────────────────────────────────────────── */
.gx-logo {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, var(--gx-blue), var(--gx-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gx-logo-img { height: 36px; object-fit: contain; }

/* ── Navbar ───────────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(10, 0, 21, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--gx-border);
  z-index: 1000;
}

.navbar-brand { display: flex; align-items: center; gap: 12px; }
.navbar-actions { display: flex; align-items: center; gap: 12px; }

/* ── Notification Bell ────────────────────────────────────────────────── */
.notif-bell {
  position: relative;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--gx-border);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.1rem;
}
.notif-bell:hover { background: rgba(76,201,240,0.15); border-color: var(--gx-blue); }

.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  background: var(--gx-pink);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--gx-dark);
  animation: pulseBadge 2s ease infinite;
  display: none;
}
@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}

/* ── Upload Zone ──────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--gx-border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--gx-blue);
  background: rgba(76, 201, 240, 0.06);
}
.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-icon { font-size: 2.5rem; margin-bottom: 12px; }

/* ── Stat Cards Grid ──────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.stat-section { padding: 24px; }

.stat-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gx-border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
}
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--gx-text-muted); font-size: 0.9rem; }
.stat-value {
  font-weight: 700;
  font-size: 1rem;
  color: var(--gx-blue);
}

/* ── Profile Header ───────────────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 90px; height: 90px;
  border-radius: 20px;
  object-fit: cover;
  border: 3px solid var(--gx-violet);
  box-shadow: 0 0 24px rgba(114, 9, 183, 0.5);
}

.profile-avatar-placeholder {
  width: 90px; height: 90px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--gx-violet), var(--gx-purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  border: 3px solid var(--gx-violet);
  box-shadow: 0 0 24px rgba(114, 9, 183, 0.5);
  flex-shrink: 0;
}

.profile-name { font-size: 1.6rem; font-weight: 900; margin-bottom: 4px; }
.profile-code {
  display: inline-block;
  padding: 3px 12px;
  background: rgba(76,201,240,0.15);
  border: 1px solid rgba(76,201,240,0.3);
  border-radius: 50px;
  font-size: 0.85rem;
  color: var(--gx-blue);
  font-weight: 600;
}

/* ── Alert / Toast ────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  padding: 14px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 9999;
  animation: slideInToast 0.4s ease;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.toast.success { background: rgba(56,224,138,0.15); border: 1px solid var(--gx-success); color: var(--gx-success); }
.toast.error   { background: rgba(239,35,60,0.15);  border: 1px solid var(--gx-danger);  color: var(--gx-danger); }
.toast.info    { background: rgba(76,201,240,0.15); border: 1px solid var(--gx-blue);    color: var(--gx-blue); }

@keyframes slideInToast {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Spinner ──────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--gx-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Main Layout ──────────────────────────────────────────────────────── */
.page-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 40px;
}

.page-main-top {
  min-height: 100vh;
  padding: 80px 24px 40px;
}

.container { width: 100%; max-width: 1200px; margin: 0 auto; }
.container-sm { width: 100%; max-width: 520px; margin: 0 auto; }

/* ── Notification Dropdown ────────────────────────────────────────────── */
.notif-dropdown {
  position: absolute;
  top: 56px; right: 0;
  width: 360px;
  background: var(--gx-dark2);
  border: 1px solid var(--gx-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  display: none;
  overflow: hidden;
}
.notif-dropdown.open { display: block; animation: fadeSlide 0.25s ease; }
.notif-header { padding: 16px 20px; border-bottom: 1px solid var(--gx-border); font-weight: 700; }
.notif-item {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex; gap: 14px; align-items: flex-start;
  cursor: pointer;
  transition: var(--transition);
}
.notif-item:hover { background: rgba(255,255,255,0.04); }
.notif-item.unread { border-left: 3px solid var(--gx-pink); }
.notif-meta { font-size: 0.8rem; color: var(--gx-text-muted); margin-top: 2px; }
.notif-empty { padding: 28px; text-align: center; color: var(--gx-text-muted); }

/* ── Admin Member Select ──────────────────────────────────────────────── */
.member-list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}
.member-list-item:hover { background: rgba(255,255,255,0.05); }
.member-list-item.selected {
  background: rgba(114,9,183,0.2);
  border-color: var(--gx-violet);
}
.member-list-avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--gx-purple);
}

/* ── Canvas Preview ───────────────────────────────────────────────────── */
#card-preview-canvas {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--gx-border);
  box-shadow: var(--shadow);
  display: block;
  margin: 0 auto;
}

/* ── Animations entry ─────────────────────────────────────────────────── */
.fade-in { animation: fadeIn 0.5s ease both; }
.slide-up { animation: slideUp 0.5s ease both; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .profile-header { flex-direction: column; text-align: center; }
  .tabs { flex-direction: column; }
  .notif-dropdown { width: 300px; right: -60px; }
}
