/* ======================================================
   لوحة تحكم أدمن وصلني الاحترافية | Professional Admin CSS
   تصميم مودرن واجهة ناعمة + Dark Glassmorphism + RTL
   ====================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --navy-900: #0a0a14;
  --navy-800: #121226;
  --navy-700: #1a1a36;
  --navy-600: #232348;
  --navy-500: #2e2e5c;
  
  --gold-500: #f59e0b;
  --gold-400: #fbbf24;
  --gold-300: #fcd34d;
  --gold-glow: rgba(245, 158, 11, 0.25);

  --white: #ffffff;
  --grey-100: #f3f4f6;
  --grey-300: #d1d5db;
  --grey-400: #9ca3af;
  --grey-500: #6b7280;
  --grey-700: #374151;

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.2);
  --warning: #f59e0b;
  --info: #3b82f6;

  --sidebar-width: 270px;
  --header-height: 70px;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --glass-bg: rgba(26, 26, 54, 0.7);
  --glass-border: rgba(245, 158, 11, 0.15);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Cairo', sans-serif;
  background: radial-gradient(circle at 10% 20%, rgba(245, 158, 11, 0.05) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
              var(--navy-900);
  color: var(--white);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Glassmorphism Card Utility */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-lg);
  padding: 48px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-emoji {
  font-size: 60px;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.logo-name {
  font-size: 36px;
  font-weight: 900;
  color: var(--white);
  letter-spacing: -0.5px;
}

.logo-sub {
  font-size: 14px;
  color: var(--gold-400);
  margin-top: 4px;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 13px;
  color: var(--gold-400);
  font-weight: 700;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
  text-align: right;
}

.form-group label {
  display: block;
  font-size: 14px;
  color: var(--gold-400);
  margin-bottom: 8px;
  font-weight: 700;
}

.form-control {
  width: 100%;
  padding: 14px 18px;
  background: rgba(18, 18, 38, 0.8);
  border: 1px solid var(--grey-700);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 15px;
  text-align: right;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 4px var(--gold-glow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  border: none;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  color: var(--navy-900);
  width: 100%;
  padding: 16px;
  font-size: 16px;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px var(--gold-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(245, 158, 11, 0.4);
}

.btn-success {
  background: var(--success-glow);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.btn-success:hover { background: rgba(16, 185, 129, 0.3); }

.btn-danger {
  background: var(--error-glow);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.3); }

.btn-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-400);
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.btn-warning:hover { background: rgba(245, 158, 11, 0.25); }

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(18, 18, 38, 0.95);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.brand-text .name { font-size: 22px; font-weight: 900; color: var(--white); }
.brand-text .sub { font-size: 11px; color: var(--gold-400); font-weight: 600; }

.sidebar-nav {
  flex: 1;
  padding: 20px 14px;
  overflow-y: auto;
}

.nav-label {
  font-size: 11px;
  color: var(--grey-500);
  font-weight: 800;
  text-transform: uppercase;
  padding: 12px 10px 6px;
  letter-spacing: 0.8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--grey-400);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  transition: var(--transition);
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--white);
}

.nav-item.active {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-400);
  border-right: 4px solid var(--gold-500);
}

.nav-item i { font-size: 18px; width: 22px; text-align: center; }

.nav-item .badge {
  margin-right: auto;
  background: var(--gold-500);
  color: var(--navy-900);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 800;
}

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--glass-border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gold-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: var(--navy-900);
}

.user-name { font-size: 14px; font-weight: 800; color: var(--white); }
.user-role { font-size: 11px; color: var(--gold-400); }

/* Main Content */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  height: var(--header-height);
  background: rgba(18, 18, 38, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 22px; font-weight: 900; color: var(--white); }
.topbar-subtitle { font-size: 13px; color: var(--grey-400); margin-top: 2px; }

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  background: var(--error-glow);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.logout-btn:hover { background: rgba(239, 68, 68, 0.3); }

/* Page Content */
.page-content {
  padding: 32px;
  flex: 1;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.stat-info { flex: 1; text-align: right; }
.stat-value { font-size: 32px; font-weight: 900; color: var(--gold-400); line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--grey-400); margin-top: 4px; font-weight: 600; }

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}
@media (max-width: 992px) { .charts-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.chart-title { font-size: 17px; font-weight: 800; color: var(--white); }
.chart-container { position: relative; height: 260px; }

/* Table Cards */
.table-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 32px;
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.table-title { font-size: 18px; font-weight: 800; color: var(--white); }
.table-subtitle { font-size: 13px; color: var(--grey-400); margin-top: 3px; }

.table-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.search-input {
  padding: 10px 16px;
  background: rgba(18, 18, 38, 0.8);
  border: 1px solid var(--grey-700);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 14px;
  min-width: 220px;
  text-align: right;
  outline: none;
  transition: var(--transition);
}
.search-input:focus { border-color: var(--gold-500); }

.filter-select {
  padding: 10px 16px;
  background: rgba(18, 18, 38, 0.8);
  border: 1px solid var(--grey-700);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 14px;
  text-align: right;
  outline: none;
  cursor: pointer;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  font-weight: 800;
  color: var(--grey-400);
  text-align: right;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

tbody td {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--grey-100);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  text-align: right;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
tbody tr:last-child td { border-bottom: none; }

.table-empty {
  text-align: center !important;
  padding: 48px 20px !important;
  color: var(--grey-400);
  font-size: 15px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.badge-success { background: var(--success-glow); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--gold-400); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger { background: var(--error-glow); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-grey { background: rgba(107, 114, 128, 0.15); color: var(--grey-400); border: 1px solid rgba(107, 114, 128, 0.3); }

.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--navy-800);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.7);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}
.modal-overlay.show .modal { transform: translateY(0); }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 18px; font-weight: 800; color: var(--white); }
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--grey-400);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--error-glow); color: var(--error); }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Spinner */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(245, 158, 11, 0.3);
  border-top-color: var(--gold-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Ads Grid */
.ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.ad-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition);
}
.ad-card:hover { transform: translateY(-3px); border-color: rgba(245, 158, 11, 0.4); }

.ad-emoji-box {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}

.ad-info { flex: 1; text-align: right; }
.ad-title { font-size: 16px; font-weight: 800; color: var(--white); }
.ad-sub { font-size: 13px; color: var(--grey-400); margin-top: 4px; }
.ad-actions { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }
