/* ============================================================
   DASHBOARD.CSS  —  Auth Modal + Dashboard Tab + Gamification
   ============================================================ */

/* ── Auth Modal ─────────────────────────────────────────────── */
#authOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#authOverlay.hidden { display: none; }

.auth-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 380px;
  padding: 32px 28px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  position: relative;
}

.auth-modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background .15s;
}
.auth-modal-close:hover { background: var(--surface2); }

.auth-logo {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 4px;
}
.auth-title {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.auth-sub {
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.auth-panel.hidden { display: none; }

/* Google butonu */
.auth-google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  margin-bottom: 16px;
}
.auth-google-btn:hover { background: var(--surface2); border-color: var(--accent); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: .75rem;
  margin-bottom: 14px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Input */
.auth-field {
  margin-bottom: 12px;
}
.auth-field label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
}
.auth-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.auth-field input:focus { border-color: var(--accent); }

.auth-submit-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: .95rem;
  font-weight: 800;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity .15s;
}
.auth-submit-btn:hover { opacity: .88; }

.auth-error {
  font-size: .8rem;
  min-height: 18px;
  margin-top: 8px;
  text-align: center;
  color: #ef4444;
}

.auth-switch {
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
  margin-top: 14px;
}
.auth-switch-link {
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

/* ── Header Auth Button ─────────────────────────────────────── */
/* Header auth btn — kompakt */
#authHeaderBtn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 0;
}
#authHeaderBtn:hover .auth-avatar { opacity: .85; }

.auth-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-name { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Dashboard Tab ──────────────────────────────────────────── */
#main-dashboard { padding-bottom: 100px; }

.dash-container { max-width: 480px; margin: 0 auto; padding: 20px 16px 0; }

.dash-empty {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  padding: 20px 0;
}

/* Profil bölməsi */
.dash-profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
}
.dash-profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.dash-profile-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-profile-id { flex: 1; min-width: 0; }
.dash-profile-name { font-size: 1rem; font-weight: 800; color: var(--text); }
.dash-profile-email { font-size: .78rem; color: var(--muted); }

.dash-profile-edit-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: .95rem;
  cursor: pointer;
  transition: all 0.2s;
}
.dash-profile-edit-btn:hover { border-color: var(--accent); background: var(--surface2); }
.dash-profile-edit-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Profil faktları — baxış rejimi */
.dash-profile-facts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-bottom: 14px;
}
.dash-fact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
}
.dash-fact-icon { font-size: .9rem; flex-shrink: 0; width: 20px; text-align: center; }
.dash-fact-label {
  flex: 1;
  font-size: .8rem;
  color: var(--muted);
}
.dash-fact-val {
  font-size: .84rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

/* Profil redaktə forması */
.dash-profile-edit {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-edit-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 6px;
}
.dash-edit-label:first-child { margin-top: 0; }
.dash-edit-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: .85rem;
  outline: none;
  font-family: inherit;
}
.dash-edit-input:focus { border-color: var(--accent); }
select.dash-edit-input { cursor: pointer; }

.dash-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.dash-edit-save {
  flex: 1;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
}
.dash-edit-save:disabled { opacity: .6; cursor: not-allowed; }
.dash-edit-cancel {
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
}
.dash-edit-cancel:hover { border-color: var(--muted); color: var(--text); }

.dash-signout-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition: background .15s;
}
.dash-signout-btn:hover { background: var(--surface2); color: #ef4444; border-color: #ef4444; }


/* Giriş etməmiş — prompt kartı */
.dash-login-prompt {
  text-align: center;
  padding: 48px 24px;
}
.dash-login-prompt-icon { font-size: 3rem; margin-bottom: 12px; }
.dash-login-prompt h3 {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 6px;
}
.dash-login-prompt p {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 20px;
}
.dash-login-btn {
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: .95rem;
  font-weight: 800;
  cursor: pointer;
}

/* ── XP Toast ───────────────────────────────────────────────── */
#xp-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: .88rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 8000;
  white-space: nowrap;
}
#xp-toast.xp-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Bottom nav — dashboard düyməsi ─────────────────────────── */
#btn-dashboard .bottom-nav-icon svg { stroke: currentColor; }

/* ── Header right group ──────────────────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.header-auth-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 0;
}
.header-auth-btn .auth-name {
  font-size: .8rem;
  font-weight: 700;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* lang-pill ilə əvəzləndi */

/* ── Streak banner ───────────────────────────────────────────── */
.dash-streak-msg {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .83rem;
  font-weight: 700;
  padding: 11px 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  user-select: none;
  transition: opacity .15s;
}
.dash-streak-msg:hover { opacity: .88; }
.streak-msg-arrow { flex-shrink: 0; opacity: .7; }
.dash-streak-ok   { background: rgba(34,197,94,.12);  color: #22c55e; }
.dash-streak-warn { background: rgba(251,191,36,.12); color: #f59e0b; }
.dash-streak-dead { background: rgba(239,68,68,.12);  color: #ef4444; }

/* Streak info paneli */
.streak-info-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}
.streak-info-panel.hidden { display: none; }
.streak-info-title {
  font-size: .88rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}
.streak-info-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.4;
}
.streak-info-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.streak-info-item strong { color: var(--text); }
.streak-info-note {
  font-size: .75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}

/* ── Section header ──────────────────────────────────────────── */
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
/* dash-section-title uses unified .section-label design from base.css */
.dash-section-more {
  font-size: .75rem;
  color: var(--accent);
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

/* ── Quiz items — ikon ilə ───────────────────────────────────── */
.dash-quiz-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.dash-quiz-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: rgba(99,102,241,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.dash-quiz-subj  { flex: 1; font-size: .83rem; font-weight: 700; color: var(--text); }
.dash-quiz-score { font-size: .75rem; color: var(--muted); margin-right: 4px; }
.dash-quiz-pct   { font-size: .85rem; font-weight: 800; min-width: 36px; text-align: right; }
.dash-quiz-good .dash-quiz-pct { color: #22c55e; }
.dash-quiz-mid  .dash-quiz-pct { color: #f59e0b; }
.dash-quiz-bad  .dash-quiz-pct { color: #ef4444; }

/* Rank kartı — kiçildilmiş */
.dash-rank-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.dash-rank-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.dash-rank-icon-wrap { font-size: 1.6rem; line-height: 1; }
.dash-rank-info { flex: 1; }
.dash-rank-title { font-size: .95rem; font-weight: 900; color: var(--text); }
.dash-rank-xp    { font-size: .78rem; color: var(--accent); font-weight: 700; }
.dash-rank-next  { font-size: .72rem; color: var(--muted); margin-bottom: 7px; }
.dash-rank-bar-bg {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.dash-rank-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #06b6d4);
  border-radius: 99px;
  width: 0;
  transition: width .8s cubic-bezier(.4,0,.2,1);
}

/* Greeting kiçildilmiş */
.dash-greeting {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 1px;
}
.dash-date {
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: 14px;
  text-transform: capitalize;
}

/* ── Stat kartları — yeni layout ─────────────────────────────── */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.dash-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-stat-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
}
.dash-stat-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-stat-top {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1;
}
.dash-stat-val {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}
.dash-stat-unit {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: lowercase;
}
.dash-stat-label {
  font-size: .7rem;
  color: var(--muted);
  font-weight: 600;
}

/* ── Quiz nəticələri modali ──────────────────────────────────── */
.quiz-results-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(8px);
  z-index: 8500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.quiz-results-overlay.hidden { display: none; }

.quiz-results-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0,0,0,.4);
  animation: slideUp .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.quiz-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.quiz-results-title {
  font-size: 1rem;
  font-weight: 900;
  color: var(--text);
}
.quiz-results-close {
  background: var(--surface2);
  border: none;
  border-radius: 8px;
  color: var(--muted);
  font-size: .9rem;
  padding: 4px 9px;
  cursor: pointer;
}

.quiz-results-body {
  overflow-y: auto;
  padding: 12px 16px 24px;
  flex: 1;
}
.quiz-results-loading,
.quiz-results-empty {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  padding: 32px 0;
}

.qr-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  transition: background .15s;
}
.qr-item:hover { background: var(--surface2); }

.qr-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(99,102,241,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.qr-info { flex: 1; }
.qr-subj {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.qr-date {
  font-size: .72rem;
  color: var(--muted);
}
.qr-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.qr-score {
  font-size: .75rem;
  color: var(--muted);
}
.qr-pct {
  font-size: .9rem;
  font-weight: 900;
}
.qr-good { color: #22c55e; }
.qr-mid  { color: #f59e0b; }
.qr-bad  { color: #ef4444; }

/* ── AZ/EN lang pill — hamburger stil ───────────────────────── */
.header-lang-pill {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  gap: 0;
}
.lang-pill-btn {
  padding: 6px 11px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  transition: all .18s;
  line-height: 1;
}
.lang-pill-btn.active {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
}
.lang-pill-btn:not(.active):hover {
  color: var(--text);
  background: var(--surface2);
}

/* ============================================================
   BADGES
   ============================================================ */

/* ── Dashboard badge bölməsi ────────────────────────────────── */
.dash-badges-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.dash-badges-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
}
.dash-badges-count {
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(99,102,241,.1);
  padding: 3px 10px;
  border-radius: 20px;
}

.dash-badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 12px;
  text-align: center;
  border: 1.5px solid transparent;
  transition: transform .18s;
  cursor: default;
}
.badge-item:hover { transform: scale(1.06); }

.badge-earned {
  background: rgba(99,102,241,.1);
  border-color: rgba(99,102,241,.25);
}
.badge-locked {
  background: var(--surface2, #f1f5f9);
  border-color: transparent;
  opacity: .35;
  filter: grayscale(1);
}

.badge-item-icon {
  font-size: 1.6rem;
  line-height: 1;
}
.badge-item-name {
  font-size: .6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}

/* ── Toast ──────────────────────────────────────────────────── */
.badge-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface, #fff);
  border: 1.5px solid var(--accent);
  border-radius: 18px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s, transform .35s;
  max-width: 320px;
  width: calc(100vw - 40px);
}
.badge-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.badge-toast-hide {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
}
.badge-toast-icon {
  font-size: 2.2rem;
  flex-shrink: 0;
  line-height: 1;
}
.badge-toast-body { flex: 1; }
.badge-toast-title {
  font-size: .68rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 2px;
}
.badge-toast-name {
  font-size: .95rem;
  font-weight: 800;
  color: var(--text);
}
.badge-toast-desc {
  font-size: .72rem;
  color: var(--muted);
  margin-top: 2px;
}
