/* =========================================================
   CodeJudge – Premium Dark UI
   ========================================================= */

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

/* ── CSS Custom Properties ── */
:root {
  --bg-deep:      #020617;
  --bg-base:      #0f172a;
  --bg-surface:   #1e293b;
  --bg-elevated:  #253047;
  --border:       rgba(99, 102, 241, 0.18);
  --border-light: rgba(255,255,255,0.07);

  --primary:      #6366f1;
  --primary-glow: rgba(99,102,241,0.35);
  --primary-dark: #4f46e5;

  --success:      #22c55e;
  --success-bg:   rgba(34,197,94,0.12);
  --error:        #ef4444;
  --error-bg:     rgba(239,68,68,0.12);
  --warn:         #f59e0b;
  --warn-bg:      rgba(245,158,11,0.12);

  --text-primary: #f1f5f9;
  --text-muted:   #94a3b8;
  --text-faint:   #475569;

  --easy:   #22c55e;
  --medium: #f59e0b;
  --hard:   #ef4444;

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow-sm:  0 2px 8px rgba(0,0,0,0.4);
  --shadow:     0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg:  0 24px 64px rgba(0,0,0,0.6);
  --shadow-glow:0 0 32px var(--primary-glow);

  --transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
  --transition-fast: all 0.12s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Subtle animated bg grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: var(--bg-base); }
::-webkit-scrollbar-thumb  { background: var(--bg-elevated); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.5px; }
h2 { font-size: 1.4rem;  font-weight: 700; }
h3 { font-size: 1.1rem;  font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }
p  { color: var(--text-muted); font-size: 0.93rem; }

/* ── Links ── */
a { color: var(--primary); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: #a5b4fc; }

/* =========================================================
   NAVBAR / HEADER
   ========================================================= */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 60px;
  background: rgba(15,23,42,0.85);
  border-bottom: 1px solid var(--border-light);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  background: linear-gradient(135deg, #a5b4fc, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-brand svg { width: 28px; height: 28px; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header h1 {
  background: linear-gradient(135deg, #a5b4fc, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.35rem;
  margin: 0;
}

/* =========================================================
   BUTTONS
   ========================================================= */
button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.15s ease;
}
button:hover::after { background: rgba(255,255,255,0.06); }
button:active { transform: scale(0.97); }

/* Primary */
.btn-primary, button.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
}
.btn-primary:hover { box-shadow: 0 6px 24px var(--primary-glow); transform: translateY(-1px); }

/* Secondary / Ghost */
.btn-secondary, button.btn-secondary {
  background: rgba(99,102,241,0.1);
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(99,102,241,0.2); }

/* Success */
.btn-success {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  box-shadow: 0 4px 16px rgba(22,163,74,0.3);
}
.btn-success:hover { box-shadow: 0 6px 24px rgba(22,163,74,0.45); transform: translateY(-1px); }

/* Danger */
.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}
.btn-ghost:hover { background: var(--bg-surface); color: var(--text-primary); }

/* Icon button */
.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}
.btn-icon:hover { color: var(--primary); border-color: var(--border); }

/* =========================================================
   FORMS / INPUTS
   ========================================================= */
input, select, textarea {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  padding: 9px 14px;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

input::placeholder, textarea::placeholder { color: var(--text-faint); }

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236366f1' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select option { background: var(--bg-surface); color: var(--text-primary); }

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* =========================================================
   GLASS CARD
   ========================================================= */
.card {
  background: rgba(30,41,59,0.6);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* =========================================================
   PROBLEM LIST PAGE (index.html)
   ========================================================= */
.page-problem-list {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px;
  background: rgba(30,41,59,0.55);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
  margin-bottom: 20px;
}

.filters input { max-width: 260px; }
.filters select { max-width: 180px; }

.filters .filter-btn {
  padding: 9px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.filters .filter-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--primary-glow); }

/* Problems table */
.problems-table-wrap {
  background: rgba(30,41,59,0.55);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.problems-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.problems-table thead tr {
  background: rgba(99,102,241,0.08);
  border-bottom: 1px solid var(--border-light);
}

.problems-table thead th {
  padding: 13px 18px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.problems-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: var(--transition-fast);
  cursor: pointer;
}

.problems-table tbody tr:last-child { border-bottom: none; }

.problems-table tbody tr:hover {
  background: rgba(99,102,241,0.07);
}

.problems-table td {
  padding: 14px 18px;
  vertical-align: middle;
}

.problem-number { color: var(--text-faint); font-size: 0.82rem; font-family: 'Fira Code', monospace; }
.problem-title-link { font-weight: 600; color: var(--text-primary); transition: var(--transition-fast); }
.problem-title-link:hover { color: var(--primary); }

.problem-card {
  background: rgba(30,41,59,0.6);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 12px;
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.problem-card:hover {
  border-color: var(--border);
  background: rgba(30,41,59,0.85);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.problem-card h3 {
  margin-bottom: 4px;
  font-size: 1rem;
  transition: color 0.15s;
}
.problem-card:hover h3 { color: var(--primary); }
.problem-card p { font-size: 0.82rem; margin: 0; }

.problem-card-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.solve-btn {
  background: rgba(99,102,241,0.12);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 7px 18px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.solve-btn:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
}

/* =========================================================
   DIFFICULTY BADGES
   ========================================================= */
.difficulty {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.difficulty.easy   { background: rgba(34,197,94,0.15);  color: var(--easy); }
.difficulty.medium { background: rgba(245,158,11,0.15); color: var(--medium); }
.difficulty.hard   { background: rgba(239,68,68,0.15);  color: var(--hard); }

/* =========================================================
   PROBLEM DETAIL PAGE (problem.html) – Split Layout
   ========================================================= */
.problem-page-layout {
  display: flex;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* Left panel */
.problem-left {
  width: 45%;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-light);
  background: var(--bg-base);
  overflow: hidden;
}

/* Tabs */
.tab-nav {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  padding: 0 20px;
  background: rgba(15,23,42,0.7);
  flex-shrink: 0;
}

.tab-btn {
  padding: 12px 18px;
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  transition: var(--transition-fast);
  position: relative;
}
.tab-btn::after { display: none; }
.tab-btn:hover { color: var(--text-muted); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { padding: 24px; overflow-y: auto; flex: 1; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Problem description */
.problem-header { margin-bottom: 18px; }
.problem-header h2 { margin-bottom: 10px; font-size: 1.2rem; }

.problem-description {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text-muted);
  white-space: pre-wrap;
}

/* IO blocks */
.io-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
}
.io-block-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 6px;
}
.io-block pre {
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.constraint-box {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 8px 0;
  font-size: 0.85rem;
  color: var(--warn);
  font-family: 'Fira Code', monospace;
}

/* Right panel (editor) */
.problem-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0d1117;
  overflow: hidden;
}

/* Editor toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(13,17,23,0.95);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.editor-toolbar select {
  width: auto;
  padding: 6px 32px 6px 12px;
  font-size: 0.82rem;
  background: var(--bg-surface);
  border-color: var(--border-light);
}

.editor-toolbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

#editor {
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 10;
}

/* Console / Output */
.console-panel {
  background: #0d1117;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  transition: height 0.3s ease;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  user-select: none;
}

.console-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.console-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: background 0.2s;
}
.console-dot.green { background: var(--success); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.console-dot.red   { background: var(--error);   box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.console-dot.yellow{ background: var(--warn);    box-shadow: 0 0 6px rgba(245,158,11,0.5); }

.console-body {
  padding: 12px 16px;
  min-height: 100px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
}

.console-body.collapsed { display: none; }

.result-verdict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 700;
}

.result-verdict.ac {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.3);
}
.result-verdict.wa {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239,68,68,0.3);
}
.result-verdict.tle {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid rgba(245,158,11,0.3);
}
.result-verdict.ce, .result-verdict.re {
  background: rgba(239,68,68,0.1);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.2);
}

#result {
  padding: 0;
  font-size: 0.9rem;
}

.result-detail {
  margin-top: 12px;
}
.result-detail .io-block { margin: 8px 0; }

/* Custom input area */
.custom-input-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  background: rgba(13,17,23,0.5);
}
.custom-input-section textarea {
  background: var(--bg-surface);
  border-color: var(--border-light);
  font-family: 'Fira Code', monospace;
  font-size: 0.82rem;
  resize: none;
  height: 70px;
  border-radius: var(--radius);
}

/* =========================================================
   AUTH PAGES (login / signup)
   ========================================================= */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
}

/* Glowing orbs */
.auth-page::before, .auth-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  pointer-events: none;
}
.auth-page::before {
  width: 400px; height: 400px;
  background: var(--primary);
  top: -150px; left: -150px;
}
.auth-page::after {
  width: 320px; height: 320px;
  background: #06b6d4;
  bottom: -100px; right: -100px;
}

.auth-container {
  background: rgba(30,41,59,0.75);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a5b4fc, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-container h2 {
  text-align: center;
  margin-bottom: 6px;
  font-size: 1.3rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.85rem;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 18px;
  position: relative;
}

.form-group input {
  padding: 11px 14px 11px 40px;
}

.form-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
  font-size: 0.9rem;
  display: flex;
}

.auth-container button {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 20px var(--primary-glow);
  border-radius: var(--radius-lg);
}

.auth-container button:hover {
  box-shadow: 0 6px 28px rgba(99,102,241,0.5);
  transform: translateY(-1px);
}

.auth-container a {
  display: block;
  text-align: center;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.auth-container a span { color: var(--primary); font-weight: 600; }
.auth-container a:hover span { color: #a5b4fc; }

#msg {
  margin-top: 14px;
  font-size: 0.85rem;
  text-align: center;
  padding: 10px 14px;
  border-radius: var(--radius);
  display: none;
}

#msg.success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,197,94,0.3); display: block; }
#msg.error   { background: var(--error-bg);   color: var(--error);   border: 1px solid rgba(239,68,68,0.3);  display: block; }

/* =========================================================
   SUBMISSIONS PAGE
   ========================================================= */
.submissions-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px;
}

.submissions-page h1 {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.submissions-table-wrap {
  background: rgba(30,41,59,0.55);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.submissions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.submissions-table thead tr {
  background: rgba(99,102,241,0.08);
  border-bottom: 1px solid var(--border-light);
}

.submissions-table thead th {
  padding: 13px 20px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.submissions-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.submissions-table tbody tr:last-child { border-bottom: none; }
.submissions-table tbody tr:hover { background: rgba(99,102,241,0.05); }

.submissions-table td {
  padding: 14px 20px;
  vertical-align: middle;
  color: var(--text-muted);
}

.submissions-table td:first-child { color: var(--text-primary); font-weight: 500; }

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.verdict-badge.AC  { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,197,94,0.25); }
.verdict-badge.WA  { background: var(--error-bg);   color: var(--error);   border: 1px solid rgba(239,68,68,0.25); }
.verdict-badge.TLE { background: var(--warn-bg);    color: var(--warn);    border: 1px solid rgba(245,158,11,0.25); }
.verdict-badge.CE  { background: rgba(168,85,247,0.12); color: #c084fc; border: 1px solid rgba(168,85,247,0.25); }
.verdict-badge.RE  { background: rgba(239,68,68,0.08); color: #fca5a5; border: 1px solid rgba(239,68,68,0.18); }

.lang-badge {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg-elevated);
  border-radius: 99px;
  font-size: 0.75rem;
  font-family: 'Fira Code', monospace;
  color: var(--text-muted);
}

.time-text { font-size: 0.8rem; font-family: 'Fira Code', monospace; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}
.empty-state svg { margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { color: var(--text-muted); margin-bottom: 6px; }

/* =========================================================
   PAGINATION
   ========================================================= */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 24px 0;
}

.pagination button {
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.85rem;
  border-radius: var(--radius);
}
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* =========================================================
   LOADING SPINNER
   ========================================================= */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   TOAST NOTIFICATIONS
   ========================================================= */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  backdrop-filter: blur(12px);
  pointer-events: auto;
  animation: toast-in 0.3s ease forwards;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  box-shadow: var(--shadow);
}

.toast.success { background: rgba(22,163,74,0.9); color: #fff; }
.toast.error   { background: rgba(220,38,38,0.9); color: #fff; }
.toast.info    { background: rgba(99,102,241,0.9); color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   MICRO-ANIMATIONS & UTILITIES
   ========================================================= */
.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.slide-up {
  animation: slideUp 0.35s cubic-bezier(0.4,0,0.2,1) forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pulse {
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Gradient text utility */
.gradient-text {
  background: linear-gradient(135deg, #a5b4fc, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 768px) {
  .problem-page-layout {
    flex-direction: column;
    height: auto;
  }
  .problem-left, .problem-right {
    width: 100%;
    min-width: unset;
  }
  .problem-left { height: 50vh; }
  #editor { min-height: 300px; }

  .header { padding: 0 16px; }
  .page-problem-list { padding: 16px; }
  .submissions-page { padding: 20px 16px; }
  .auth-container { padding: 28px 22px; }

  .problem-card { flex-direction: column; align-items: flex-start; }
  .problem-card-meta { width: 100%; justify-content: space-between; }
}