/* shared-mockup.css — Design System cho THPT Luyện thi Mockup */

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

/* ── Design Tokens ────────────────────────────────────────────────────────── */
:root {
  /* Colors */
  --color-bg:           #F7F5F0;
  --color-surface:      #FFFFFF;
  --color-primary:      #1B2B4B;
  --color-primary-dark: #111E35;
  --color-primary-mid:  #2D4570;
  --color-accent:       #E88C3A;
  --color-accent-dark:  #C97020;
  --color-accent-soft:  #FDF3E3;
  --color-text:         #1A1A1A;
  --color-text-muted:   #6B6B6B;
  --color-text-light:   #9B9B9B;
  --color-border:       #E2DDD5;
  --color-border-light: #EDE9E3;
  --color-success:      #2D6A4F;
  --color-success-soft: #D8F3DC;
  --color-danger:       #C1440E;
  --color-danger-soft:  #FDEEE8;
  --color-warn:         #B45309;
  --color-warn-soft:    #FEF3C7;

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'Plus Jakarta Sans', system-ui, sans-serif;

  /* Font sizes */
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   20px;
  --text-xl:   24px;
  --text-2xl:  30px;
  --text-3xl:  38px;
  --text-4xl:  52px;

  /* Spacing scale (4px base) */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* Border radius */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
  --shadow-xl:  0 16px 48px rgba(0,0,0,0.14);

  /* Transitions */
  --transition: 180ms ease;

  /* Layout */
  --max-width: 1280px;
  --sidebar-width: 260px;
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  color: var(--color-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

.text-display {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  line-height: 1.1;
  color: var(--color-primary);
}
.text-sm    { font-size: var(--text-sm); }
.text-xs    { font-size: var(--text-xs); }
.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.font-medium  { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold    { font-weight: 700; }

/* ── Layout Utilities ─────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.card-sm { padding: var(--space-4); border-radius: var(--radius-sm); }
.card-lg { padding: var(--space-8); border-radius: var(--radius-lg); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: 600;
  border: 2px solid transparent;
  transition: all var(--transition);
  line-height: 1;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-accent {
  background: var(--color-accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--color-accent-dark);
}

.btn-outline {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-success {
  background: var(--color-success);
  color: #fff;
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-md);
  border-radius: var(--radius-md);
}

/* ── Badge ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
}
.badge-accent  { background: var(--color-accent-soft);  color: var(--color-accent-dark); }
.badge-primary { background: #E8EDF5;                   color: var(--color-primary); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-danger  { background: var(--color-danger-soft);  color: var(--color-danger); }
.badge-warn    { background: var(--color-warn-soft);    color: var(--color-warn); }
.badge-muted   { background: var(--color-border);       color: var(--color-text-muted); }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.progress-wrap {
  background: var(--color-border);
  border-radius: var(--radius-full);
  height: 8px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  transition: width 0.4s ease;
}
.progress-bar.accent  { background: var(--color-accent); }
.progress-bar.success { background: var(--color-success); }
.progress-bar.warn    { background: var(--color-warn); }

/* ── Form elements ────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition);
  outline: none;
}
.input:focus {
  border-color: var(--color-primary);
}
.input::placeholder {
  color: var(--color-text-light);
}

.input-lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-md);
  border-radius: var(--radius-md);
}

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.tab-item {
  padding: var(--space-2) var(--space-5);
  border-radius: 4px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: transparent;
}
.tab-item.active {
  background: var(--color-surface);
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.tab-item:hover:not(.active) {
  color: var(--color-text);
}

/* Pills variant */
.tabs-pill {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.tabs-pill .tab-item {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-5);
}
.tabs-pill .tab-item.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: none;
}

/* ── Divider ──────────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-6) 0;
}

/* ── Alert / Banner ───────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}
.alert-warn {
  background: var(--color-warn-soft);
  border: 1px solid #FCD34D;
  color: var(--color-warn);
}
.alert-danger {
  background: var(--color-danger-soft);
  border: 1px solid #FCA5A5;
  color: var(--color-danger);
}
.alert-success {
  background: var(--color-success-soft);
  border: 1px solid #6EE7B7;
  color: var(--color-success);
}
.alert-info {
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  color: #4338CA;
}

/* ── Modal overlay ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
}
.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-xl);
}

/* ── Stat card ────────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  text-align: center;
}
.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  color: var(--color-primary);
  line-height: 1;
  margin-bottom: var(--space-1);
}
.stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ── Avatar / Initials ────────────────────────────────────────────────────── */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: var(--text-2xl);
}

/* ── Difficulty indicator ─────────────────────────────────────────────────── */
.difficulty {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.difficulty-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-border);
}
.difficulty[data-level="easy"] .difficulty-dot:nth-child(-n+1) { background: var(--color-success); }
.difficulty[data-level="medium"] .difficulty-dot:nth-child(-n+2) { background: var(--color-warn); }
.difficulty[data-level="hard"] .difficulty-dot:nth-child(-n+3) { background: var(--color-danger); }

/* ── Streak badge ─────────────────────────────────────────────────────────── */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-accent-soft);
  border: 1px solid #F5C68A;
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent-dark);
}

/* ── Autosave indicator ───────────────────────────────────────────────────── */
.autosave {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.autosave-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
}
.autosave.saved .autosave-dot    { background: var(--color-success); }
.autosave.saving .autosave-dot   { background: var(--color-warn); }
.autosave.unsaved .autosave-dot  { background: var(--color-danger); }

/* ── Quota indicator ──────────────────────────────────────────────────────── */
.quota-bar-wrap {
  background: var(--color-border);
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
  margin: var(--space-2) 0;
}
.quota-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-success);
  transition: width 0.4s ease;
}
.quota-bar.warn    { background: var(--color-warn); }
.quota-bar.danger  { background: var(--color-danger); }

/* ── Score circle ─────────────────────────────────────────────────────────── */
.score-circle-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.score-circle-svg {
  transform: rotate(-90deg);
}
.score-circle-text {
  position: absolute;
  text-align: center;
}

/* ── Section header ───────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-primary);
}
.section-action {
  font-size: var(--text-sm);
  color: var(--color-accent);
  font-weight: 600;
  cursor: pointer;
}

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
thead th {
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-weight: 600;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--color-bg); }

/* ── Geometric texture (hero bg) ──────────────────────────────────────────── */
.hero-texture {
  background-color: var(--color-primary);
  background-image:
    radial-gradient(circle at 20% 50%, rgba(232,140,58,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.05) 0%, transparent 40%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ── Noise texture overlay ────────────────────────────────────────────────── */
.noise-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
  pointer-events: none;
}

/* ── Save status (exam — Hướng B) ────────────────────────────────────────── */
.save-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  font-family: var(--font-body);
}
.save-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.save-dot--green  { background: var(--color-success); }
.save-dot--amber  { background: var(--color-warn); }
.save-dot--pulse  {
  background: var(--color-text-muted);
  animation: pulse 1s ease-in-out infinite;
}
.save-status--saved   { color: var(--color-success); }
.save-status--saving  { color: var(--color-text-muted); }
.save-status--unsaved { color: var(--color-warn); }
.save-footnote {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── Network banner ───────────────────────────────────────────────────────── */
.network-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: #7C3D0F;
  color: #FEF3C7;
  font-size: 13px;
  font-family: var(--font-body);
  padding: var(--space-2) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  z-index: 1000;
}

/* ── Quota button states ──────────────────────────────────────────────────── */
.btn--disabled {
  background: var(--color-border);
  color: var(--color-text-muted);
  cursor: not-allowed;
  opacity: 0.7;
  display: inline-flex;
  align-items: center;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: 600;
  border: none;
}
.btn--warn {
  background: var(--color-warn-soft);
  color: var(--color-warn);
  border: 1.5px solid var(--color-warn);
  display: inline-flex;
  align-items: center;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
}
.quota-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: var(--space-2);
  font-weight: 600;
}
.quota-tag--normal    { background: var(--color-success-soft); color: var(--color-success); }
.quota-tag--warn      { background: var(--color-warn-soft);    color: var(--color-warn); }
.quota-tag--exhausted { background: var(--color-danger-soft);  color: var(--color-danger); }
.quota-upgrade-hint   { font-size: 13px; color: var(--color-text-muted); margin-top: var(--space-2); }
.link--accent { color: var(--color-accent); text-decoration: underline; font-weight: 600; }

/* ── Skeleton loading ─────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.skeleton-circle, .skeleton-line {
  background: linear-gradient(90deg,
    var(--color-border) 25%,
    #ede9e0 50%,
    var(--color-border) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-md);
}
.skeleton-circle   { width: 160px; height: 160px; border-radius: 50%; margin: 0 auto; }
.skeleton-line--lg { height: 32px; width: 60%; margin: var(--space-4) auto 0; }
.skeleton-line--sm { height: 16px; width: 40%; margin: var(--space-2) auto 0; }
.score-skeleton    { text-align: center; padding: var(--space-6) 0; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
}
.empty-state__icon  { margin-bottom: var(--space-4); opacity: 0.4; display: flex; justify-content: center; }
.empty-state__title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.empty-state__desc  {
  font-size: 15px;
  max-width: 320px;
  margin: 0 auto var(--space-6);
  line-height: 1.6;
}

/* ── Admin identity bar ───────────────────────────────────────────────────── */
.admin-identity-bar {
  background: var(--color-primary);
  color: rgba(255,255,255,0.7);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 6px var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.admin-identity-bar__label {
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: 0.12em;
}
.admin-identity-bar__dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
}
.admin-identity-bar__id  { font-family: monospace; font-size: 11px; }
.admin-identity-bar__env { margin-left: auto; opacity: 0.5; }

/* ── Responsive ───────────────────────────────────────────────────────────── */

/* Mobile first — 375px base */

@media (min-width: 768px) {
  .container { padding: 0 var(--space-8); }
  .grid-2 { grid-template-columns: 1fr 1fr; }

  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }

  .hide-mobile { display: block; }
  .hide-desktop { display: none; }
}

@media (max-width: 767px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }

  .hide-mobile  { display: none; }
  .hide-desktop { display: block; }

  .text-display { font-size: var(--text-2xl); }
}

@media (min-width: 1280px) {
  h1 { font-size: var(--text-3xl); }
  .text-display { font-size: var(--text-4xl); }
}
