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

:root {
  --bg-primary: #0a0a0b;
  --bg-secondary: #121214;
  --bg-tertiary: #1a1a1d;
  --bg-elevated: #222226;
  --border: #2a2a2e;
  --border-focus: #3a3a40;

  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  --accent: #22d3ee;
  --accent-dim: #0891b2;
  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;

  --correct: #22c55e;
  --incorrect: #ef4444;
  --pending: #f59e0b;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);

  --font-sans: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* ============== UTILITIES ============== */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }

.text-center { text-align: center; }
.text-mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

.hidden { display: none !important; }

/* ============== COMPONENTS ============== */

.btn {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-focus);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
}

.input {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease;
}

.input:focus {
  border-color: var(--accent);
}

.input::placeholder {
  color: var(--text-muted);
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.badge {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.badge-success { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-warning { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.badge-error { background: rgba(248, 113, 113, 0.15); color: var(--error); }
.badge-info { background: rgba(34, 211, 238, 0.15); color: var(--accent); }

/* ============== HEADER ============== */

.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.nav-link {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
  margin-left: 8px;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 500;
}

/* ============== LOGIN PAGE ============== */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(34, 211, 238, 0.08) 0%, transparent 50%),
    var(--bg-primary);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.login-header p {
  color: var(--text-secondary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.login-form .input {
  width: 100%;
}

.login-form .btn {
  margin-top: 8px;
  width: 100%;
  justify-content: center;
}

.login-error {
  padding: 12px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius-md);
  color: var(--error);
  font-size: 0.875rem;
  display: none;
}

.login-error.show {
  display: block;
}

/* ============== LABELING PAGE ============== */

.labeling-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  height: calc(100vh - 65px);
  overflow: hidden;
}

.labeling-main {
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.labeling-sidebar {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Progress Bar */
.progress-section {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.progress-stats {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.progress-bar {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Card Viewer */
.card-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-viewer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
}

.card-code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent);
}

.card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-image-container {
  flex: 1;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  overflow: auto;
}

.card-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.zoom-controls {
  display: flex;
  gap: 4px;
}

/* Metadata Section */
.metadata-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.metadata-field {
  margin-bottom: 12px;
}

.metadata-field:last-child {
  margin-bottom: 0;
}

.metadata-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.metadata-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.metadata-btn {
  min-width: 36px;
  height: 32px;
  font-size: 0.875rem;
  padding: 0 10px;
}

/* Metadata Dropdown */
.metadata-select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.metadata-select:hover {
  border-color: var(--border-focus);
}

.metadata-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.15);
}

.metadata-select.has-value {
  border-color: var(--accent);
  background-color: rgba(34, 211, 238, 0.08);
}

.metadata-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 8px;
}

/* Questions List */
.questions-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.questions-title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.questions-filter {
  display: flex;
  gap: 4px;
}

.filter-btn {
  font-size: 0.6875rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.questions-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.question-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  transition: background 0.15s ease;
  cursor: pointer;
}

.question-item:hover {
  background: var(--bg-tertiary);
}

.question-item.has-answer {
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
}

.question-item.has-answer:hover {
  background: rgba(34, 211, 238, 0.12);
}

.question-num {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.question-alternatives {
  display: flex;
  gap: 4px;
}

.alt-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s ease;
}

.alt-btn:hover {
  border-color: var(--border-focus);
  color: var(--text-secondary);
}

.alt-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.nav-buttons {
  display: flex;
  gap: 8px;
}

.nav-buttons .btn {
  flex: 1;
  justify-content: center;
}

/* Card Navigator — Status Grid */
.card-navigator {
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 80px;
  max-height: 200px;
}

.navigator-header {
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.navigator-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.navigator-summary {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.navigator-grid {
  flex: 1;
  overflow-y: auto;
  padding: 6px 20px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-content: flex-start;
}

.grid-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.1s ease;
  flex-shrink: 0;
}

.grid-cell:hover {
  transform: scale(1.6);
  z-index: 1;
}

.grid-cell.active {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  transform: scale(1.4);
  z-index: 1;
}

.grid-cell.completed {
  background: var(--success);
}

.grid-cell.in-progress {
  background: var(--warning);
}

.grid-cell.pending {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

/* ============== ADMIN PAGE ============== */

.admin-layout {
  padding: 32px 0;
}

.admin-header {
  margin-bottom: 32px;
}

.admin-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  padding: 20px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.error .stat-value { color: var(--error); }

.stats-grid-6 {
  grid-template-columns: repeat(3, 1fr);
}

@media (min-width: 900px) {
  .stats-grid-6 {
    grid-template-columns: repeat(6, 1fr);
  }
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.tab-btn {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Tables */
.table-wrapper {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--bg-tertiary);
}

th {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

td {
  font-size: 0.875rem;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

tbody tr:hover {
  background: var(--bg-tertiary);
}

tbody tr:last-child td {
  border-bottom: none;
}

.table-actions {
  display: flex;
  gap: 4px;
}

/* Logs */
.log-item {
  display: grid;
  grid-template-columns: 80px 100px 120px 1fr;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}

.log-item:hover {
  background: var(--bg-tertiary);
}

.log-time {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.log-level {
  font-weight: 500;
}

.log-level.info { color: var(--accent); }
.log-level.warning { color: var(--warning); }
.log-level.error { color: var(--error); }
.log-level.debug { color: var(--text-muted); }

.log-action {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.log-details {
  color: var(--text-muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  transform: translateY(20px);
  transition: transform 0.2s ease;
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-body {
  margin-bottom: 24px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }
.toast.warning { border-color: var(--warning); }

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Sidebar Toggle Button (mobile) */
.sidebar-toggle {
  display: none;
}

/* Sidebar Backdrop (mobile) */
.sidebar-backdrop {
  display: none;
}

/* Responsive */
@media (max-width: 1024px) {
  .labeling-layout {
    grid-template-columns: 1fr;
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 49;
    padding: 12px 20px;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: background 0.15s ease;
  }

  .sidebar-toggle:hover {
    background: var(--accent-dim);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 49;
  }

  .sidebar-backdrop.open {
    display: block;
  }

  .labeling-sidebar {
    position: fixed;
    right: 0;
    top: 65px;
    bottom: 0;
    width: 360px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 50;
  }

  .labeling-sidebar.open {
    transform: translateX(0);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Review Role Badge (labeling page) */
.review-role-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-left: 8px;
  vertical-align: middle;
}

.review-role-reviewer_1 {
  background: rgba(34, 211, 238, 0.15);
  color: var(--accent);
}

.review-role-reviewer_2 {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.review-role-tiebreaker {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

/* Conflict Table (admin) */
.conflict-table-wrapper {
  max-height: 400px;
  overflow-y: auto;
}

.conflict-table {
  width: 100%;
  border-collapse: collapse;
}

.conflict-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.conflict-table td {
  font-size: 0.875rem;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.conflict-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, 0.12);
  color: var(--error);
}

/* User Progress (admin table) */
.user-progress {
  min-width: 120px;
}

.user-progress-stats {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 0.8125rem;
  margin-bottom: 4px;
}

.user-progress-bar {
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 2px;
}

.user-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 2px;
  transition: width 0.3s ease;
}

.user-progress-remaining {
  line-height: 1.2;
}

/* Redistribute Modal */
.redistribute-modal {
  max-width: 520px;
}

.redistribute-info {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.redistribute-stat {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-align: center;
}

.redistribute-stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
}

.redistribute-mode-toggle {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.mode-btn {
  flex: 1;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-btn:hover {
  color: var(--text-primary);
}

.mode-btn.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.redistribute-summary {
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--accent);
  text-align: center;
  font-weight: 500;
}

/* Bulk Selection Styles */
.th-checkbox {
  width: 40px;
  text-align: center;
}

.card-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.card-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.card-row-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.card-row-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.row-selected {
  background: rgba(34, 211, 238, 0.08) !important;
}

.row-selected:hover {
  background: rgba(34, 211, 238, 0.12) !important;
}

/* Bulk Action Bar */
.bulk-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(34, 211, 238, 0.08);
  border-bottom: 1px solid rgba(34, 211, 238, 0.2);
}

.bulk-action-info {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
}

.bulk-action-buttons {
  display: flex;
  gap: 8px;
}

/* Bulk Assign Modal Info */
.bulk-assign-info {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.bulk-assign-stat {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.bulk-assign-stat-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}

/* ============== BRUTALIST TABLE FILTERS ============== */

.table-filter-row th {
  padding: 8px 16px;
  background: var(--bg-primary);
  border-bottom: 3px solid var(--border);
}

.filter-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 0;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.1s ease, box-shadow 0.1s ease;
}

.filter-input:focus {
  border-color: var(--accent);
  box-shadow: 4px 4px 0 var(--bg-tertiary);
}

.filter-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.filter-select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 6px 24px 6px 10px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 0;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: border-color 0.1s ease, box-shadow 0.1s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.filter-select:focus {
  border-color: var(--accent);
  box-shadow: 4px 4px 0 var(--bg-tertiary);
}

.filter-select:hover {
  border-color: var(--border-focus);
}

.filter-input.has-value,
.filter-select.has-value {
  border-color: var(--accent);
  background-color: rgba(34, 211, 238, 0.05);
}

/* ============== INDUSTRIAL PAGINATION ============== */

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 3px solid var(--border);
  background: var(--bg-tertiary);
  gap: 16px;
}

.pagination-info {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.pagination-info strong {
  color: var(--text-primary);
  font-weight: 600;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

#cardsPageNumbers,
#masterPageNumbers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 0;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.1s ease;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--text-muted);
  color: var(--text-primary);
  transform: translate(-2px, -2px);
  box-shadow: 2px 2px 0 var(--border);
}

.page-btn:active:not(:disabled) {
  transform: translate(0, 0);
  box-shadow: none;
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
  font-weight: 700;
}

.page-btn.active:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

.page-btn-nav {
  font-size: 1rem;
  letter-spacing: -0.1em;
}

.pagination-separator {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0 4px;
  user-select: none;
}

.page-size-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 16px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

.page-size-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.page-size-select {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 6px 28px 6px 10px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 0;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: border-color 0.1s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.page-size-select:hover {
  border-color: var(--border-focus);
}

.page-size-select:focus {
  border-color: var(--accent);
}

/* Filter clear button */
.filter-clear-btn {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-clear-btn:hover {
  border-color: var(--error);
  color: var(--error);
  background: rgba(248, 113, 113, 0.1);
}

.table-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 20px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}

/* Responsive pagination */
@media (max-width: 768px) {
  .table-pagination {
    flex-wrap: wrap;
    gap: 12px;
  }

  .pagination-info {
    order: 2;
    width: 100%;
    text-align: center;
  }

  .pagination-controls {
    order: 1;
    width: 100%;
    justify-content: center;
  }

  .page-size-wrapper {
    order: 3;
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    width: 100%;
    justify-content: center;
  }
}

/* Tiebreaker Conflict/Agreed Styles */
.question-item.is-conflict {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.question-item.is-conflict.has-answer {
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(251, 191, 36, 0.3);
}

.question-num.conflict-marker::after {
  content: '\26A0';
  font-size: 0.6rem;
  margin-left: 2px;
}

.question-item.is-agreed {
  opacity: 0.55;
  pointer-events: none;
}

.question-item.is-agreed .alt-btn {
  cursor: default;
}

.metadata-field.is-conflict {
  border-left: 3px solid var(--warning);
  padding-left: 8px;
}

.metadata-field.is-agreed {
  opacity: 0.55;
  pointer-events: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-focus);
}
