@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap");

/* ================= ROOT ================= */
:root {
  --bg: #454545;
  --bg-soft: #2a2929;
  --bg-card: #2a292976;

  --border: #444444;
  --shadow: rgba(255, 255, 255, .06);

  --text-main: #ffffff;
  --text-muted: #94a3b8;

  --accent: #707070;
  --success: #107600;
  --danger: #ff0000;

  --radius: 14px;
  --transition: .25s ease;
}

/* ================= GLOBAL ================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Cairo", sans-serif;
  background: linear-gradient(270deg, var(--bg-soft), var(--bg));
  color: var(--text-main);
  overflow-x: hidden;
}

i {
  color: #fff;
}

textarea {
  resize: vertical;
  min-height: 100px;
  outline: none;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

/* 2. مسار الشريط (الخلفية التي يتحرك عليها) */
::-webkit-scrollbar-track {
  background: var(--bg);
}

/* 3. المقبض (الجزء الرمادي الذي تمسكه) */
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 20px;
  border: 3px solid transparent;
  /* خدعة لعمل مسافة حول المقبض */
  background-clip: content-box;
  /* ضروري لعمل المسافة الشفافة */
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b5;
}

/* ================= ☰ MENU BUTTON (MOBILE) ================= */
.menu-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 3000;
  font-size: 22px;
  padding: 8px 12px;
  border-radius: 10px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-main);
  cursor: pointer;
}

.menu-toggle:hover {
  background: #3a3939;
}

/* ================= LAYOUT ================= */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ================= SIDEBAR ================= */
.sidebar {
  width: 260px;
  background: var(--bg-soft);
  padding: 22px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 2000;
}

.sidebar h2 {
  margin-bottom: 20px;
  flex: 0;
}

/* ================= MENU ================= */
.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: calc(8*var(--li-height));
  flex: 1;
  overflow-y: auto;
  flex-shrink: 0;
}

/* MENU ITEM */
.sidebar li {
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  --li-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar li:hover,
.sidebar li.active {
  background: #3a3939;
}

/* BRAND */
.sidebar-brand {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 15px;
  gap: 12px;
  margin-bottom: 10px;
}

.server-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.server-name {
  font-size: 18px;
  font-weight: 700;
}

/* ================= FOOTER ================= */
.nav-footer {
  flex-shrink: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  background: linear-gradient(to top var(--bg-soft) rgba(0, 0, 0, 0));
}

/* USER */
.sidebar-user {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* NAV LINKS */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-link {
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-main);
  background: none;
  font-weight: 600;
  transition: var(--transition);
}

.sidebar-link:hover {
  background: #3a3939;
}

.sidebar-link.success:hover {
  background: #107600;
}

.sidebar-link.red:hover {
  background: #ff0000;
}

/* ================= CONTENT ================= */
.content {
  flex: 1;
  padding: 30px;
  margin-right: 260px;
}

/* ================= SECTIONS ================= */
.section {
  padding: 20px 0;
}

.section-header h2 {
  margin: 0;
}

.section-header p {
  color: var(--text-muted);
  margin-top: 6px;
}

main section#home {
  display: block;
}

/* ================= GRID ================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

/* ================= CARD ================= */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  border: 1px solid var(--border);
  transition: var(--transition);
  margin: 5px;
}

.card button {
  width: 125px;
  padding: 10px 14px;
  font-size: 14px;
  display: inline-block;
  margin: 0 auto;
}

.card img {
  width: 88px;
  border-radius: 50%;
  margin-bottom: 10px;
}

/* ================= BADGES ================= */
.role-badges {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.role-icon {
  display: inline-block;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

/* OWNER */
.role-icon.owner {
  width: 36px;
  height: 36px;
  background-image: url("/ownership.png");

  position: relative;
  top: 9px;
  left: 10px;

  filter: drop-shadow(0 0 4px rgba(168, 168, 168, 0.7));
  animation: ownerGlow 2.6s ease-in-out infinite;
}

/* SUPER */
.role-icon.super {
  width: 17.9px;
  height: 17.9px;
  background-image: url("/superadmin.png");

  position: relative;
  top: 0.7px;
  right: 3.5px;

  filter: drop-shadow(0 0 4px rgba(168, 168, 168, 0.7));
  animation: superPulse 2.2s ease-in-out infinite;
}

/* ================= ANIMATIONS ================= */
@keyframes ownerGlow {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.12);
  }
}

@keyframes superPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

/* ================= OVERLAY ================= */
.sidebar-overlay {
  display: none;
}

/* ================= FORM ELEMENTS ================= */

/* Wrapper اختياري لو حبيت تستخدمه لاحقًا */
.form-group {
  margin-bottom: 14px;
  text-align: right;
}

/* TEXTAREA & INPUT & SELECT */
textarea,
input,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #020617, #020617);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

/* PLACEHOLDER */
textarea,
input::placeholder {
  color: var(--muted);
  opacity: .8;
}

/* FOCUS */
textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--shadow);
  background: #020617;
}

/* SELECT ARROW */
select {
  appearance: none;
  background: #020617;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 4px),
    calc(100% - 12px) calc(50% - 4px);
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

/* CHECKBOXES */
.perms label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 14px;
  cursor: pointer;
}

.perms input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* DISABLED */
textarea:disabled,
input:disabled,
select:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ================= SIDE ROLES ================= */
.side-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.side-role {
  background: #475569;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

/* ================= PERMISSIONS ================= */
.permissions-list {
  padding: 0;
  margin-top: 8px;
}

.permissions-list li {
  list-style: none;
  font-size: 14px;
  margin: 4px 0;
}

/* ================= SIDE ROLES LIST ================= */
#rolesList,
#sideRolesList {
  margin-top: 30px;
  background: var(--bg-soft);
}

/* REMOVE BTN */
.side-role-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-left: 12px;
  padding: 0;
  background: transparent;
  border: none;
  color: #f87171;
  font-size: 18px;
  cursor: pointer;
  border-radius: 8px;
  transition: .2s;
}

.side-role-remove:hover {
  background: rgba(248, 113, 113, .15);
  transform: scale(1.1);
}

.admin-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(180deg, #020617, #020617);
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  border: 1px solid #1f2937;
}

.admin-row-left {
  flex: 1;
}

.admin-role-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.admin-role-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px var(--shadow);
}

.admin-role-name {
  font-weight: 700;
}

.perm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.perm-chip {
  background: rgba(88, 101, 242, .15);
  border: 1px solid rgba(88, 101, 242, .35);
  color: #c7d2fe;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

.perm-empty {
  color: #94a3b8;
  font-size: 13px;
}

.admin-role-remove {
  background: transparent;
  border: none;
  color: #f87171;
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: 0.2s;
}

.admin-role-remove:hover {
  background: rgba(248, 113, 113, .15);
  transform: scale(1.08);
}

/* ================= HOME STATS ================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card h3 {
  margin-bottom: 14px;
}

.stat-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.stat-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.stat-list li:last-child {
  border-bottom: none;
}

.stat-list span {
  color: var(--muted);
}

.stat-list strong {
  font-size: 18px;
}

/* ===== GAMES ===== */
.game-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Games list */
.games-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

/* Game item */
.game-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  width: 245px;
  text-align: center;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 8px;
}

.game-item img {
  width: 100%;
  height: 185px;
  object-fit: cover;
  border-radius: 8px;
  transition: transform .2s ease, box-shadow .2s ease;
}

.game-item:hover img {
  transform: scale(1.07);
  box-shadow: 0 10px 20px var(--shadow);
}

.game-title {
  font-size: 18px;
  font-weight: 700;
}

.game-item strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
}

.game-item:hover strong {
  color: var(--text-main);
  animation: float .2s ease-in;
}

@keyframes float {

  from {
    opacity: 0;
    transform: translateY(0);
  }

  to {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.game-item .button {
  margin-top: auto;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
}

.button.danger {
  background: #ef4444;
  color: #fff;
  border: none;
}

.button.danger:hover {
  background: #dc2626;
}

/* ===== TEACHER TABS ===== */
.teacher-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.teacher-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: large;
  color: var(--text-muted);
  transition: .2s;
}

.teacher-tab:hover {
  background: #3a3939;
  color: var(--text-main);
}

.teacher-tab .tab-icon {
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.teacher-tab.active {
  background: #3a3939;
  color: var(--text-main);
  border-color: var(--border);
  font-weight: bold;
}

.teacher-tab.active .tab-icon {
  color: var(--text-main);
}

/* ===== TAB CONTENT ===== */
.teacher-tab-content {
  display: none;
  animation: fade-in .25s ease;
}

.teacher-tab-content.active {
  display: block;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================= CODING SECTION ================= */

/* =====================
   LAYOUT
===================== */
.edu-layout {
  display: flex;
  gap: 16px;
  min-height: 100vh;
}

/* =====================
   SIDEBAR
===================== */
.edu-sidebar {
  width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
}

.sidebar-header {
  margin-bottom: 16px;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 18px;
}

.sidebar-header small {
  color: var(--text-muted);
}

.sidebar-section {
  margin-bottom: 18px;
}

.sidebar-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-main);
}

.track-list,
.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lesson-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: background .2s, transform .15s, border-color .2s;
}

.lesson-item:hover {
  background: #3a3939;
  transform: translateX(2px);
}

.lesson-item::after {
  content: "";
  position: absolute;
  right: -13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}

.lesson-item.done {
  text-decoration: line-through;
  opacity: .6;
}

.lesson-item.active {
  border-color: #22c55e;
  background: linear-gradient(180deg, #2a2a2a, #1f1f1f);
  box-shadow: inset 0 0 0 1px #22c55e;
}

.lesson-item.active::after {
  background: #22c55e;
}

.lesson-item small {
  color: var(--text-muted);
  font-size: 11px;
}

.sidebar-footer {
  margin-top: auto;
}

.progress {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  text-align: center;
  color: var(--text-muted);
}

.progress-bar {
  height: 8px;
  background: #222;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: .3s ease;
}

/* =====================
   MAIN
===================== */
.edu-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* =====================
   LESSON HEADER
===================== */
.lesson-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}

.lesson-header h2 {
  margin: 0;
}

.lesson-lang {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #000;
  border: 1px solid #333;
  color: var(--text-muted);
}

.lesson-actions {
  display: flex;
  gap: 10px;
}

/* =====================
   LESSON CONTENT
===================== */
.lesson-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 15px;
  border-radius: 14px;
  padding: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.lesson-content code {
  background: #000;
  padding: 4px 6px;
  border-radius: 6px;
  color: #4ade80;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
}

.lesson-content pre {
  background: #000;
  padding: 12px;
  border-radius: 10px;
  overflow-x: auto;
  border-left: 4px solid #22c55e;
}

.lesson-content h3,
.lesson-content h4 {
  margin-top: 18px;
  margin-bottom: 8px;
}

.lesson-content ul {
  padding-left: 18px;
}

.lesson-content li {
  margin-bottom: 6px;
}

.track-progress-box {
  background: #0f172a;
  border: 1px solid #1e293b;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 15px;
}

.track-progress-box b {
  display: block;
  margin-bottom: 6px;
}

.track-progress-box div {
  font-size: 13px;
  color: #94a3b8;
}

.track-progress-bar {
  height: 8px;
  background: #1e293b;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 6px;
}

.track-progress-bar div {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: width 0.3s ease;
}

.lesson-body {
  margin-top: 10px;
}

/* =====================
   WORKSPACE (Monaco SAFE)
===================== */
.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-height: 420px;
}

/* =====================
   PANEL
===================== */
.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

/* Header — مهم */
.panel-header {
  height: 46px;
  min-height: 46px;
  max-height: 46px;
  background: var(--bg-soft);
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

/* Body */
.panel-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000;
}

/* =====================
   EDITOR (Monaco)
===================== */
.editor-panel {
  position: relative;
  z-index: 10;
}

.editor-panel .panel-body {
  background: #1e1e1e;
  padding: 0;
}

/* CodeMirror container */
#editor {
  height: 100%;
  min-height: 360px;
  background: #1e1e1e;
  border-radius: 0 0 14px 14px;
  overflow: hidden;
}

/* CodeMirror theme override */
.cm-editor {
  height: 100%;
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
}

.cm-content {
  caret-color: #22c55e;
}

.cm-gutters {
  background: #1e1e1e;
  border-right: 1px solid #333;
}

.editor-locked {
  background: var(--bg-soft);
  color: var(--text-main);
  cursor: not-allowed;
}

.success-box {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg-soft);
  border-left: 4px solid #22c55e;
  border-radius: 8px;
  animation: pop 0.4s ease;
}

@keyframes pop {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* =====================
   TERMINAL
===================== */
.terminal-content {
  padding: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  overflow-y: auto;
}

.terminal-content .comment {
  color: #4ade80;
}

.terminal-content .error {
  color: #ef4444;
}

.terminal-content .success {
  color: #22c55e;
}

/* =====================
   BUTTONS
===================== */
.run-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  color: var(--text-main);
  border: 1.7px solid #22c55e;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.run-btn:hover {
  background: #22c55e;
}

.tab-btn {
  background: none;
  color: #eee;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.tab-btn:hover {
  background: #3a3939;
}

/* =====================
   WORKSPACE MODES
===================== */
.workspace.max-editor {
  grid-template-columns: 1fr 0;
}

.workspace.max-terminal {
  grid-template-columns: 0 1fr;
}

.workspace.max-editor #terminalPanel,
.workspace.max-terminal #editorPanel {
  opacity: 0;
  pointer-events: none;
}

/* =====================
   QUIZ
===================== */
.quiz-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  overflow: hidden;
}

.quiz-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  margin-bottom: 12px;
  color: #e5e7eb;
}

.quiz-card h3 i {
  color: #22c55e;
}

.quiz-card p b {
  display: block;
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 14px;
  color: #f9fafb;
}

.quiz-box {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-choices label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.quiz-choices label:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* ================= RADIO ================= */
.quiz-choices input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #475569;
  background: transparent;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

/* hover */
.quiz-choices input[type="radio"]:hover {
  border-color: #22c55e;
}

/* focus (keyboard) */
.quiz-choices input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

/* النقطة الداخلية */
.quiz-choices input[type="radio"]::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: #22c55e;
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.2s ease;
}

/* checked */
.quiz-choices input[type="radio"]:checked {
  border-color: #22c55e;
}

.quiz-choices input[type="radio"]:checked::after {
  transform: scale(1);
}

/* ================= STATES ================= */

/* مقفل */
.quiz-choices input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.quiz-choices label.correct {
  background: rgba(34, 197, 94, 0.15);
  border-color: #22c55e;
  color: #22c55e;
}

.quiz-choices label.correct::after {
  content: "✔";
  margin-left: auto;
  font-weight: bold;
}

.quiz-choices label.wrong {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

.quiz-choices label.wrong::after {
  content: "✖";
  margin-left: auto;
  font-weight: bold;
}

.quiz-choices label.disabled {
  pointer-events: none;
  opacity: 0.7;
}

#quizResult {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  50% {
    transform: translateX(4px);
  }

  75% {
    transform: translateX(-4px);
  }

  100% {
    transform: translateX(0);
  }
}

/* =====================
   LOGS
===================== */
.logs-container {
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.logs-header {
  background: var(--bg-soft);
  color: var(--text-main);
  padding: 10px;
  display: grid;
  grid-template-columns: 100px 1fr 100px;
  font-weight: bold;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
  /* شريط تمرير إذا زادت السجلات */
}

.log-entry {
  display: grid;
  grid-template-columns: 100px 1fr 100px;
  padding: 10px;
  border-bottom: 1px solid var(--accent);
  animation: fadeIn 0.3s ease-in-out;
}

/* ألوان النصوص حسب نوع السجل */
.log-success {
  color: #28a745;
  border-right: 4px solid #28a745;
}

.log-warning {
  color: #d39e00;
  border-right: 4px solid #ffc107;
}

.log-error {
  color: #dc3545;
  border-right: 4px solid #dc3545;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================= TOAST SYSTEM ================= */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;

  display: flex;
  flex-direction: column;
  gap: 12px;

  pointer-events: none;
  /* يمنع حجب الضغط */
}

/* ===== TOAST BASE ===== */
.toast {
  pointer-events: auto;
  min-width: 260px;
  max-width: 360px;

  padding: 14px 16px;
  border-radius: 12px;

  color: #fff;
  font-size: 14px;
  line-height: 1.4;

  display: flex;
  align-items: center;
  gap: 12px;

  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.25),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);

  animation: toast-in 0.35s cubic-bezier(.21, .8, .35, 1);
}

/* ===== TYPES ===== */
.toast.success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.toast.error {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.toast.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.toast.info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* ===== ICON ===== */
.toast-icon {
  font-size: 20px;
  line-height: 1;
}

/* ===== CLOSE BUTTON ===== */
.toast-close {
  margin-left: auto;
  cursor: pointer;

  font-size: 16px;
  opacity: 0.75;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-close:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* ===== PROGRESS BAR (OPTIONAL) ===== */
.toast::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;

  height: 3px;
  width: 100%;

  background: none;
  animation: toast-life linear forwards;
}

/* ===== ANIMATIONS ===== */
@keyframes toast-in {
  from {
    transform: translateX(40px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-out {
  to {
    transform: translateX(40px);
    opacity: 0;
  }
}

@keyframes toast-life {
  from {
    width: 100%;
  }

  to {
    width: 0%;
  }
}

/* ================= FOOTER ================= */
.footer {
  text-align: center;
  padding: 20px;
  opacity: .4;
  font-size: 13px;
}

/* =====================
   RESPONSIVE
===================== */
@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }

  .toast::after {
    animation: none;
  }
}

@media (max-width: 900px) {

  .menu-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(100%);
    transition: var(--transition);
  }

  .nav-footer {
    padding-top: 0px;
    padding-bottom: 100px;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    z-index: 1500;
  }

  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .content {
    margin-right: 0;
    padding: 18px;
    padding-top: 70px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  /* Games list */
  .games-list {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    justify-items: center;
    gap: 14px;
  }

  /* Game item */
  .game-item {
    width: 100%;
    max-width: 345px;
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .game-item img {
    width: 100%;
    height: 185px;

  }

  .edu-layout {
    flex-direction: column;
  }

  .edu-sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .workspace {
    flex-direction: column;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  #toast-container {
    left: 12px;
    right: 12px;
    top: 12px;
  }

  .toast {
    max-width: 75%;
    font-size: 13px;
  }
}