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

:root {
  --brand-blue: #1f4ea8;
  --brand-red:  #e33d44;
  --brand-purple: #7a2c8d;
  --brand-gradient: linear-gradient(135deg, #1f4ea8, #7a2c8d, #e33d44);

  --primary: var(--brand-blue);
  --primary-dark: #153a7c;
  --accent: var(--brand-red);
  --accent-secondary: #9a3fb3;
  --accent-soft: rgba(227, 61, 68, 0.08);

  --success: #24a36e;
  --warning: #f0b429;
  --danger: var(--brand-red);

  --bg: #f6f8fc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #5b6070;
  --border: #e4e7f0;
  --shadow: 0 12px 32px rgba(31, 78, 168, 0.15);
  --radius: 16px;
  --transition: 0.25s ease;
}

[data-theme="dark"] {
  --bg: #0b1324;
  --surface: #101a2d;
  --text: #e9eef8;
  --muted: #9ea9c5;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.6);

  --primary: #6ea0ff;
  --primary-dark: #4d7acc;
  --accent: #ff7a8c;
  --accent-secondary: #c27be1;
  --accent-soft: rgba(255, 122, 140, 0.14);

  --success: #4ade80;
  --warning: #facc15;
  --danger: #ff8fa3;
}

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

body {
  direction: rtl;
  text-align: right;
  margin: 0;
  font-family: 'Cairo', 'Tajawal', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background var(--transition), color var(--transition);
}

body[data-protect="student"] { user-select: none; }
body[data-protect="student"] input,
body[data-protect="student"] textarea { user-select: text; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

header {
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px 0;
  position: sticky;
  top: 0;
  z-index: 20;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.container { width: min(1200px, 94%); margin: 0 auto; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--primary); }
.logo-img { height: 44px; width: auto; }

.nav-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  border: none;
  cursor: pointer;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
}
.btn-primary { background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow); }
.btn-secondary { background: linear-gradient(135deg, var(--accent-secondary), var(--primary)); color: #fff; border: 1px solid rgba(0,0,0,0.05); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn:hover { transform: translateY(-2px) scale(1.01); }
.btn:active { transform: translateY(0); }

.hero { padding: 70px 0 60px; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 60px; align-items: center; }
.hero-card { background: var(--surface); border-radius: 24px; padding: 28px; box-shadow: var(--shadow); border: 1px solid var(--border); position: relative; overflow: hidden; }
.hero h1 { font-size: 34px; margin: 0 0 12px; }
.hero p { color: var(--muted); line-height: 1.8; margin: 0 0 18px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; }

.section { padding: 40px 0; }
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.card:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 14px 32px rgba(0, 0, 0, 0.14); }

.card-title { font-weight: 800; margin: 0 0 8px; }
.card-meta { color: var(--muted); font-size: 13px; }

.status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; font-weight: 800; font-size: 13px; }
.status.pending { background: rgba(240, 180, 41, 0.18); color: #b7791f; }
.status.approved { background: rgba(36, 163, 110, 0.18); color: #177d55; }
.status.rejected { background: rgba(227, 61, 68, 0.16); color: var(--danger); }
[data-theme="dark"] .status.pending { background: rgba(250, 204, 21, 0.16); color: #facc15; }
[data-theme="dark"] .status.approved { background: rgba(74, 222, 128, 0.14); color: #4ade80; }
[data-theme="dark"] .status.rejected { background: rgba(255, 143, 163, 0.16); color: #ff9fb1; }

.month-card { display: flex; flex-direction: column; gap: 10px; background: linear-gradient(145deg, rgba(31,78,168,0.10), rgba(122,44,141,0.10)); }
.month-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.month-icon { font-size: 26px; margin-bottom: 4px; }
.lock { color: #d62828; font-weight: 700; }
.unlock { color: #0b8f4d; font-weight: 700; }

.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 14px; text-align: right; border-bottom: 1px solid rgba(0, 0, 0, 0.05); }
.table th { background: rgba(31, 78, 168, 0.08); color: var(--text); font-weight: 800; position: relative; }
.table th::after { content: ""; position: absolute; left: 8px; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-secondary); transform: translateY(-50%); }
[data-theme="dark"] .table th { background: rgba(255, 255, 255, 0.05); }

form { display: grid; gap: 12px; }
label { font-weight: 700; color: var(--text); }
input, select { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(0, 0, 0, 0.08); background: var(--surface); color: var(--text); }
input:focus, select:focus { outline: 2px solid var(--primary); border-color: transparent; }

.dashboard { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); box-shadow: var(--shadow); padding: 22px 18px; display: grid; gap: 10px; position: sticky; top: 0; height: 100vh; }
.sidebar a { padding: 12px; border-radius: var(--radius); color: var(--text); font-weight: 700; transition: background var(--transition), color var(--transition); }
.sidebar a:hover, .sidebar a.active { background: rgba(31, 78, 168, 0.12); color: var(--primary); }
.content { padding: 28px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat-card { padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--border); position: relative; overflow: hidden; }
.stat-card:nth-child(1) { background: linear-gradient(135deg, rgba(31,78,168,0.16), rgba(255,255,255,0.7)); }
.stat-card:nth-child(2) { background: linear-gradient(135deg, rgba(122,44,141,0.18), rgba(255,255,255,0.7)); }
.stat-card:nth-child(3) { background: linear-gradient(135deg, rgba(227,61,68,0.18), rgba(255,255,255,0.7)); }
.stat-card:nth-child(4) { background: linear-gradient(135deg, rgba(31,78,168,0.16), rgba(255,255,255,0.7)); }
.stat-icon { position: absolute; left: 12px; top: 12px; font-size: 22px; opacity: 0.85; }
.badge { background: rgba(15, 122, 201, 0.1); color: var(--primary-dark); padding: 6px 10px; border-radius: 12px; font-size: 12px; font-weight: 800; }

.toggle { width: 46px; height: 24px; border-radius: 999px; background: var(--bg); border: 1px solid rgba(0, 0, 0, 0.1); display: inline-flex; align-items: center; padding: 3px; position: relative; cursor: pointer; transition: background var(--transition), border var(--transition); }
.toggle .thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--primary); transition: transform var(--transition), background var(--transition); }
[data-theme="dark"] .toggle .thumb { transform: translateX(20px); }

.video-wrapper { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
iframe { width: 100%; border: none; aspect-ratio: 16 / 9; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.note { padding: 12px 14px; border-radius: var(--radius); background: rgba(15, 122, 201, 0.08); color: var(--primary-dark); font-weight: 700; border: 1px solid var(--border); }

.math-icon { font-size: 22px; }

[data-theme="dark"] header { box-shadow: var(--shadow); }

/* إضافات حيوية */
.btn-pill { border-radius: 999px; padding-inline: 18px; }
.search-bar { margin-bottom: 12px; display: flex; gap: 10px; align-items: center; }
.search-bar input { flex: 1; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); }

.progress { width: 100%; background: rgba(0,0,0,0.05); border-radius: 999px; overflow: hidden; height: 10px; position: relative; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--brand-blue), var(--brand-purple), var(--brand-red)); width: 0%; transition: width 0.4s ease; }
.badge-fun { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 14px; background: rgba(122, 44, 141, 0.15); color: var(--brand-purple); font-weight: 800; font-size: 12px; }
.badge-fun .emoji { font-size: 15px; }

.bounce:hover { animation: bounce 0.4s ease; }
@keyframes bounce {
  0% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
  70% { transform: translateY(0); }
  90% { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

.notif { display: grid; gap: 8px; padding: 12px; border-radius: var(--radius); background: rgba(34,211,238,0.12); border: 1px dashed rgba(31,78,168,0.25); }
.notif-item { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.notif-item .emoji { font-size: 18px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  header { position: static; }
}
