:root {
  --bg: #f5f7fb;
  --text: #222;
  --header-bg: #2196f3;
  --header-text: #fff;
  --card-bg: #fff;
  --footer-bg: #e3f2fd;
  --footer-text: #555;
  --border-shadow: rgba(0,0,0,0.1);
  --btn-secondary: #f0f0f0;
}

/* 🌙 Dark theme overrides */
[data-theme="dark"] {
  --bg: #121212;
  --text: #eaeaea;
  --header-bg: #1e1e1e;
  --header-text: #ffffff;
  --card-bg: #1c1c1c;
  --footer-bg: #1a1a1a;
  --footer-text: #aaa;
  --border-shadow: rgba(0,0,0,0.6);
  --btn-secondary: #2a2a2a;
}

/* === GLOBAL RESET === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Assistant', 'Alef', sans-serif;
  direction: rtl;
}


body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease, color 0.3s ease;
}

/* === HEADER === */
header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0.8rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-weight: bold;
  font-size: 1.5rem;
  text-decoration: none;
  color: var(--header-text);
  transition: opacity 0.2s ease;
}

.logo:hover {
  opacity: 0.9;
}

nav a {
  color: var(--header-text);
  margin: 0 0.5rem;
  text-decoration: none;
  font-weight: 500;
}
.theme-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  margin-right: 0.5rem;
  color: var(--header-text);
}

nav a:hover {
  text-decoration: underline;
}

/* === MAIN CONTENT === */
main {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

footer {
  text-align: center;
  padding: 1rem;
  background: var(--footer-bg);
  color: var(--footer-text);
  font-size: 0.9rem;
}

/* === BUTTONS === */
.btn {
  display: inline-block;
  margin: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
  text-decoration: none;
  text-align: center;
}

.btn.primary {
  background: #2196f3;
  color: #fff;
}

.btn.secondary {
  background: var(--btn-secondary);
  color: var(--text);
}

.btn.export {
  background: #ff9800;
  color: #fff;
}

.btn:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

/* === QUESTION BOX === */
.question-box {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px var(--border-shadow);
  margin: 1rem auto;
  width: 100%;
  max-width: 600px;
  text-align: right;
}

.question-box img {
  display: block;
  max-width: 100%;
  margin: 1rem 0;
  border-radius: 6px;
}

.answer {
  display: block;
  margin: 0.5rem 0;
}

.success {
  color: #2e7d32;
}

.error {
  color: #c62828;
}

/* === HOME PAGE === */
.home {
  text-align: center;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

/* === RESPONSIVE === */
@media (min-width: 600px) {
  .actions {
    flex-direction: row;
    justify-content: center;
  }

  nav a {
    margin: 0 1rem;
  }
}

/* === MESSAGE BOX / TOAST === */
#message-box {
  position: fixed;
  bottom: 20px;
  right: 50%;
  transform: translateX(50%);
  background: #323232;
  color: #fff;
  padding: 0.8rem 1.2rem;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, bottom 0.4s ease;
  z-index: 9999;
}

#message-box.show {
  opacity: 1;
  bottom: 40px;
}

/* color variations */
#message-box.success { background: #4caf50; }
#message-box.error { background: #f44336; }
#message-box.info { background: #2196f3; }


/* === TABLE STYLES === */
.table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
  text-align: right;
}

.table th, .table td {
  padding: 0.75rem;
  border: 1px solid #ddd;
}

.table th {
  background: var(--header-bg);
  color: var(--header-text);
  font-weight: 600;
}

.table tr {
  transition: background 0.2s ease;
}

.table tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.03);
}

.table tr.correct {
  background: #4caf50 !important;
  color: white;
}

.table tr.correct td {
  border-color: #4caf50;
}

.table img {
  max-width: 100%;
  height: auto;
  margin-top: 0.5rem;
  border-radius: 4px;
