/* HMA Math Platform — Styling System */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800;900&family=Outfit:wght@400;600;700&display=swap');

:root {
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --border-color: rgba(255, 255, 255, 0.1);
  --primary: #10b981;
  --primary-hover: #059669;
  --accent-gold: #f59e0b;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --glass-bg: rgba(15, 23, 42, 0.85);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-ar: 'Cairo', sans-serif;
  --font-en: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.12) 0px, transparent 50%);
  color: var(--text-main);
  font-family: var(--font-ar);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--accent-blue));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.3rem;
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.nav-links {
  display: flex;
  gap: 8px;
  list-style: none;
}

.nav-item {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-item:hover, .nav-item.active {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  border-bottom: 2px solid var(--primary);
  color: var(--primary);
}

/* Main Container & Sections */
.main-container {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.tab-section {
  display: none;
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero & Profile Section */
.hero-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 4px solid var(--primary);
  background: linear-gradient(135deg, #1e293b, #334155);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--primary);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.hero-badges {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 2rem;
}

.badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.95rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge strong {
  color: var(--accent-gold);
}

.btn-whatsapp {
  background: #25d366;
  color: white;
  font-family: var(--font-ar);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 30px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-whatsapp:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(37, 211, 102, 0.5);
  background: #22bf5b;
}

/* Filters Component */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}

.filter-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

select, input[type="text"], input[type="file"] {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ar);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

select:focus, input:focus {
  border-color: var(--primary);
}

/* Grid & Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: rgba(16, 185, 129, 0.4);
}

.card-tag {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.card-tag.summary { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.card-tag.video { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.card-tag.notebook { background: rgba(16, 185, 129, 0.2); color: #34d399; }

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ar);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
  text-decoration: none;
  text-align: center;
  display: inline-block;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

/* Leaderboard Table */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.leader-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s ease;
}

.leader-item:hover {
  transform: translateX(-4px);
}

.leader-item.top-1 { border-color: var(--accent-gold); background: rgba(245, 158, 11, 0.08); }
.leader-item.top-2 { border-color: #94a3b8; background: rgba(148, 163, 184, 0.08); }
.leader-item.top-3 { border-color: #b45309; background: rgba(180, 83, 9, 0.08); }

.rank-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.05);
}

.top-1 .rank-badge { background: var(--accent-gold); color: black; }
.top-2 .rank-badge { background: #cbd5e1; color: black; }
.top-3 .rank-badge { background: #d97706; color: white; }

.student-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.points-pill {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 1rem;
}

/* Interactive Exam Engine Styles */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.question-points {
  color: var(--accent-gold);
  font-size: 0.9rem;
  font-weight: 700;
}

.option-box {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.option-box:hover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.05);
}

.option-box.selected {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.15);
}

/* Baskets & Matching */
.baskets-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.basket-box {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  min-height: 120px;
  background: rgba(15, 23, 42, 0.3);
}

.basket-title {
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 0.75rem;
  text-align: center;
}

.draggable-item {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: grab;
  user-select: none;
}

.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
}
