/* ====================================================
   Turkish Quiz — Main Stylesheet
   Font: Nunito (headings), Outfit (body)
   Theme: warm cream + orange accent
   ==================================================== */

:root {
  --bg:         #f5f0eb;
  --card:       #ffffff;
  --border:     #e2d9cf;
  --orange:     #e8722a;
  --orange-lt:  #fef3eb;
  --orange-dk:  #c45e1e;
  --text-dark:  #1a1a1a;
  --text-mid:   #555;
  --text-light: #888;
  --green:      #34c759;
  --red:        #ff3b30;
  --blue:       #007aff;
  --gold:       #f5a623;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.06);
  --shadow-md:  0 6px 24px rgba(0,0,0,.10);
  --shadow-lg:  0 16px 48px rgba(0,0,0,.14);
  --radius-sm:  10px;
  --radius-md:  18px;
  --radius-lg:  28px;
  --transition: .18s cubic-bezier(.4,0,.2,1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.6;
}

/* ---- NAVBAR ---- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  display: flex; align-items: center; gap: .55rem;
  text-decoration: none;
}
.brand-flag { font-size: 1.3rem; }
.brand-name {
  font-family: 'Nunito', sans-serif;
  font-weight: 800; font-size: 1.1rem;
  color: var(--text-dark);
}

.navbar-actions {
  display: flex; align-items: center; gap: .6rem;
}

.credits-badge {
  display: flex; align-items: center; gap: .3rem;
  background: var(--orange-lt);
  border: 1.5px solid #f5d3b0;
  border-radius: 50px;
  padding: .28rem .75rem;
  font-weight: 700; font-size: .9rem;
  color: var(--orange-dk);
}
.credits-icon { font-size: 1rem; }

.nav-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .38rem .85rem;
  border-radius: 50px;
  font-size: .88rem; font-weight: 600;
  color: var(--text-mid);
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: var(--transition);
}
.nav-btn:hover {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text-dark);
}
.nav-btn-admin { color: var(--orange); }
.nav-btn-logout {
  font-size: 1.1rem;
  padding: .38rem .65rem;
}

/* ---- MAIN CONTENT ---- */
.main-content {
  min-height: calc(100vh - 60px);
  padding: 2rem 1rem 4rem;
}

/* ---- CARD ---- */
.card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ---- GRADE SELECTION ---- */
.grade-wrapper {
  max-width: 740px; margin: 0 auto;
  padding: 3rem 2.5rem 3.5rem;
  text-align: center;
}
.grade-icon { font-size: 2.8rem; margin-bottom: 1rem; }
.grade-title {
  font-family: 'Nunito', sans-serif;
  font-size: 2rem; font-weight: 900;
  color: var(--text-dark); margin-bottom: .4rem;
}
.grade-sub { color: var(--text-light); font-size: .97rem; margin-bottom: 2.2rem; }

.grade-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}

.grade-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  cursor: pointer; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; gap: .7rem;
  transition: var(--transition);
  color: var(--text-dark);
}
.grade-card:hover {
  border-color: var(--orange);
  box-shadow: 0 8px 30px rgba(232,114,42,.15);
  transform: translateY(-3px);
}
.grade-card-emoji { font-size: 2.8rem; }
.grade-card-name {
  font-family: 'Nunito', sans-serif;
  font-size: 1.15rem; font-weight: 800;
}
.grade-card-sub { color: var(--text-light); font-size: .83rem; }

/* ---- UNIT LIST ---- */
.unit-wrapper {
  max-width: 620px; margin: 0 auto;
  padding: 2.5rem 2rem 3rem;
}
.back-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--text-mid); font-size: .88rem;
  text-decoration: none; margin-bottom: 1.5rem;
  transition: var(--transition);
}
.back-btn:hover { color: var(--orange); }

.unit-header { margin-bottom: 1.8rem; }
.unit-header h1 {
  font-family: 'Nunito', sans-serif;
  font-size: 1.7rem; font-weight: 900;
}
.unit-list { display: flex; flex-direction: column; gap: .7rem; }

.unit-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.3rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none;
  color: var(--text-dark);
  transition: var(--transition);
  background: var(--card);
}
.unit-item:hover {
  border-color: var(--orange);
  background: var(--orange-lt);
}
.unit-item-left { display: flex; align-items: center; gap: .8rem; }
.unit-num {
  width: 32px; height: 32px;
  background: var(--bg);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  color: var(--orange);
}
.unit-name { font-weight: 600; font-size: .95rem; }
.unit-levels { font-size: .8rem; color: var(--text-light); }
.unit-arrow { color: var(--text-light); font-size: 1rem; }

/* ---- LEVEL LIST ---- */
.level-list { display: flex; flex-direction: column; gap: .6rem; }
.level-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.3rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none;
  color: var(--text-dark); background: var(--card);
  transition: var(--transition);
}
.level-item:hover {
  border-color: var(--orange);
  background: var(--orange-lt);
}
.level-badge {
  background: var(--orange);
  color: #fff;
  border-radius: 6px;
  padding: .15rem .55rem;
  font-size: .78rem; font-weight: 700;
}
.level-star { color: var(--gold); font-size: .9rem; }

/* ---- QUIZ ---- */
.quiz-wrapper {
  max-width: 680px; margin: 0 auto;
  padding: 2rem 2rem 3rem;
}
.quiz-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.quiz-progress-bar {
  flex: 1; height: 8px;
  background: var(--bg);
  border-radius: 50px;
  overflow: hidden;
  margin: 0 1rem;
}
.quiz-progress-fill {
  height: 100%; background: var(--orange);
  border-radius: 50px;
  transition: width .4s ease;
}
.quiz-q-count { font-size: .85rem; color: var(--text-light); font-weight: 600; }
.quiz-timer {
  font-size: .85rem; font-weight: 700;
  color: var(--orange);
  min-width: 42px; text-align: right;
}
.quiz-timer.urgent { color: var(--red); animation: pulse .5s infinite alternate; }

@keyframes pulse { from { opacity: 1; } to { opacity: .5; } }

.quiz-card { padding: 2.5rem 2rem 2rem; text-align: center; }
.quiz-question-label {
  font-size: .8rem; color: var(--text-light);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: .6rem; font-weight: 600;
}
.quiz-word {
  font-family: 'Nunito', sans-serif;
  font-size: 2.4rem; font-weight: 900;
  color: var(--text-dark);
  margin-bottom: .4rem;
}
.quiz-hint { font-size: .88rem; color: var(--text-light); margin-bottom: 2rem; }

.quiz-options {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: .8rem;
}
.quiz-option {
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem; font-weight: 600;
  background: var(--card);
  color: var(--text-dark);
  transition: var(--transition);
  text-align: center;
}
.quiz-option:hover:not([disabled]) {
  border-color: var(--orange);
  background: var(--orange-lt);
}
.quiz-option.correct {
  border-color: var(--green);
  background: #eafaf0;
  color: #1a7a3a;
}
.quiz-option.wrong {
  border-color: var(--red);
  background: #fff0f0;
  color: var(--red);
}
.quiz-option[disabled] { cursor: not-allowed; }

.quiz-feedback {
  margin-top: 1.2rem;
  font-size: .95rem; font-weight: 600;
  min-height: 1.4em;
}
.quiz-feedback.correct-fb { color: var(--green); }
.quiz-feedback.wrong-fb   { color: var(--red); }

/* ---- RESULT ---- */
.result-wrapper {
  max-width: 500px; margin: 0 auto;
  padding: 3rem 2rem 4rem;
  text-align: center;
}
.result-icon { font-size: 4rem; margin-bottom: 1rem; }
.result-title {
  font-family: 'Nunito', sans-serif;
  font-size: 1.8rem; font-weight: 900;
  margin-bottom: .4rem;
}
.result-sub { color: var(--text-mid); margin-bottom: 2rem; }
.result-stats {
  display: flex; gap: 1rem;
  justify-content: center; margin-bottom: 2rem;
}
.result-stat {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.4rem;
  text-align: center;
}
.result-stat-val {
  font-family: 'Nunito', sans-serif;
  font-size: 1.8rem; font-weight: 900;
  color: var(--orange);
}
.result-stat-label { font-size: .78rem; color: var(--text-light); font-weight: 600; }
.credits-earned-box {
  background: var(--orange-lt);
  border: 1.5px solid #f5d3b0;
  border-radius: var(--radius-md);
  padding: 1.2rem;
  margin-bottom: 2rem;
  font-size: 1rem; font-weight: 700;
  color: var(--orange-dk);
}

/* ---- AUTH FORMS ---- */
.auth-wrapper {
  max-width: 420px; margin: 3rem auto;
  padding: 2.5rem 2rem;
}
.auth-title {
  font-family: 'Nunito', sans-serif;
  font-size: 1.7rem; font-weight: 900;
  text-align: center; margin-bottom: .3rem;
}
.auth-sub {
  color: var(--text-light); text-align: center;
  font-size: .9rem; margin-bottom: 2rem;
}
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block; font-size: .83rem; font-weight: 700;
  color: var(--text-mid); margin-bottom: .35rem;
  text-transform: uppercase; letter-spacing: .04em;
}
.form-input {
  width: 100%; padding: .7rem .95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: .96rem;
  background: var(--card);
  color: var(--text-dark);
  transition: var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,114,42,.12);
}
.form-input.error { border-color: var(--red); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem;
  padding: .75rem 1.5rem;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-size: .96rem; font-weight: 800;
  cursor: pointer; border: none;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--orange);
  color: #fff;
}
.btn-primary:hover {
  background: var(--orange-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(232,114,42,.35);
}
.btn-secondary {
  background: var(--bg);
  color: var(--text-dark);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover {
  background: var(--border);
}
.btn-full { width: 100%; }
.btn-sm { padding: .45rem 1rem; font-size: .84rem; }
.btn-danger { background: var(--red); color: #fff; }

.auth-link { text-align: center; margin-top: 1.2rem; font-size: .88rem; color: var(--text-light); }
.auth-link a { color: var(--orange); font-weight: 700; text-decoration: none; }

.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600;
  margin-bottom: 1rem;
}
.alert-error   { background: #fff0f0; border: 1px solid #ffb3b3; color: var(--red); }
.alert-success { background: #eafaf0; border: 1px solid #9fe5b8; color: #1a7a3a; }
.alert-info    { background: var(--orange-lt); border: 1px solid #f5d3b0; color: var(--orange-dk); }

/* ---- SHOP ---- */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.2rem;
}
.shop-item {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}
.shop-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.shop-item-img {
  width: 100%; height: 140px;
  object-fit: cover;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
}
.shop-item-body { padding: 1rem; }
.shop-item-name { font-weight: 700; margin-bottom: .3rem; }
.shop-item-price {
  display: inline-flex; align-items: center; gap: .3rem;
  color: var(--orange); font-weight: 800;
  font-size: .95rem;
}
.shop-item-stock { font-size: .78rem; color: var(--text-light); margin-top: .2rem; }
.shop-item-btn { margin-top: .8rem; }

/* ---- LEADERBOARD ---- */
.lb-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
}
.lb-table {
  width: 100%; border-collapse: collapse;
  font-size: .9rem;
}
.lb-table thead th {
  background: var(--bg);
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 700; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-light);
  border-bottom: 1.5px solid var(--border);
}
.lb-table tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--bg);
}
.lb-table tbody tr:last-child td { border-bottom: none; }
.lb-table tbody tr:hover td { background: var(--orange-lt); }
.rank-1 { color: #f5a623; font-weight: 900; }
.rank-2 { color: #aaa; font-weight: 800; }
.rank-3 { color: #cd7f32; font-weight: 800; }

/* ---- ADMIN ---- */
.admin-layout { display: flex; min-height: calc(100vh - 60px); }
.admin-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--text-dark);
  padding: 1.5rem 0;
}
.admin-sidebar-title {
  color: #aaa; font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  padding: 0 1.2rem .8rem;
}
.admin-nav-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1.2rem;
  color: #ccc; text-decoration: none;
  font-size: .9rem; font-weight: 500;
  transition: var(--transition);
}
.admin-nav-link:hover, .admin-nav-link.active {
  background: rgba(232,114,42,.15);
  color: var(--orange);
}
.admin-main { flex: 1; padding: 2rem; overflow-x: hidden; }
.admin-header { margin-bottom: 1.5rem; }
.admin-header h1 {
  font-family: 'Nunito', sans-serif;
  font-size: 1.6rem; font-weight: 900;
}

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: .88rem;
  background: var(--card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1.5px solid var(--border);
}
.data-table thead th {
  background: var(--bg);
  padding: .7rem .9rem;
  text-align: left; font-weight: 700;
  font-size: .78rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-mid);
  border-bottom: 1.5px solid var(--border);
}
.data-table tbody td {
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--bg);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--orange-lt); }
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 50px;
  font-size: .75rem; font-weight: 700;
}
.badge-green { background: #d4f7e0; color: #1a7a3a; }
.badge-red   { background: #ffe0e0; color: var(--red); }
.badge-orange{ background: var(--orange-lt); color: var(--orange-dk); }

/* ---- UTILS ---- */
.page-wrapper { max-width: 900px; margin: 0 auto; padding: 2rem 1rem; }
.flex { display: flex; }
.gap-1 { gap: .5rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); font-size: .88rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ---- PROFILE ---- */
.profile-hero {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange-dk));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Nunito', sans-serif;
  font-size: 2rem; font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(232,114,42,.35);
}
.profile-info { flex: 1; min-width: 0; }
.profile-name {
  font-family: 'Nunito', sans-serif;
  font-size: 1.6rem; font-weight: 900;
  color: var(--text-dark);
  line-height: 1.2;
}
.profile-username {
  color: var(--text-light);
  font-size: .9rem; margin-top: .1rem;
}
.profile-credits-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--orange-lt);
  border: 1.5px solid #f5d3b0;
  border-radius: 50px;
  padding: .3rem .85rem;
  font-weight: 800; font-size: .92rem;
  color: var(--orange-dk);
  margin-top: .7rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.3rem 1.2rem;
  display: flex; flex-direction: column;
  gap: .3rem;
  transition: var(--transition);
}
.stat-card:hover {
  border-color: var(--orange);
  box-shadow: 0 4px 18px rgba(232,114,42,.10);
  transform: translateY(-2px);
}
.stat-card-icon { font-size: 1.5rem; }
.stat-card-val {
  font-family: 'Nunito', sans-serif;
  font-size: 1.9rem; font-weight: 900;
  color: var(--orange);
  line-height: 1.1;
}
.stat-card-label {
  font-size: .78rem; font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase; letter-spacing: .05em;
}

.accuracy-ring-wrap {
  display: flex; align-items: center; gap: 1.5rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.accuracy-ring {
  position: relative;
  width: 100px; height: 100px;
  flex-shrink: 0;
}
.accuracy-ring svg { transform: rotate(-90deg); }
.ring-bg   { fill: none; stroke: var(--bg); stroke-width: 8; }
.ring-fill {
  fill: none; stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset .8s cubic-bezier(.4,0,.2,1);
}
.accuracy-ring-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.accuracy-ring-pct {
  font-family: 'Nunito', sans-serif;
  font-size: 1.3rem; font-weight: 900;
  color: var(--text-dark);
  line-height: 1;
}
.accuracy-ring-sub {
  font-size: .65rem; font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase; letter-spacing: .06em;
}
.accuracy-breakdown { flex: 1; }
.accuracy-breakdown-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 800; font-size: 1rem;
  margin-bottom: .8rem;
}
.acc-bar-row { display: flex; align-items: center; gap: .7rem; margin-bottom: .5rem; }
.acc-bar-label { font-size: .82rem; font-weight: 600; width: 55px; color: var(--text-mid); }
.acc-bar-track {
  flex: 1; height: 10px;
  background: var(--bg);
  border-radius: 50px; overflow: hidden;
}
.acc-bar-fill {
  height: 100%; border-radius: 50px;
  transition: width .7s cubic-bezier(.4,0,.2,1);
}
.acc-bar-num { font-size: .82rem; font-weight: 700; width: 40px; text-align: right; }

.purchases-section { margin-top: 1.5rem; }
.purchases-section h2 {
  font-family: 'Nunito', sans-serif;
  font-size: 1.15rem; font-weight: 900;
  margin-bottom: 1rem;
}
.purchases-grid {
  display: flex; flex-wrap: wrap; gap: .6rem;
}
.purchase-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: .3rem .8rem;
  font-size: .85rem; font-weight: 600;
  color: var(--text-mid);
}
.purchase-chip img {
  width: 22px; height: 22px;
  border-radius: 50%; object-fit: cover;
}

@media (max-width: 600px) {\n  .grade-grid { grid-template-columns: 1fr; }\n  .quiz-options { grid-template-columns: 1fr; }\n  .navbar { padding: 0 1rem; }\n  .grade-wrapper, .unit-wrapper, .quiz-wrapper, .result-wrapper { padding: 1.5rem 1rem; }\n  .admin-layout { flex-direction: column; }\n  .admin-sidebar { width: 100%; }\n  .profile-hero { flex-direction: column; text-align: center; gap: 1rem; }\n  .accuracy-ring-wrap { flex-direction: column; }\n}
