/* Admin Dashboard Premium Style */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #a855f7;
  --primary-glow: rgba(168, 85, 247, 0.5);
  --secondary: #ec4899;
  --accent: #06b6d4;
  --bg-dark: #030014;
  --bg-card: rgba(10, 10, 30, 0.85);
  --border: rgba(168, 85, 247, 0.25);
  --border-glow: rgba(168, 85, 247, 0.5);
  --text: #f8fafc;
  --text-muted: #94a3b8;
}
body {
  font-family: 'Tajawal', sans-serif;
  background: var(--bg-dark);
  min-height: 100vh;
  color: var(--text);
  overflow-x: hidden;
}

/* Animated Gradient Background */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(236, 72, 153, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, #030014 0%, #0a0a1a 50%, #1a0a2e 100%);
  animation: gradientShift 15s ease infinite alternate;
}
@keyframes gradientShift { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(30deg); } }

/* Stars Background */
.stars-bg, .particles-bg { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.stars-bg span, .particles-bg span { 
  position: absolute; 
  border-radius: 50%; 
  background: rgba(168, 85, 247, 0.7); 
  animation: twinkle 4s infinite; 
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.9), 0 0 20px rgba(168, 85, 247, 0.4);
}
@keyframes twinkle { 
  0%, 100% { opacity: 0.3; transform: scale(0.8) translateY(0); } 
  50% { opacity: 1; transform: scale(1.4) translateY(-8px); } 
}

/* Sidebar - Glass Morphism */
.sidebar {
  position: fixed;
  right: 0;
  top: 0;
  width: 290px;
  height: 100vh;
  background: linear-gradient(180deg, rgba(10, 10, 30, 0.95) 0%, rgba(20, 10, 40, 0.98) 100%);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--border);
  padding: 30px 25px;
  z-index: 100;
  box-shadow: -10px 0 50px rgba(0, 0, 0, 0.5);
}
.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
  animation: borderGlow 3s linear infinite;
}
@keyframes borderGlow { 0%, 100% { opacity: 0.8; } 50% { opacity: 1; } }
.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 15px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 25px;
  text-decoration: none;
}
.sidebar .logo img {
  width: 55px;
  height: 55px;
  border-radius: 16px;
  border: 2px solid var(--primary);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px;
  box-shadow: 0 0 20px var(--primary-glow);
  transition: all 0.4s ease;
}
.sidebar .logo:hover img {
  transform: rotate(10deg) scale(1.1);
  box-shadow: 0 0 30px var(--primary-glow);
}
.sidebar .logo h2 {
  font-size: 1.4rem;
  font-weight: 900;
  background: linear-gradient(135deg, #a855f7, #ec4899, #06b6d4);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: textGradient 4s ease infinite;
}
@keyframes textGradient { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.sidebar nav ul { list-style: none; max-height: 60vh; overflow-y: auto; }
.sidebar nav ul::-webkit-scrollbar { width: 3px; }
.sidebar nav ul::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
.sidebar nav ul li { margin-bottom: 3px; }
.sidebar nav ul li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}
.sidebar nav ul li a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.4s;
  z-index: -1;
}
.sidebar nav ul li a:hover {
  color: white;
  transform: translateX(-5px);
  box-shadow: 0 5px 25px rgba(168, 85, 247, 0.3);
}
.sidebar nav ul li a:hover::before { opacity: 0.15; }
.sidebar nav ul li a.active {
  background: linear-gradient(135deg, #a855f7, #9333ea);
  color: white;
  box-shadow: 0 8px 30px rgba(168, 85, 247, 0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}
.sidebar nav ul li a i { width: 18px; text-align: center; font-size: 0.95rem; }

.sidebar .user-info {
  position: absolute;
  bottom: 25px;
  right: 25px;
  left: 25px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(236, 72, 153, 0.1));
  backdrop-filter: blur(10px);
  border-radius: 18px;
  border: 1px solid var(--border);
}
.sidebar .user-info .user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}
.sidebar .user-info .user img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  object-fit: cover;
  box-shadow: 0 0 15px var(--primary-glow);
}
.sidebar .user-info .user h4 { font-weight: 700; font-size: 1rem; }
.sidebar .user-info .user span { font-size: 0.8rem; color: var(--accent); }
.sidebar .user-info .logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.3));
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 12px;
  color: #f87171;
  text-decoration: none;
  font-weight: 700;
  transition: all 0.4s;
}
.sidebar .user-info .logout-btn:hover {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

/* Main Content */
.main-content {
  margin-right: 290px;
  padding: 40px 50px;
  position: relative;
  z-index: 2;
}
.page-header {
  margin-bottom: 40px;
}
.page-header h1 {
  font-size: 2.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fff, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-header h1 i { 
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-left: 10px;
}
.page-header p { color: var(--text-muted); font-size: 1rem; margin-top: 8px; }

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
  margin-bottom: 40px;
}
.stat-card {
  background: linear-gradient(145deg, rgba(20, 20, 40, 0.9), rgba(10, 10, 30, 0.95));
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.4s;
}
.stat-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 25px 60px rgba(168, 85, 247, 0.25);
}
.stat-card:hover::before { opacity: 1; }
.stat-card .icon {
  width: 65px;
  height: 65px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.stat-card .icon.purple { background: linear-gradient(135deg, #a855f7, #7c3aed); box-shadow: 0 10px 30px rgba(168, 85, 247, 0.4); }
.stat-card .icon.pink { background: linear-gradient(135deg, #ec4899, #be185d); box-shadow: 0 10px 30px rgba(236, 72, 153, 0.4); }
.stat-card .icon.blue { background: linear-gradient(135deg, #06b6d4, #0891b2); box-shadow: 0 10px 30px rgba(6, 182, 212, 0.4); }
.stat-card .icon.green { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4); }
.stat-card h3 { 
  font-size: 2.5rem; 
  font-weight: 900; 
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-card p { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; }

/* Table */
.table-container {
  background: linear-gradient(145deg, rgba(20, 20, 40, 0.9), rgba(10, 10, 30, 0.95));
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-responsive::-webkit-scrollbar { height: 6px; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
.table-responsive table { min-width: 800px; }
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 30px;
  border-bottom: 1px solid var(--border);
  background: rgba(168, 85, 247, 0.05);
}
.table-header h2 { 
  font-weight: 800; 
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.table-header h2 i { color: var(--primary); }
table { width: 100%; border-collapse: collapse; }
table thead th {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(236, 72, 153, 0.08));
  padding: 20px 25px;
  text-align: right;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}
table tbody tr {
  border-bottom: 1px solid rgba(168, 85, 247, 0.1);
  transition: all 0.4s;
}
table tbody tr:hover {
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.08), transparent);
}
table tbody td { padding: 20px 25px; font-size: 0.95rem; }

.badge {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge.success { 
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.3)); 
  color: #34d399;
}
.badge.danger { 
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.3)); 
  color: #f87171;
}
.badge.admin { 
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(147, 51, 234, 0.3)); 
  color: #c084fc;
}
.badge.guest { 
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.2), rgba(71, 85, 105, 0.3)); 
  color: #94a3b8;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary {
  background: linear-gradient(135deg, #a855f7, #9333ea);
  color: white;
  box-shadow: 0 5px 20px rgba(168, 85, 247, 0.3);
}
.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 35px rgba(168, 85, 247, 0.5);
}
.btn-secondary {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.3), rgba(71, 85, 105, 0.4));
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.5), rgba(71, 85, 105, 0.6));
}
.btn-edit {
  padding: 10px 22px;
  background: linear-gradient(135deg, #a855f7, #9333ea);
  border-radius: 12px;
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.4s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 5px 20px rgba(168, 85, 247, 0.3);
}
.btn-edit:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 35px rgba(168, 85, 247, 0.5);
}
.btn-delete {
  padding: 10px 22px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-radius: 12px;
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.4s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 5px 20px rgba(239, 68, 68, 0.3);
}
.btn-delete:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 35px rgba(239, 68, 68, 0.5);
}

/* Forms */
.form-container {
  background: linear-gradient(145deg, rgba(20, 20, 40, 0.9), rgba(10, 10, 30, 0.95));
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
  max-width: 800px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.form-group { margin-bottom: 25px; }
.form-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text);
}
.form-group label i { margin-left: 8px; color: var(--primary); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 16px 20px;
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: white;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.4s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.3);
  background: rgba(168, 85, 247, 0.12);
}
.form-group select { cursor: pointer; }
.form-group select option { background: #1a1a2e; color: white; }
.form-group textarea { min-height: 150px; resize: vertical; }
.btn-group { display: flex; gap: 15px; margin-top: 30px; }

/* Auto Mode Toggle */
.auto-mode-toggle {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(16, 185, 129, 0.1));
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 18px;
  margin-bottom: 25px;
  cursor: pointer;
  transition: all 0.4s;
}
.auto-mode-toggle:hover { background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.2)); }
.auto-mode-toggle.active { background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(16, 185, 129, 0.3)); border-color: #22c55e; }
.auto-mode-toggle input[type="checkbox"] { display: none; }
.toggle-switch { width: 50px; height: 26px; background: rgba(100, 100, 100, 0.5); border-radius: 13px; position: relative; transition: all 0.3s; flex-shrink: 0; }
.toggle-switch::after { content: ''; position: absolute; width: 22px; height: 22px; background: white; border-radius: 50%; top: 2px; left: 2px; transition: all 0.3s; }
.auto-mode-toggle.active .toggle-switch { background: linear-gradient(135deg, #22c55e, #10b981); }
.auto-mode-toggle.active .toggle-switch::after { left: 26px; }
.toggle-info h4 { color: #22c55e; font-size: 1.1rem; margin-bottom: 5px; }
.toggle-info p { color: var(--text-muted); font-size: 0.9rem; }
.auto-fields { display: none; padding: 25px; background: rgba(34, 197, 94, 0.05); border: 1px solid rgba(34, 197, 94, 0.2); border-radius: 18px; margin-bottom: 25px; }
.auto-fields.show { display: block; }
.auto-fields .form-group label { color: #22c55e; }

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(168, 85, 247, 0.4);
  transition: all 0.3s ease;
}
.mobile-menu-btn:hover {
  transform: scale(1.05);
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
  opacity: 1;
}

/* Responsive */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .sidebar-overlay {
    display: block;
    pointer-events: none;
  }
  .sidebar-overlay.active {
    pointer-events: auto;
  }
  .sidebar {
    position: fixed;
    right: -300px;
    top: 0;
    height: 100vh;
    width: 280px;
    z-index: 1000;
    transition: right 0.3s ease;
  }
  .sidebar.active {
    right: 0;
  }
  .main-content { 
    margin-right: 0; 
    padding: 25px;
    padding-top: 80px;
  }
}
