/* ============================================ */
/* yw.icu - 期末试卷收取系统                      */
/* Tech-forward sci-fi aesthetic                  */
/* ============================================ */

:root {
  --bg-primary: #0a0a12;
  --bg-secondary: #0f0f1a;
  --bg-card: rgba(18, 18, 35, 0.85);
  --bg-card-hover: rgba(24, 24, 48, 0.9);
  --border-glow: rgba(56, 189, 248, 0.15);
  --border-glow-hover: rgba(56, 189, 248, 0.35);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-cyan: #38bdf8;
  --accent-blue: #6366f1;
  --accent-purple: #a855f7;
  --accent-gradient: linear-gradient(135deg, #38bdf8, #6366f1, #a855f7);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  color: var(--text-primary);
  position: relative;
  overflow-x: hidden;
}

/* Animated background grid */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: 0;
  pointer-events: none;
}

/* Animated gradient orb */
body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at 30% 40%,
    rgba(56, 189, 248, 0.04) 0%,
    rgba(99, 102, 241, 0.03) 30%,
    rgba(168, 85, 247, 0.02) 60%,
    transparent 80%
  );
  z-index: 0;
  pointer-events: none;
  animation: orbMove 20s ease-in-out infinite;
}

@keyframes orbMove {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(5%, 3%); }
  50% { transform: translate(-3%, 5%); }
  75% { transform: translate(2%, -3%); }
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* ========== Card ========== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius);
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 40px rgba(56, 189, 248, 0.05), inset 0 1px 0 rgba(56, 189, 248, 0.05);
  padding: 36px;
  margin-top: 40px;
  transition: all 0.3s ease;
}

.card:hover {
  border-color: var(--border-glow-hover);
  box-shadow: 0 0 60px rgba(56, 189, 248, 0.08), inset 0 1px 0 rgba(56, 189, 248, 0.08);
}

.card-header {
  text-align: center;
  margin-bottom: 28px;
}

.card-header h1 {
  font-size: 26px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.card-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ========== Form ========== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: var(--radius-xs);
  outline: none;
  transition: all 0.25s ease;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-family: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', monospace;
}

.form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1), 0 0 20px rgba(56, 189, 248, 0.05);
  background: rgba(0, 0, 0, 0.4);
}

.form-input::placeholder {
  color: var(--text-muted);
  font-family: 'Inter', -apple-system, sans-serif;
}

/* ========== Button ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(56, 189, 248, 0.25);
}

.btn-primary:disabled {
  background: rgba(56, 189, 248, 0.1);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.25);
}

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

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.25);
}

.btn-outline {
  background: rgba(56, 189, 248, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-glow);
}

.btn-outline:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
}

/* ========== Alert / Message ========== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-xs);
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(10px);
}

.alert-success {
  background: rgba(16, 185, 129, 0.08);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.08);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
  background: rgba(56, 189, 248, 0.08);
  color: #60a5fa;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

/* ========== Upload Area ========== */
.upload-area {
  border: 1px dashed rgba(56, 189, 248, 0.2);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(0, 0, 0, 0.2);
}

.upload-area:hover {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.03);
  box-shadow: inset 0 0 30px rgba(56, 189, 248, 0.03);
}

.upload-area.dragover {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.05);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.08);
  transform: scale(1.01);
}

.upload-area .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.8;
}

.upload-area p {
  color: var(--text-muted);
  font-size: 14px;
}

.upload-area .filename {
  color: var(--accent-cyan);
  font-weight: 600;
  font-size: 14px;
  margin-top: 8px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
}

.upload-area input[type="file"] {
  display: none;
}

/* ========== File Info ========== */
.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-glow);
  margin-top: 16px;
}

.file-info .file-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.file-info .file-size {
  font-size: 13px;
  color: var(--text-muted);
  font-family: 'SF Mono', monospace;
}

/* ========== Admin ========== */
.admin-layout {
  max-width: 1100px;
}

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

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-sm);
  padding: 20px;
  border: 1px solid var(--border-glow);
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: var(--border-glow-hover);
  transform: translateY(-2px);
}

.stat-card .stat-number {
  font-size: 36px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: 'SF Mono', monospace;
  letter-spacing: -1px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-card.success .stat-number {
  background: linear-gradient(135deg, #10b981, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card.warning .stat-number {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========== Student Table ========== */
.table-wrap {
  overflow-x: auto;
}

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

table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

table td {
  padding: 12px 14px;
  font-size: 14px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.05);
  color: var(--text-secondary);
}

table tr:hover td {
  background: rgba(56, 189, 248, 0.03);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ========== Header Bar ========== */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin-bottom: 8px;
}

.header-bar h2 {
  font-size: 20px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.header-bar .actions {
  display: flex;
  gap: 10px;
}

/* ========== Overlay / Modal ========== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: var(--radius);
  padding: 36px;
  max-width: 420px;
  width: 90%;
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 60px rgba(56, 189, 248, 0.1);
  text-align: center;
}

.modal h3 {
  font-size: 20px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.modal p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
}

.modal .countdown {
  font-size: 56px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 16px 0;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
}

/* ========== Toolbar ========== */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.search-box {
  padding: 8px 14px;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xs);
  font-size: 14px;
  outline: none;
  flex: 1;
  min-width: 200px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  transition: all 0.25s ease;
}

.search-box:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.08);
}

/* ========== Responsive ========== */
@media (max-width: 640px) {
  .container { padding: 12px; }
  .card { padding: 20px; margin-top: 20px; }
  .stats-row { grid-template-columns: 1fr; }
  .header-bar { flex-direction: column; gap: 12px; }
  .header-bar .actions { width: 100%; }
  .header-bar .actions .btn { flex: 1; }
}

/* ========== Animation ========== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

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

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(56, 189, 248, 0.1);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

.empty-state .icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state p {
  font-size: 15px;
}

/* Status dot indicators */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.submitted {
  background: var(--success);
  box-shadow: 0 0 6px var(--success-glow);
}

.status-dot.pending {
  background: var(--text-muted);
}

/* ========== Login page specific ========== */
.login-card {
  max-width: 420px;
  margin: 80px auto;
}

.login-tip {
  text-align: center;
  font-size: 13px;
  margin-top: 20px;
}

.login-tip a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.login-tip a:hover {
  color: var(--accent-cyan);
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.25);
}

/* ========== Input autofill fix ========== */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0px 1000px rgba(0, 0, 0, 0.4) inset;
  transition: background-color 5000s ease-in-out 0s;
}

/* ========== Selection ========== */
::selection {
  background: rgba(56, 189, 248, 0.2);
  color: #fff;
}

/* ========== Export progress ========== */
.export-progress {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xs);
  margin-bottom: 16px;
}

.export-progress.active {
  display: flex;
}

/* ========== Admin page card table ========== */
.card-table-wrap {
  overflow: hidden;
  border-radius: var(--radius-sm);
}

/* ========== Toggle Switch ========== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--border-glow);
  border-radius: 24px;
  transition: all 0.3s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  border-color: transparent;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* ========== Tooltip ========== */
.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  transition: all 0.2s;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.tooltip-icon:hover {
  background: rgba(56, 189, 248, 0.25);
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  border: 1px solid var(--border-glow);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 100;
  transition: all 0.2s ease;
  pointer-events: none;
  max-width: 320px;
  width: max-content;
  min-width: 140px;
  white-space: normal;
  text-align: center;
}

.tooltip-wrap:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* ========== Date Input ========== */
.date-input {
  padding: 8px 14px;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xs);
  font-size: 14px;
  outline: none;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  min-width: 160px;
  transition: all 0.25s ease;
  cursor: pointer;
}

.date-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.08);
}

.date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

/* ========== Quick Date Buttons ========== */
.btn-quick-date {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xs);
  background: rgba(56, 189, 248, 0.05);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-quick-date:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  transform: translateY(-1px);
}
