/* ============================================
   JGCMS 后台管理 — 韩式活泼风格
   Vibrant Korean-inspired admin panel
   ============================================ */

:root {
  --pink: #FF6B9D;
  --pink-light: #FFE0EC;
  --coral: #FF8A65;
  --coral-light: #FFF0E8;
  --purple: #7C4DFF;
  --purple-light: #EDE7FF;
  --cyan: #00BCD4;
  --cyan-light: #E0F7FA;
  --yellow: #FFD54F;
  --yellow-light: #FFF9E1;
  --green: #66BB6A;
  --green-light: #E8F5E9;
  --bg: #F8F9FF;
  --card-bg: #FFFFFF;
  --text: #2D3436;
  --text-secondary: #636E72;
  --text-muted: #B2BEC3;
  --border: #F0F0F5;
  --shadow: 0 2px 12px rgba(124, 77, 255, 0.06);
  --shadow-hover: 0 8px 30px rgba(124, 77, 255, 0.10);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Login Page ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 50%, var(--cyan) 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-wrapper::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  top: -100px; right: -100px;
}
.login-wrapper::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  bottom: -80px; left: -80px;
}

.login-card {
  background: white;
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  position: relative;
  z-index: 1;
  text-align: center;
}
.login-logo { font-size: 48px; margin-bottom: 8px; display: block; }
.login-title {
  font-size: 24px; font-weight: 800; color: var(--text);
  margin-bottom: 4px;
}
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 32px; }
.login-input {
  width: 100%; padding: 14px 20px;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  font-size: 16px; outline: none; transition: all .2s;
  text-align: center; letter-spacing: 2px;
}
.login-input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-light); }
.login-btn {
  width: 100%; margin-top: 16px; padding: 14px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: white; border: none; border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 700; cursor: pointer;
  transition: all .2s;
}
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(124, 77, 255, 0.3); }
.login-error {
  background: #FFF0F0; color: #E74C3C; padding: 10px; border-radius: var(--radius-xs);
  margin-top: 12px; font-size: 13px; display: none;
}

/* ===== Admin Layout ===== */
.admin-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 250px;
  background: white;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  box-shadow: 2px 0 20px rgba(0,0,0,0.03);
}
.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand .brand-icon { font-size: 28px; }
.sidebar-brand .brand-text { font-size: 18px; font-weight: 800; color: var(--text); }
.sidebar-brand .brand-ver { font-size: 11px; color: var(--text-muted); }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-group { padding: 0 16px; }
.nav-group-title {
  font-size: 11px; text-transform: uppercase; font-weight: 700;
  color: var(--text-muted); padding: 16px 4px 8px; letter-spacing: 1px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px; font-weight: 600;
  transition: all .15s;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--purple-light); color: var(--purple); }
.nav-item.active { background: linear-gradient(135deg, var(--purple-light), var(--pink-light)); color: var(--purple); font-weight: 700; }
.nav-item .nav-icon { font-size: 18px; width: 24px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--pink); color: white;
  font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 700;
}

.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border);
  text-align: center;
}
.sidebar-footer a {
  color: var(--text-muted); text-decoration: none; font-size: 12px;
  transition: color .2s;
}
.sidebar-footer a:hover { color: var(--pink); }

/* Main Content */
.main-content {
  margin-left: 250px;
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 26px; font-weight: 800; color: var(--text); }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: white; border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); transition: all .2s;
  position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.stat-card::after {
  content: ''; position: absolute; top: -20px; right: -20px;
  width: 80px; height: 80px; border-radius: 50%; opacity: .08;
}
.stat-card.pink::after { background: var(--pink); }
.stat-card.purple::after { background: var(--purple); }
.stat-card.cyan::after { background: var(--cyan); }
.stat-card.coral::after { background: var(--coral); }
.stat-card.green::after { background: var(--green); }
.stat-card.yellow::after { background: var(--yellow); }

.stat-card .stat-icon { font-size: 36px; display: block; margin-bottom: 12px; }
.stat-card .stat-value { font-size: 32px; font-weight: 900; color: var(--text); }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-card .stat-change { font-size: 12px; margin-top: 8px; font-weight: 600; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--pink); }

/* Cards */
.card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.card-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title .icon { font-size: 20px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-xs);
  font-size: 14px; font-weight: 700; cursor: pointer; border: none;
  transition: all .2s; text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--purple), var(--pink)); color: white; }
.btn-primary:hover { box-shadow: 0 4px 16px rgba(124, 77, 255, 0.3); }
.btn-success { background: linear-gradient(135deg, var(--green), #43A047); color: white; }
.btn-warning { background: linear-gradient(135deg, var(--coral), #FF7043); color: white; }
.btn-cyan { background: linear-gradient(135deg, var(--cyan), #0097A7); color: white; }
.btn-outline {
  background: white; color: var(--purple); border: 2px solid var(--purple);
}
.btn-outline:hover { background: var(--purple-light); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-xs { padding: 3px 10px; font-size: 11px; border-radius: 6px; }
.btn-danger { background: var(--pink); color: white; }

/* Tables */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
}
th {
  text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 2px solid var(--border);
}
td {
  padding: 14px 16px; font-size: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tr:hover td { background: #F8F9FF; }
.text-mono { font-family: "SF Mono", "Fira Code", monospace; font-size: 13px; }
.code-block {
  background: #F8F9FF; padding: 2px 8px; border-radius: 4px;
  font-family: "SF Mono", monospace; font-size: 13px;
}

/* Tags / Badges */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}
.badge-pink { background: var(--pink-light); color: var(--pink); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-cyan { background: var(--cyan-light); color: var(--cyan); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-yellow { background: var(--yellow-light); color: #F9A825; }
.badge-coral { background: var(--coral-light); color: var(--coral); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 700; color: var(--text);
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 12px 16px;
  border: 2px solid var(--border); border-radius: var(--radius-xs);
  font-size: 14px; outline: none; transition: all .2s;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-light);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 150px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 100;
  display: none; align-items: center; justify-content: center;
  animation: fadeIn .2s;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: white; border-radius: var(--radius); padding: 32px;
  width: 90%; max-width: 560px; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: slideUp .3s ease;
}
.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

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

/* Toast */
.toast {
  position: fixed; top: 24px; right: 24px; z-index: 200;
  padding: 14px 24px; border-radius: var(--radius-xs);
  color: white; font-weight: 600; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  animation: slideInRight .3s ease; display: none;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--pink); }
.toast.show { display: block; }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Empty State */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state .empty-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state .empty-title { font-size: 16px; font-weight: 700; color: var(--text); }
.empty-state .empty-desc { font-size: 13px; color: var(--text-muted); margin: 4px 0 16px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-nav { display: flex; overflow-x: auto; padding: 8px; }
  .nav-group { display: flex; gap: 4px; padding: 0; }
  .nav-group-title { display: none; }
  .nav-item { flex-shrink: 0; white-space: nowrap; }
  .sidebar-footer { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-wrapper { flex-direction: column; }
}

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 16px; border-radius: 20px; border: none;
  background: var(--border); color: var(--text-secondary);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s;
}
.tab-btn:hover { background: var(--purple-light); color: var(--purple); }
.tab-btn.active { background: var(--purple); color: white; }

/* Grade Card Grid */
.grade-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.grade-card {
  background: white; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); text-align: center; cursor: pointer;
  transition: all .2s; border: 2px solid transparent;
}
.grade-card:hover { border-color: var(--purple); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.grade-card .gc-emoji { font-size: 40px; display: block; margin-bottom: 8px; }
.grade-card .gc-name { font-size: 16px; font-weight: 700; }
.grade-card .gc-count { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
