/* ============================================ */
/* 관리자 페이지 스타일                         */
/* ============================================ */

:root {
  --primary: #fd761a;
  --primary-hover: #e05f0d;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── 상단바 ── */
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-topbar__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-topbar__back {
  font-size: 20px;
  text-decoration: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s;
}

.admin-topbar__back:hover {
  background: var(--bg);
}

.admin-topbar__brand {
  font-size: 18px;
  font-weight: 700;
}

.admin-topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-topbar__user {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── 탭 ── */
.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.admin-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  white-space: nowrap;
  transition: all 0.2s;
}

.admin-tab:hover {
  background: var(--bg);
  color: var(--text);
}

.admin-tab.active {
  background: var(--primary);
  color: white;
}

/* ── 패널 ── */
.admin-panel {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 32px;
}

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

.panel-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── 테이블 ── */
.table-container {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table thead {
  background: var(--bg);
}

.admin-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:hover {
  background: #f8fafc;
}

.loading-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px !important;
}

.action-cell {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

/* ── 그룹 배지 ── */
.group-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── 입력 요소 ── */
.admin-input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.admin-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(253, 118, 26, 0.1);
}

.admin-select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
}

/* ── 버튼 ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.btn--primary {
  background: var(--primary);
  color: white;
}

.btn--primary:hover {
  background: var(--primary-hover);
}

.btn--outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn--outline:hover {
  background: var(--bg);
}

.btn--danger {
  background: var(--danger);
  color: white;
}

.btn--danger:hover {
  background: var(--danger-hover);
}

.btn--sm { padding: 6px 14px; font-size: 13px; }
.btn--xs { padding: 4px 10px; font-size: 12px; }

/* ── 크레딧 충전 폼 ── */
.credit-charge-form {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  max-width: 600px;
}

.form-row {
  margin-bottom: 20px;
}

.form-row label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
}

.form-row .admin-input,
.form-row .admin-select {
  width: 100%;
}

.charge-presets {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.preset-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  font-family: inherit;
}

.preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.charge-result {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

.charge-result--success {
  background: #ecfdf5;
  color: #065f46;
}

.charge-result--error {
  background: #fef2f2;
  color: #991b1b;
}

/* ── 통계 카드 ── */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
}

.stat-card__label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-card__value {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
}

.stats-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.stats-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ── 바 차트 ── */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 200px;
  padding: 20px 0;
  justify-content: center;
}

.bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.bar {
  width: 40px;
  background: linear-gradient(to top, var(--primary), #818cf8);
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height 0.5s ease;
}

.bar-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.bar-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

/* ── 모달 ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 480px;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal__header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal__close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal__body {
  padding: 24px;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── 토스트 ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  animation: toastIn 0.3s ease;
  transition: opacity 0.3s, transform 0.3s;
}

.toast--success { border-left: 4px solid var(--success); }
.toast--error { border-left: 4px solid var(--danger); }
.toast--info { border-left: 4px solid var(--primary); }

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

/* ── 반응형 ── */
@media (max-width: 768px) {
  .admin-topbar { padding: 12px 16px; }
  .admin-tabs { padding: 8px 16px; }
  .admin-panel { padding: 0 16px; margin: 16px auto; }
  .panel-header { flex-direction: column; align-items: flex-start; }
  .panel-actions { width: 100%; }
  .stats-cards { grid-template-columns: repeat(2, 1fr); }
  .credit-charge-form { padding: 20px; }
  .action-cell { flex-wrap: wrap; }
}
