/* ============================================================
   比赛报名系统 — 自定义样式
   基于 Bootstrap 5.3.3，现代简约政务风
   ============================================================ */

/* ---- CSS Custom Properties ---- */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0891b2;
  --info-light: #cffafe;
  --bg: #f0f2f5;
  --bg-white: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.06), 0 4px 6px rgba(0,0,0,0.04);
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --sidebar-width: 240px;
  --topbar-height: 56px;
}

/* ---- Global ---- */
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
               "Noto Sans SC", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ---- Top Navigation Bar ---- */
.app-navbar {
  height: var(--topbar-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.app-navbar .navbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.app-navbar .navbar-brand .brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--info));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem;
}
.sidebar-toggle {
  display: none;
  background: none; border: none;
  font-size: 1.4rem; color: var(--text-muted);
  padding: 0.25rem; cursor: pointer;
}
@media (max-width: 767.98px) {
  .sidebar-toggle { display: block; }
}

/* ---- Global Footer ---- */
.app-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-light);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-light);
  margin-top: 2rem;
}

/* ---- Custom Card ---- */
.card-custom {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.card-custom:hover { box-shadow: var(--shadow-md); }
.card-custom .card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-light);
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-main);
}
.card-custom .card-body { padding: 1.25rem; }

/* ---- Stats Cards (Dashboard) ---- */
.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.stat-card.stat-pending  { border-left: 4px solid var(--warning); }
.stat-card.stat-pending  .stat-value { color: var(--warning); }
.stat-card.stat-approved { border-left: 4px solid var(--success); }
.stat-card.stat-approved .stat-value { color: var(--success); }
.stat-card.stat-rejected { border-left: 4px solid var(--danger); }
.stat-card.stat-rejected .stat-value { color: var(--danger); }
.stat-card.stat-info     { border-left: 4px solid var(--info); }
.stat-card.stat-info     .stat-value { color: var(--info); }
.stat-card.stat-primary  { border-left: 4px solid var(--primary); }
.stat-card.stat-primary  .stat-value { color: var(--primary); }

/* ---- Filter Tabs ---- */
.filter-tabs {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  margin-bottom: 1rem;
}
.filter-tabs .tab-link {
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-white);
  transition: all 0.15s;
  text-decoration: none;
}
.filter-tabs .tab-link:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.filter-tabs .tab-link.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---- Custom Table ---- */
.table-custom {
  width: 100%;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.table-custom thead th {
  background: var(--border-light);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-custom tbody td {
  padding: 0.7rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}
.table-custom tbody tr:hover { background: #f8fafc; }
.table-custom tbody tr:last-child td { border-bottom: none; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  opacity: 0.6;
}
.empty-state .empty-text {
  font-size: 0.95rem;
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap; gap: 0.5rem;
}
.page-header h4 {
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  font-size: 1.25rem;
}

/* ---- Buttons ---- */
.btn {
  border-radius: var(--radius);
  font-weight: 500;
  padding: 0.45rem 1rem;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.85rem; }
.btn-lg { padding: 0.6rem 1.5rem; font-size: 1rem; }

/* ---- Auth Pages (Login/Register) ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 50%, #ecfeff 100%);
}
.auth-container {
  display: flex;
  width: 100%;
  max-width: 960px;
  margin: auto;
  min-height: 540px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.auth-brand {
  flex: 1;
  background: linear-gradient(135deg, var(--primary) 0%, #0891b2 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  text-align: center;
}
.auth-brand h2 { font-weight: 700; margin-bottom: 0.5rem; }
.auth-brand p { opacity: 0.85; font-size: 0.95rem; }
.auth-form {
  flex: 1;
  background: var(--bg-white);
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-form h3 { font-weight: 700; margin-bottom: 1.5rem; color: var(--text-main); }
.auth-form .form-label { font-weight: 500; color: var(--text-main); font-size: 0.9rem; }
.auth-form .form-control {
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: 0.55rem 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-form .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.auth-form .btn-primary { width: 100%; padding: 0.65rem; font-size: 1rem; }
@media (max-width: 767.98px) {
  .auth-brand { display: none; }
  .auth-container { max-width: 100%; margin: 1rem; min-height: auto; }
}

/* ---- Public Page (centered card) ---- */
.public-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
}

/* ---- Hero (Homepage) ---- */
.hero-section {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 40%, #0891b2 100%);
  color: #fff;
  padding: 4rem 1.5rem;
  text-align: center;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.hero-section h1 { font-weight: 800; font-size: 2.25rem; margin-bottom: 0.75rem; }
.hero-section p { opacity: 0.9; font-size: 1.1rem; max-width: 500px; margin: 0 auto 1.5rem; }
.hero-section .btn {
  padding: 0.65rem 2rem;
  font-size: 1rem;
  border-radius: 30px;
  font-weight: 600;
}
.hero-section .btn-light {
  background: rgba(255,255,255,0.95);
  color: var(--primary);
  border: none;
}
.hero-section .btn-outline-light {
  border: 2px solid rgba(255,255,255,0.5);
  color: #fff;
}
.hero-section .btn-outline-light:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* ---- Event Cards (Homepage) ---- */
.event-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.event-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.event-card .event-name { font-weight: 600; color: var(--text-main); }
.event-card .event-desc { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; }

/* ---- Status Timeline (Status Result) ---- */
.status-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}
.status-timeline li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}
.status-timeline li:last-child { border-bottom: none; }
.status-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.status-dot.done   { background: var(--success); }
.status-dot.active { background: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,0.2); }
.status-dot.pending{ background: var(--border); }
.status-dot.reject { background: var(--danger); }

/* ---- Sidebar (Admin) ---- */
.admin-layout {
  display: flex;
  min-height: calc(100vh - var(--topbar-height));
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1040;
}
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  flex-shrink: 0;
  overflow-y: auto;
}
.sidebar .nav-section {
  padding: 0.5rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.5rem;
}
.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: all 0.1s;
  border-left: 3px solid transparent;
}
.sidebar .nav-link:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
}
.sidebar .nav-link .nav-icon { font-size: 1.1rem; width: 1.3rem; text-align: center; }
.main-content {
  flex: 1;
  padding: 1.5rem;
  overflow-x: auto;
}

@media (max-width: 767.98px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main-content { padding: 1rem; }
}

/* ---- Badge Overrides ---- */
.badge {
  font-weight: 500;
  font-size: 0.8rem;
  padding: 0.25em 0.6em;
  border-radius: 6px;
}

/* ---- Alerts (Django Messages) ---- */
.alert {
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  padding: 0.75rem 1.25rem;
}
.alert-success { background: var(--success-light); color: #065f46; }
.alert-danger  { background: var(--danger-light); color: #991b1b; }
.alert-warning { background: var(--warning-light); color: #92400e; }
.alert-info    { background: var(--info-light); color: #0e7490; }

/* ---- Review Detail Card ---- */
.review-info td.label-col {
  width: 140px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
}

/* ---- Misc ---- */
.form-control, .form-select {
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-label { font-weight: 500; color: var(--text-main); font-size: 0.9rem; }
.table-responsive { border-radius: var(--radius-lg); }

/* ---- Steps Indicator ---- */
.steps { display: flex; justify-content: center; gap: 0.5rem; margin-bottom: 1.5rem; }
.step {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--border-light);
  color: var(--text-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 600;
}
.step.done { background: var(--success); color: #fff; }
.step.active { background: var(--primary); color: #fff; }
