/* ========== THEME (green, blue, white — no red) ========== */
:root {
  --green: #059669;
  --green-dark: #047857;
  --green-light: #d1fae5;
  --blue: #1d4ed8;
  --blue-dark: #1e40af;
  --blue-light: #dbeafe;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #cbd5e1;
  --bg: #f0f9ff;
  --white: #ffffff;
}

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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== HEADER ========== */
header {
  background: linear-gradient(135deg, var(--green) 0%, var(--blue) 100%);
  color: white;
  padding: 1.25rem 1rem;
}

.header-top {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

header h1 { font-size: 1.5rem; margin-bottom: 0.15rem; }
header p { font-size: 0.9rem; opacity: 0.92; }

.logout {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  width: auto;
  transition: background 0.2s;
}
.logout:hover { background: rgba(255,255,255,0.3); }

/* ========== MAIN ========== */
main {
  flex: 1;
  padding: 1rem;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.card {
  background: var(--white);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  margin-top: 1rem;
  border: 1px solid #e2e8f0;
}

.hidden { display: none !important; }

h2 { font-size: 1.3rem; margin-bottom: 0.75rem; color: var(--blue-dark); }
h3 { font-size: 1.05rem; margin: 1.25rem 0 0.5rem; color: var(--blue-dark); }

.muted { color: var(--text-muted); font-size: 0.92rem; }
.small { font-size: 0.85rem; }
.text-center { text-align: center; margin-top: 0.75rem; }

/* ========== AUTH TITLE ========== */
.auth-title { text-align: center; margin-bottom: 0.25rem; }

/* ========== SOCIAL BUTTONS ========== */
.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-bottom: 0.75rem;
  border: 2px solid transparent;
  transition: all 0.2s;
  font-family: inherit;
}

.social-icon {
  font-size: 1.1rem;
  font-weight: 700;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.phone-btn {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.phone-btn:hover { background: var(--green-dark); }

.google-btn {
  background: white;
  color: var(--blue-dark);
  border-color: var(--blue);
}
.google-btn:hover { background: var(--blue-light); }
.google-btn .social-icon {
  background: var(--blue);
  color: white;
  font-size: 0.85rem;
}

/* ========== DIVIDER ========== */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ========== TABS ========== */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  background: var(--blue-light);
  padding: 4px;
  border-radius: 10px;
}
.tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.6rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--blue-dark);
  cursor: pointer;
  width: auto;
  transition: all 0.2s;
  font-family: inherit;
}
.tab.active {
  background: var(--white);
  box-shadow: 0 2px 6px rgba(15,23,42,0.08);
}

/* ========== FIELDS ========== */
.field { margin-bottom: 1rem; }
label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
}

input, select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--white);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.2s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-light);
}

/* ========== BUTTONS ========== */
button {
  background: var(--green);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  transition: background 0.2s, transform 0.05s;
}
button:hover { background: var(--green-dark); }
button:active { transform: scale(0.99); }
button:disabled { background: #94a3b8; cursor: not-allowed; }

button.secondary {
  background: var(--blue);
  margin-top: 0.6rem;
}
button.secondary:hover { background: var(--blue-dark); }

/* ========== LINK BUTTONS ========== */
.link-btn {
  background: transparent;
  color: var(--blue);
  border: none;
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
  width: auto;
  font-weight: 600;
  font-family: inherit;
}
.link-btn:hover { background: transparent; color: var(--blue-dark); }

/* ========== MESSAGES ========== */
.message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.92rem;
}
.message.error {
  background: var(--amber-light);
  color: #92400e;
  border-left: 4px solid var(--amber);
}
.message.success {
  background: var(--green-light);
  color: var(--green-dark);
  border-left: 4px solid var(--green);
}
.message.info {
  background: var(--blue-light);
  color: var(--blue-dark);
  border-left: 4px solid var(--blue);
}

/* ========== QUIZ ========== */
.quiz-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

#question-text {
  font-size: 1.15rem;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.options { display: flex; flex-direction: column; gap: 0.7rem; }

.option {
  background: var(--blue-light);
  border: 2px solid #bfdbfe;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  color: var(--blue-dark);
  font-weight: 500;
  transition: all 0.15s;
  width: 100%;
}
.option:hover:not(:disabled) {
  background: #c7ddff;
  border-color: var(--blue);
}
.option:disabled { cursor: default; }

.option.correct {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green-dark);
  font-weight: 700;
}
.option.wrong {
  background: var(--amber-light);
  border-color: var(--amber);
  color: #92400e;
  font-weight: 700;
}

.explanation {
  margin-top: 1rem;
  padding: 1rem;
  background: #fffbeb;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  font-size: 0.94rem;
  color: #78350f;
}

#next-btn { margin-top: 1rem; }

/* ========== RESULT ========== */
#result-screen { text-align: center; }
.final-score {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0.75rem 0;
  color: var(--green);
}

/* ========== DASHBOARD ========== */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
}
.stat {
  background: var(--green-light);
  border-radius: 10px;
  padding: 0.9rem 0.5rem;
  text-align: center;
}
.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green-dark);
  line-height: 1.2;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.25rem;
}

.attempts-list { display: flex; flex-direction: column; gap: 0.6rem; }

.attempt {
  background: var(--blue-light);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.attempt-info { flex: 1; }
.attempt-subject {
  font-weight: 700;
  color: var(--blue-dark);
  font-size: 0.95rem;
}
.attempt-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.attempt-score {
  font-weight: 700;
  color: var(--green-dark);
  font-size: 1rem;
  white-space: nowrap;
}

.empty {
  padding: 1.25rem;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 10px;
  font-size: 0.92rem;
}

/* ========== FOOTER ========== */
footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (max-width: 420px) {
  .stats { gap: 0.5rem; }
  .stat-value { font-size: 1.2rem; }
  header h1 { font-size: 1.3rem; }
}
