/* ================================================
   منصة العلوم التفاعلية — Mobile-First CSS
   ================================================ */

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

:root {
  --main:    #2d5a1b;
  --acc:     #4CAF50;
  --bg:      #f0f4f0;
  --white:   #ffffff;
  --text:    #1a1a1a;
  --muted:   #666666;
  --danger:  #e53935;
  --warning: #FF9800;
  --gold:    #FFD700;
  --radius:  14px;
  --nav-h:   64px;
  --shadow:  0 2px 12px rgba(0,0,0,0.1);
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ── Layout ── */
.app-wrapper {
  min-height: 100vh;
  padding-bottom: var(--nav-h);
  max-width: 480px;
  margin: 0 auto;
  background: var(--white);
  position: relative;
}

.page-content {
  padding: 16px;
}

/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-h);
  background: var(--white);
  border-top: 1px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  color: var(--muted);
  transition: all 0.2s;
  min-width: 56px;
  border: none;
  background: none;
}

.nav-item .nav-icon { font-size: 24px; line-height: 1; }
.nav-item .nav-label { font-size: 11px; font-weight: 500; }

.nav-item.active {
  color: var(--main);
  background: rgba(45,90,27,0.08);
}

/* ── Top Header ── */
.top-header {
  background: var(--main);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-header .page-title {
  color: var(--white);
  font-size: 18px;
  font-weight: 600;
}

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

/* ── Buttons ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  min-height: 48px;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--main); color: var(--white); }
.btn-primary:hover { background: #1b4010; }

.btn-success { background: var(--acc); color: var(--white); }
.btn-danger  { background: var(--danger); color: var(--white); }
.btn-outline {
  background: transparent;
  color: var(--main);
  border: 2px solid var(--main);
}

.btn-sm {
  width: auto;
  padding: 8px 16px;
  font-size: 14px;
  min-height: 40px;
}

/* ── Forms ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid rgba(0,0,0,0.15);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  direction: rtl;
  min-height: 48px;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--main);
}

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}

.stat-card .stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--main);
}

.stat-card .stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Alert / Badge ── */
.alert {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 12px;
}

.alert-warning { background: #fff8e1; color: #7a5000; border: 1px solid #ffe082; }
.alert-danger  { background: #fde8e8; color: #7f0000; border: 1px solid #ef9a9a; }
.alert-success { background: #e8f5e8; color: #1b5e20; border: 1px solid #a5d6a7; }
.alert-info    { background: #e3f2fd; color: #0d47a1; border: 1px solid #90caf9; }

/* ── List Items ── */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.list-item:last-child { border-bottom: none; }

.list-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--bg);
  flex-shrink: 0;
}

.list-info { flex: 1; min-width: 0; }
.list-title  { font-size: 15px; font-weight: 500; }
.list-sub    { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Stars ── */
.stars { color: var(--gold); letter-spacing: 2px; font-size: 16px; }

/* ── Progress Bar ── */
.progress-bar-wrap {
  background: rgba(0,0,0,0.08);
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 8px;
  background: var(--acc);
  transition: width 0.4s ease;
}

/* ── Currency ── */
.currency-row {
  display: flex;
  gap: 8px;
}

.currency-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.06);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty-state .empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-state .empty-title { font-size: 17px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.empty-state .empty-sub   { font-size: 14px; }

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  0%   { transform: scale(0.8); opacity: 0; }
  60%  { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

.fade-in  { animation: fadeInUp 0.3s ease; }
.pop-in   { animation: popIn 0.35s ease; }

/* ── Theme overrides (injected per teacher) ── */
.theme-forest { --main: #2d5a1b; --acc: #4CAF50; }
.theme-space  { --main: #1a237e; --acc: #3F51B5; }
.theme-ocean  { --main: #01579b; --acc: #0288d1; }
.theme-city   { --main: #4a148c; --acc: #7B1FA2; }

/* ── Tablet / bigger screens ── */
@media (min-width: 481px) {
  .app-wrapper { box-shadow: 0 0 30px rgba(0,0,0,0.1); }
  .bottom-nav  { left: 50%; transform: translateX(-50%); }
}
