/* AI Basics Course — mobile-first, no external assets. */

:root {
  --green: #1f7a5a;
  --green-dark: #145c43;
  --red: #c0392b;
  --amber: #e0a020;
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #666;
  --border: #d9dddb;
  --ur: #34506b;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--green);
  color: #fff;
}
.topbar-title {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { font-size: 14px; opacity: 0.9; }
.logout-btn {
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.logout-btn:active { background: rgba(255, 255, 255, 0.15); }

/* Bilingual auth screens (English + Urdu) */
.bi-heading { margin-bottom: 4px; }
.bi-heading h1 { margin-bottom: 0; }
.ur-line {
  font-size: 18px;
  color: var(--ur);
  margin-top: 2px;
}
label .lbl-en { display: block; }
label .lbl-ur {
  display: block;
  font-weight: 500;
  font-size: 14px;
  color: var(--ur);
  margin-top: 2px;
}
.btn-ur { display: block; font-size: 13px; font-weight: 500; opacity: 0.9; margin-top: 2px; }
.auth-switch { margin-top: 14px; font-size: 15px; text-align: center; }
.auth-switch a { color: var(--green); font-weight: 700; }
.ur-inline { color: var(--ur); }
.welcome { font-size: 17px; font-weight: 600; margin: 4px 0 8px; }
.welcome .ur-inline { color: var(--ur); }

/* Urdu-capable font stack (no webfont download; uses system fonts if present). */
[lang="ur"], .text-ur, .ur-line, .lbl-ur, .btn-ur, .ur-inline {
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", "Segoe UI", serif;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

/* Typography */
h1 { font-size: 24px; margin: 8px 0 4px; }
h2 { font-size: 20px; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 15px; }

/* Buttons — large touch targets */
.btn {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  margin: 12px 0 0;
  border: none;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn:active { background: var(--green-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--green); border: 2px solid var(--green); }
.btn-secondary:active { background: #eef5f1; }

/* Forms */
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font-size: 17px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
input[type="text"]:focus { outline: none; border-color: var(--green); }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
}
.module-card { display: block; text-decoration: none; color: inherit; }
.module-card:active { background: #f0f4f2; }
.module-card .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.module-title { font-size: 18px; font-weight: 700; margin: 0; }
.module-meta { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-pass { background: #e3f5ec; color: var(--green-dark); }
.badge-score { background: #fdf2d8; color: #8a6400; }
.badge-none { background: #eee; color: #777; }

/* Lesson blocks */
.block { margin: 14px 0; }
.block-text .en { font-size: 17px; }
.text-ur {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: var(--ur);
  direction: rtl;
  text-align: right;
}
.callout {
  border-left: 5px solid var(--amber);
  background: #fdf6e3;
  padding: 12px 14px;
  border-radius: 8px;
}
.callout .label { font-weight: 700; color: #8a6400; display: block; margin-bottom: 4px; }
.prompt-box {
  border: 2px dashed var(--green);
  background: #f2f9f5;
  border-radius: 10px;
  padding: 12px 14px;
}
.prompt-box .label { font-weight: 700; color: var(--green-dark); display: block; margin-bottom: 6px; }
.prompt-box .prompt-text { font-family: ui-monospace, "Courier New", monospace; font-size: 15px; }
.copy-btn {
  margin-top: 10px;
  min-height: 44px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* Task card */
.task-card { border: 2px solid var(--green); }
.task-card ol { margin: 8px 0 0; padding-left: 22px; }
.task-card li { margin-bottom: 8px; }
.task-tool { margin-top: 10px; font-size: 14px; color: var(--muted); }

/* Quiz */
.q-progress { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.q-text { font-size: 19px; font-weight: 700; margin-bottom: 12px; }
.option {
  display: block;
  width: 100%;
  min-height: 52px;
  text-align: left;
  padding: 14px 16px;
  margin: 10px 0;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 17px;
  cursor: pointer;
}
.option.selected { border-color: var(--green); background: #eef7f2; }

/* Results */
.result-score {
  text-align: center;
  font-size: 40px;
  font-weight: 800;
  margin: 8px 0 4px;
}
.result-verdict { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.result-pass { color: var(--green); }
.result-fail { color: var(--red); }
.result-item {
  border: 1px solid var(--border);
  border-left: 6px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
}
.result-item.correct { border-left-color: var(--green); }
.result-item.wrong { border-left-color: var(--red); }
.result-mark { font-weight: 700; }
.result-mark.correct { color: var(--green); }
.result-mark.wrong { color: var(--red); }
.result-explain { font-size: 15px; color: var(--muted); margin-top: 4px; }

.center { text-align: center; }
.error { color: var(--red); font-weight: 600; margin-top: 8px; }
.spacer { height: 8px; }

/* Reading views (register / module / quiz / result) stay a comfortable column. */
.reading { max-width: 680px; margin: 0 auto; }
.module-grid { display: block; }

/* ---------------------------------------------------------------------------
   Desktop / laptop layer. Mobile styles above are the base; these only add on
   at wider widths, so the phone experience is unchanged.
   --------------------------------------------------------------------------- */
@media (min-width: 760px) {
  body { font-size: 18px; }

  .topbar { padding: 16px 32px; }
  .topbar-title { font-size: 22px; }
  .topbar-user { font-size: 16px; }

  .app { max-width: 1040px; padding: 28px 32px 64px; }
  .wide { max-width: 1040px; margin: 0 auto; }

  h1 { font-size: 30px; }

  /* Modules as a responsive card grid instead of a single column. */
  .module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
    margin-top: 16px;
  }
  .module-grid .card { margin: 0; }

  /* Mouse hover cues (phones don't have hover). */
  .module-card { transition: box-shadow 0.12s, transform 0.12s; }
  .module-card:hover {
    box-shadow: 0 6px 18px rgba(20, 92, 67, 0.15);
    transform: translateY(-2px);
    border-color: var(--green);
  }
  .btn { transition: background 0.12s; }
  .btn:hover { background: var(--green-dark); }
  .option { transition: border-color 0.12s, background 0.12s; }
  .option:hover { border-color: var(--green); }

  /* Buttons need not span the whole reading column on a big screen. */
  .reading .btn { max-width: 340px; }
  .reading .btn + .btn { margin-top: 12px; }
}

@media (min-width: 1100px) {
  /* On a projector / big laptop, give the module grid a third column. */
  .module-grid { grid-template-columns: repeat(3, 1fr); }
}
