/* ══════════════════════════════════════
   XQuizMe — User Dashboard
   ══════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800&display=swap');

.xqm-ud-wrap {
  direction: rtl;
  font-family: 'Heebo', 'Segoe UI', sans-serif;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  color: #1a1917;
}

/* ── Login required ── */
.xqm-ud-login-required {
  direction: rtl;
  font-family: 'Heebo', sans-serif;
  text-align: center;
  padding: 60px 24px;
  max-width: 440px;
  margin: 40px auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8e6e3;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.xqm-ud-login-icon { font-size: 48px; margin-bottom: 12px; }
.xqm-ud-login-required h3 { font-size: 20px; font-weight: 700; margin: 0 0 8px; color: #1a1917; }
.xqm-ud-login-required p { font-size: 14px; color: #706f6b; margin: 0 0 20px; line-height: 1.6; }
.xqm-ud-login-btn {
  display: inline-block;
  padding: 11px 32px;
  background: #01696f;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  transition: background .2s;
}
.xqm-ud-login-btn:hover { background: #015458; color: #fff; }

/* ── Header ── */
.xqm-ud-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #01696f 0%, #024950 100%);
  border-radius: 14px;
  color: #fff;
}
.xqm-ud-avatar img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.3);
  object-fit: cover;
}
.xqm-ud-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 2px;
  color: #fff;
}
.xqm-ud-subtitle {
  font-size: 13px;
  margin: 0;
  opacity: .8;
  color: rgba(255,255,255,.85);
}

/* ── Empty state ── */
.xqm-ud-empty {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8e6e3;
}
.xqm-ud-empty-icon { font-size: 48px; margin-bottom: 12px; }
.xqm-ud-empty h3 { font-size: 18px; font-weight: 700; margin: 0 0 8px; }
.xqm-ud-empty p { font-size: 14px; color: #706f6b; margin: 0; line-height: 1.6; }

/* ── Stat Cards ── */
.xqm-ud-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.xqm-ud-stat {
  background: #fff;
  border: 1px solid #e8e6e3;
  border-radius: 12px;
  padding: 18px 16px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: transform .15s, box-shadow .15s;
}
.xqm-ud-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.xqm-ud-stat-num {
  font-size: 28px;
  font-weight: 800;
  color: #1a1917;
  line-height: 1;
  margin-bottom: 6px;
}
.xqm-ud-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: #8c8a85;
}
.xqm-ud-color-ok { color: #1a7a45; }
.xqm-ud-color-best { color: #01696f; }

/* ── Row layout ── */
.xqm-ud-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}
.xqm-ud-chart-card { flex: 1.2; min-width: 0; }
.xqm-ud-quizzes-card { flex: 1; min-width: 260px; }

@media (max-width: 680px) {
  .xqm-ud-row { flex-direction: column; }
  .xqm-ud-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 420px) {
  .xqm-ud-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Card ── */
.xqm-ud-card {
  background: #fff;
  border: 1px solid #e8e6e3;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.xqm-ud-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1917;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0efed;
}

/* ── Quiz list in card ── */
.xqm-ud-quiz-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}
.xqm-ud-quiz-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #fafaf9;
  border-radius: 8px;
  border: 1px solid #f0efed;
  transition: background .15s;
}
.xqm-ud-quiz-row:hover { background: #f5f4f2; }
.xqm-ud-quiz-name {
  font-size: 13px;
  font-weight: 600;
  color: #1a1917;
}
.xqm-ud-quiz-meta {
  font-size: 11px;
  color: #8c8a85;
  margin-top: 2px;
}
.xqm-ud-quiz-best {
  font-size: 16px;
  font-weight: 800;
  min-width: 50px;
  text-align: center;
  border-radius: 6px;
  padding: 4px 8px;
}
.xqm-ud-quiz-best.pass { color: #1a7a45; background: #f0fdf4; }
.xqm-ud-quiz-best.fail { color: #c0392b; background: #fff5f5; }

/* ── Breakdown bar ── */
.xqm-ud-breakdown { padding: 10px 0; }
.xqm-ud-break-bar {
  display: flex;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}
.xqm-ud-break-pass {
  background: #1a7a45;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  transition: width .4s ease;
}
.xqm-ud-break-fail {
  background: #c0392b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  transition: width .4s ease;
}
.xqm-ud-break-legend {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #706f6b;
}
.xqm-ud-legend-pass::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: #1a7a45; margin-left: 5px; }
.xqm-ud-legend-fail::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: #c0392b; margin-left: 5px; }

/* ── Table ── */
.xqm-ud-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.xqm-ud-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.xqm-ud-table thead th {
  background: #fafaf9;
  font-weight: 600;
  color: #706f6b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid #e8e6e3;
  white-space: nowrap;
}
.xqm-ud-table tbody td {
  padding: 12px;
  border-bottom: 1px solid #f0efed;
  vertical-align: middle;
}
.xqm-ud-table tbody tr:hover { background: #fafaf9; }
.xqm-ud-table tbody tr:last-child td { border-bottom: none; }

.xqm-ud-td-quiz { font-weight: 600; max-width: 180px; }
.xqm-ud-td-time { color: #8c8a85; font-size: 12px; }
.xqm-ud-td-date { white-space: nowrap; font-size: 12px; color: #706f6b; }
.xqm-ud-time-small { display: block; font-size: 11px; color: #a8a6a1; }

.xqm-ud-score-val {
  font-weight: 800;
  font-size: 15px;
}
.xqm-ud-score-val.ok { color: #1a7a45; }
.xqm-ud-score-val.no { color: #c0392b; }
.xqm-ud-score-frac {
  font-size: 11px;
  color: #a8a6a1;
  margin-right: 4px;
}
.xqm-ud-result-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
}
.xqm-ud-result-badge.pass { background: #f0fdf4; color: #1a7a45; }
.xqm-ud-result-badge.fail { background: #fff5f5; color: #c0392b; }

.xqm-ud-view-btn {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #01696f;
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #01696f;
  transition: all .15s;
  white-space: nowrap;
}
.xqm-ud-view-btn:hover {
  background: #01696f;
  color: #fff;
}

/* ── Detail view ── */
.xqm-ud-back-btn {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: #01696f;
  text-decoration: none;
  margin-bottom: 16px;
  transition: color .15s;
}
.xqm-ud-back-btn:hover { color: #015458; }

.xqm-ud-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: #fff;
  border: 1px solid #e8e6e3;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.xqm-ud-detail-info h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  color: #1a1917;
}
.xqm-ud-detail-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: #8c8a85;
  flex-wrap: wrap;
}
.xqm-ud-detail-score {
  text-align: center;
  min-width: 80px;
  padding: 12px 16px;
  border-radius: 12px;
  flex-shrink: 0;
}
.xqm-ud-detail-score.pass { background: #f0fdf4; }
.xqm-ud-detail-score.fail { background: #fff5f5; }
.xqm-ud-detail-pct {
  display: block;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}
.xqm-ud-detail-score.pass .xqm-ud-detail-pct { color: #1a7a45; }
.xqm-ud-detail-score.fail .xqm-ud-detail-pct { color: #c0392b; }
.xqm-ud-detail-status {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}
.xqm-ud-detail-score.pass .xqm-ud-detail-status { color: #1a7a45; }
.xqm-ud-detail-score.fail .xqm-ud-detail-status { color: #c0392b; }

/* ── Review items ── */
.xqm-ud-review-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.xqm-ud-review-item {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e8e6e3;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
  transition: border-color .15s;
}
.xqm-ud-review-item.correct { border-right: 4px solid #1a7a45; }
.xqm-ud-review-item.wrong   { border-right: 4px solid #c0392b; }
.xqm-ud-review-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.xqm-ud-review-badge.ok { background: #f0fdf4; color: #1a7a45; }
.xqm-ud-review-badge.no { background: #fff5f5; color: #c0392b; }
.xqm-ud-review-body { flex: 1; min-width: 0; }
.xqm-ud-review-q {
  font-size: 14px;
  font-weight: 600;
  color: #1a1917;
  margin-bottom: 6px;
  line-height: 1.5;
}
.xqm-ud-review-answer {
  font-size: 13px;
  color: #4b4a47;
  margin-bottom: 4px;
}
.xqm-ud-review-answer strong { font-weight: 600; }
.xqm-ud-val-ok { color: #1a7a45; font-weight: 600; }
.xqm-ud-val-no { color: #c0392b; font-weight: 600; }
.xqm-ud-review-explain {
  font-size: 12px;
  color: #706f6b;
  background: #fafaf9;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 6px;
  line-height: 1.5;
}

.xqm-ud-muted { color: #8c8a85; font-size: 13px; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .xqm-ud-wrap { padding: 16px 10px 30px; }
  .xqm-ud-header { padding: 16px; gap: 12px; }
  .xqm-ud-title { font-size: 18px; }
  .xqm-ud-detail-header { flex-direction: column; align-items: stretch; text-align: center; }
  .xqm-ud-detail-meta { justify-content: center; }
  .xqm-ud-detail-score { align-self: center; }
  .xqm-ud-table { font-size: 12px; }
}
