/* 회원 관리 CSS */
.user-admin {
  --pad: 16px;
  box-sizing: border-box;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(60px + 16px) var(--pad) 100px;
  color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Noto Sans KR", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.user-admin *, .user-admin *::before, .user-admin *::after {
  box-sizing: border-box;
}

.user-admin-header {
  margin-bottom: 20px;
}
.user-admin-header h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-admin-header .sub {
  color: #6b7280;
  font-size: 14px;
  margin: 0;
}

/* 통계 카드 그리드 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}
.stat-card .label {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-card .value {
  font-size: 22px;
  font-weight: 800;
  color: #111827;
}
.stat-card.primary .value {
  color: #2563eb;
}
.stat-card.success .value {
  color: #059669;
}
.stat-card.warning .value {
  color: #ea580c;
}
.stat-card.danger .value {
  color: #dc2626;
}

/* 상단 탭 네비게이션 */
.user-tabs {
  position: sticky;
  top: 60px;
  z-index: 20;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 calc(var(--pad) * -1) 20px;
  padding: 10px var(--pad);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #e5e7eb;
  scrollbar-width: none;
}
.user-tabs::-webkit-scrollbar {
  display: none;
}
.user-tabs button {
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  color: #4b5563;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.user-tabs button:hover {
  background: #f3f4f6;
  color: #111827;
}
.user-tabs button.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* 패널 */
.user-panel {
  display: none;
}
.user-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 카드 및 컨테이너 */
.content-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  margin-bottom: 24px;
}
.content-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f3f4f6;
}
.content-card-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* 입력 양식 */
.search-input, .filter-select, .form-input, .form-textarea {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #1f2937;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus, .filter-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.search-input {
  width: 220px;
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  background: #2563eb;
  color: #ffffff;
}
.btn:hover {
  background: #1d4ed8;
}
.btn.secondary {
  background: #ffffff;
  border-color: #d1d5db;
  color: #374151;
}
.btn.secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}
.btn.danger {
  background: #ef4444;
  color: #ffffff;
}
.btn.danger:hover {
  background: #dc2626;
}
.btn.success {
  background: #10b981;
  color: #ffffff;
}
.btn.success:hover {
  background: #059669;
}
.btn.small {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
}

/* 테이블 */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
.admin-table th {
  background: #f9fafb;
  color: #4b5563;
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
  vertical-align: middle;
}
.admin-table tbody tr:hover {
  background: #f9fafb;
}

/* 뱃지 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
.badge-kakao {
  background: #fee500;
  color: #3c1e1e;
}
.badge-naver {
  background: #03c75a;
  color: #ffffff;
}
.badge-google {
  background: #ea4335;
  color: #ffffff;
}
.badge-apple {
  background: #000000;
  color: #ffffff;
}
.badge-general {
  background: #6b7280;
  color: #ffffff;
}
.badge-active {
  background: #d1fae5;
  color: #065f46;
}
.badge-withdrawn {
  background: #fee2e2;
  color: #991b1b;
}
.badge-point {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
}

/* 모달 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open {
  display: flex;
}
.modal-window {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #111827;
}
.modal-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
}
.modal-close-btn:hover {
  color: #111827;
}
.modal-body {
  padding: 20px;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-radius: 0 0 16px 16px;
}

/* 상세 폼 그리드 */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.detail-item.full {
  grid-column: span 2;
}
.detail-item label {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
}
.detail-item .value-text {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  padding: 6px 0;
}

/* 포인트 요약 미니 박스 */
.point-mini-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

/* 토스트 메시지 */
#adminToast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f2937;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  display: none;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 모바일 반응형 */
@media (max-width: 640px) {
  .user-admin {
    padding: calc(60px + env(safe-area-inset-top, 0px) + 12px) 12px calc(80px + env(safe-area-inset-bottom, 0px));
  }
  .user-admin-header h2 {
    font-size: 20px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 12px 10px;
    border-radius: 12px;
  }
  .stat-card .label {
    font-size: 11px;
    margin-bottom: 4px;
    gap: 4px;
  }
  .stat-card .value {
    font-size: 18px;
  }
  .user-tabs {
    top: calc(60px + env(safe-area-inset-top, 0px));
    margin: 0 -12px 16px;
    padding: 8px 12px 10px;
    gap: 6px;
  }
  .user-tabs button {
    padding: 8px 14px;
    font-size: 13px;
    min-height: 38px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .content-card {
    padding: 14px 12px;
    border-radius: 12px;
  }
  .content-card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .content-card-header h3 {
    font-size: 15px;
  }
  .toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  .toolbar .filter-select,
  .toolbar .search-input {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    font-size: 14px;
    height: 42px;
  }
  .toolbar .btn {
    flex: 1 1 0;
    height: 42px;
    font-size: 13.5px;
    padding: 0 10px;
  }
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 10px;
  }
  .admin-table {
    min-width: 650px;
  }
  .admin-table th, .admin-table td {
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
  }
  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }
  .modal-window {
    max-height: 88vh;
    border-radius: 18px 18px 12px 12px;
  }
  .modal-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .modal-body {
    padding: 16px 14px;
  }
  .modal-footer {
    padding: 12px 14px;
    gap: 8px;
  }
  .modal-footer .btn {
    flex: 1;
    min-height: 42px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-item.full {
    grid-column: span 1;
  }
}
