/* ============================================================
   TWT – Exam Cards Frontend Styles
   ============================================================ */

:root {
  --twt-ec-r: 16px;
  --twt-ec-shadow: 0 8px 32px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.05);
  --twt-ec-shadow-hover: 0 16px 48px rgba(0,0,0,.15), 0 4px 12px rgba(0,0,0,.07);
}

/* ── Wrap ─────────────────────────────────────────────────── */
.twt-ec-wrap {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  padding: 32px 16px 48px;
  max-width: 1280px;
  margin: 0 auto;
}

.twt-ec-virtual-page { background: #f8fafc; min-height: 100vh; }

/* ── Header ───────────────────────────────────────────────── */
.twt-ec-header {
  margin-bottom: 32px;
}

.twt-ec-header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.twt-ec-header-icon {
  flex-shrink: 0;
  display: flex;
}
.twt-ec-header-icon svg { width: 44px; height: 44px; }

.twt-ec-main-title {
  font-size: 2rem;
  font-weight: 900;
  color: #0f172a;
  margin: 0 0 4px;
  line-height: 1.15;
  letter-spacing: -.03em;
}

.twt-ec-subtitle {
  font-size: .92rem;
  color: #64748b;
  margin: 0;
}

/* ── Grid ─────────────────────────────────────────────────── */
.twt-ec-grid {
  display: grid;
  gap: 24px;
}

.twt-ec-grid-1 { grid-template-columns: 1fr; }
.twt-ec-grid-2 { grid-template-columns: repeat(2, 1fr); }
.twt-ec-grid-3 { grid-template-columns: repeat(3, 1fr); }
.twt-ec-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .twt-ec-grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .twt-ec-grid-3, .twt-ec-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .twt-ec-grid-2, .twt-ec-grid-3, .twt-ec-grid-4 { grid-template-columns: 1fr; }
}

/* ── Card ─────────────────────────────────────────────────── */
.twt-ec-card {
  position: relative;
  background: #fff;
  border-radius: var(--twt-ec-r);
  box-shadow: var(--twt-ec-shadow);
  border: 1px solid rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .22s ease;
  animation: twt-ec-fade-up .4s ease both;
  animation-delay: var(--card-delay, 0ms);
}

@keyframes twt-ec-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.twt-ec-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--twt-ec-shadow-hover);
}

/* ── Color hues for card tops ─────────────────────────────── */
.twt-ec-card-hue-0 .twt-ec-card-top { background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%); }
.twt-ec-card-hue-1 .twt-ec-card-top { background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%); }
.twt-ec-card-hue-2 .twt-ec-card-top { background: linear-gradient(135deg, #10b981 0%, #34d399 100%); }
.twt-ec-card-hue-3 .twt-ec-card-top { background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); }
.twt-ec-card-hue-4 .twt-ec-card-top { background: linear-gradient(135deg, #ef4444 0%, #f87171 100%); }
.twt-ec-card-hue-5 .twt-ec-card-top { background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%); }

/* Color-matched icon */
.twt-ec-card-hue-0 .twt-ec-card-icon { color: #6366f1; }
.twt-ec-card-hue-1 .twt-ec-card-icon { color: #0ea5e9; }
.twt-ec-card-hue-2 .twt-ec-card-icon { color: #10b981; }
.twt-ec-card-hue-3 .twt-ec-card-icon { color: #f59e0b; }
.twt-ec-card-hue-4 .twt-ec-card-icon { color: #ef4444; }
.twt-ec-card-hue-5 .twt-ec-card-icon { color: #8b5cf6; }

/* ── Start button color per hue ──────────────────────────── */
.twt-ec-card-hue-0 .twt-ec-start-btn { background: #6366f1; }
.twt-ec-card-hue-0 .twt-ec-start-btn:hover { background: #4f46e5; }
.twt-ec-card-hue-1 .twt-ec-start-btn { background: #0ea5e9; }
.twt-ec-card-hue-1 .twt-ec-start-btn:hover { background: #0284c7; }
.twt-ec-card-hue-2 .twt-ec-start-btn { background: #10b981; }
.twt-ec-card-hue-2 .twt-ec-start-btn:hover { background: #059669; }
.twt-ec-card-hue-3 .twt-ec-start-btn { background: #f59e0b; }
.twt-ec-card-hue-3 .twt-ec-start-btn:hover { background: #d97706; }
.twt-ec-card-hue-4 .twt-ec-start-btn { background: #ef4444; }
.twt-ec-card-hue-4 .twt-ec-start-btn:hover { background: #dc2626; }
.twt-ec-card-hue-5 .twt-ec-start-btn { background: #8b5cf6; }
.twt-ec-card-hue-5 .twt-ec-start-btn:hover { background: #7c3aed; }

/* ── Featured card ────────────────────────────────────────── */
.twt-ec-featured {
  border: 2px solid #f59e0b;
  box-shadow: 0 8px 32px rgba(245,158,11,.18), var(--twt-ec-shadow);
}

.twt-ec-featured-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f59e0b;
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 99px;
  letter-spacing: .05em;
  text-transform: uppercase;
  z-index: 2;
}
.twt-ec-featured-badge svg { width: 11px; height: 11px; }

/* ── Card top ─────────────────────────────────────────────── */
.twt-ec-card-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 22px 20px 18px;
  min-height: 90px;
}

.twt-ec-card-icon-wrap {
  background: rgba(255,255,255,.92);
  border-radius: 12px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.twt-ec-card-icon-wrap svg { width: 32px; height: 32px; }

/* ── Topic chip ───────────────────────────────────────────── */
.twt-ec-topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.22);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,.35);
  letter-spacing: .02em;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.twt-ec-topic-chip svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ── Card body ────────────────────────────────────────────── */
.twt-ec-card-body {
  padding: 18px 20px 14px;
  flex: 1;
}

.twt-ec-card-title {
  font-size: 1.03rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
  margin: 0 0 14px;
  letter-spacing: -.015em;
}

/* ── Stats ────────────────────────────────────────────────── */
.twt-ec-stats {
  display: flex;
  align-items: center;
  gap: 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.twt-ec-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  flex: 1;
}

.twt-ec-stat-divider {
  width: 1px;
  height: 36px;
  background: #e2e8f0;
  flex-shrink: 0;
}

.twt-ec-stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.twt-ec-stat-icon svg { width: 16px; height: 16px; }

.twt-ec-stat-icon-q { background: #ede9fe; color: #7c3aed; }
.twt-ec-stat-icon-t { background: #dbeafe; color: #1d4ed8; }

.twt-ec-stat-info { display: flex; flex-direction: column; min-width: 0; }
.twt-ec-stat-num {
  font-size: .92rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
  white-space: nowrap;
}
.twt-ec-stat-label {
  font-size: .7rem;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 1px;
  white-space: nowrap;
}

/* ── Card footer ──────────────────────────────────────────── */
.twt-ec-card-footer {
  padding: 0 20px 20px;
}

.twt-ec-start-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 18px;
  border-radius: 10px;
  color: #fff !important;
  text-decoration: none !important;
  font-size: .9rem;
  font-weight: 800;
  letter-spacing: .01em;
  transition: all .2s;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.twt-ec-start-btn:hover {
  transform: translateX(2px);
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
  text-decoration: none !important;
}
.twt-ec-start-btn svg { width: 18px; height: 18px; transition: transform .18s; }
.twt-ec-start-btn:hover svg { transform: translateX(3px); }

.twt-ec-coming-soon {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  background: #f1f5f9;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  color: #94a3b8;
  font-size: .86rem;
  font-weight: 600;
}
.twt-ec-coming-soon svg { width: 16px; height: 16px; }

/* ── Empty state ──────────────────────────────────────────── */
.twt-ec-empty {
  text-align: center;
  padding: 64px 24px;
  background: #fff;
  border: 1px dashed #e2e8f0;
  border-radius: var(--twt-ec-r);
}
.twt-ec-empty-icon { font-size: 3rem; margin-bottom: 14px; }
.twt-ec-empty h3 { font-size: 1.2rem; color: #374151; margin: 0 0 8px; }
.twt-ec-empty p  { color: #6b7280; margin: 0; }

/* ── Footer note ──────────────────────────────────────────── */
.twt-ec-footer-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  font-size: .78rem;
  color: #94a3b8;
}
.twt-ec-footer-note svg { width: 15px; height: 15px; flex-shrink: 0; }
.twt-ec-footer-note code {
  font-family: 'Consolas', monospace;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
}
.twt-ec-footer-note strong { color: #475569; }
