/* ═══════════════════════════════════════════════
   KUKDO 화학물질 등록 통합관리시스템
   인증 페이지 스타일 (auth.css) v4.0
   ═══════════════════════════════════════════════ */

:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #dbeafe;
  --success:       #059669;
  --success-light: #d1fae5;
  --warning:       #d97706;
  --warning-light: #fef3c7;
  --danger:        #dc2626;
  --danger-light:  #fee2e2;
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
}

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

body {
  font-family: 'Noto Sans KR', -apple-system, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1e293b 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* 배경 파티클 효과 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(37,99,235,.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(124,58,237,.1) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, rgba(5,150,105,.08) 0%, transparent 50%);
  pointer-events: none;
}

/* 떠다니는 원 배경 */
.bg-circles { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.bg-circle {
  position: absolute;
  border-radius: 50%;
  opacity: .06;
  animation: floatCircle linear infinite;
}
.bg-circle:nth-child(1) { width: 300px; height: 300px; background: #2563eb; top: -100px; left: -50px; animation-duration: 20s; }
.bg-circle:nth-child(2) { width: 200px; height: 200px; background: #7c3aed; top: 60%; right: -60px; animation-duration: 25s; animation-delay: -5s; }
.bg-circle:nth-child(3) { width: 150px; height: 150px; background: #059669; bottom: -50px; left: 30%; animation-duration: 18s; animation-delay: -10s; }
@keyframes floatCircle {
  0%   { transform: translateY(0) rotate(0deg); }
  50%  { transform: translateY(-30px) rotate(180deg); }
  100% { transform: translateY(0) rotate(360deg); }
}

/* ─── 로그인 카드 ─── */
.auth-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  background: rgba(255,255,255,.97);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.1);
  overflow: hidden;
  animation: cardIn .5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(30px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* 카드 헤더 */
.auth-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
  padding: 32px 36px 28px;
  text-align: center;
  position: relative;
}
.auth-logo {
  width: 60px; height: 60px;
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-size: 26px; color: #fff;
  backdrop-filter: blur(4px);
}
.auth-header h1 {
  font-size: 22px; font-weight: 800; color: #fff;
  letter-spacing: -.3px; margin-bottom: 4px;
}
.auth-header p { font-size: 12px; color: rgba(255,255,255,.7); }

/* 카드 바디 */
.auth-body { padding: 32px 36px; }

/* 탭 (로그인 / 회원가입) */
.auth-tabs {
  display: flex;
  background: var(--gray-100);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 24px;
  gap: 2px;
}
.auth-tab {
  flex: 1; border: none; background: transparent;
  padding: 9px 0; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--gray-500);
  cursor: pointer; transition: all .2s;
  font-family: inherit;
}
.auth-tab.active {
  background: #fff; color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* 폼 */
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form-group { display: flex; flex-direction: column; gap: 5px; }
.auth-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-form-group label {
  font-size: 12px; font-weight: 600;
  color: var(--gray-600); letter-spacing: .2px;
}
.auth-form-group .required { color: var(--danger); margin-left: 2px; }

.auth-input-wrap { position: relative; }
.auth-input-wrap i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); font-size: 14px; pointer-events: none;
}
.auth-input-wrap.has-toggle i.toggle-pw {
  pointer-events: auto; cursor: pointer; left: auto; right: 12px;
}
.auth-input-wrap.has-toggle i.toggle-pw:hover { color: var(--primary); }

.auth-input {
  width: 100%; padding: 10px 12px 10px 36px;
  border: 1.5px solid var(--gray-200);
  border-radius: 9px; font-size: 13px; color: var(--gray-800);
  font-family: inherit; background: var(--gray-50);
  transition: all .2s; outline: none;
}
.auth-input.no-icon { padding-left: 12px; }
.auth-input:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.auth-input::placeholder { color: var(--gray-300); }
.auth-input.has-pw-toggle { padding-right: 38px; }

select.auth-input { cursor: pointer; }

/* 비밀번호 강도 */
.pw-strength {
  height: 4px; border-radius: 2px; background: var(--gray-200);
  margin-top: 5px; overflow: hidden;
}
.pw-strength-bar {
  height: 100%; border-radius: 2px;
  transition: width .3s, background .3s;
}
.pw-strength-label {
  font-size: 10px; color: var(--gray-400); margin-top: 3px;
  display: flex; justify-content: flex-end;
}

/* 버튼 */
.auth-btn {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 4px;
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
}
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37,99,235,.4); }
.auth-btn:active { transform: none; }
.auth-btn:disabled { opacity: .65; cursor: not-allowed; transform: none; }

/* 구분선 */
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 0; color: var(--gray-300); font-size: 11px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--gray-200);
}

/* 알림 메시지 */
.auth-alert {
  padding: 10px 14px; border-radius: 9px;
  font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  animation: fadeIn .2s ease;
}
.auth-alert.error   { background: var(--danger-light);  color: var(--danger); }
.auth-alert.success { background: var(--success-light); color: var(--success); }
.auth-alert.warning { background: var(--warning-light); color: var(--warning); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* 대기 안내 박스 */
.auth-pending-box {
  text-align: center; padding: 24px 0 8px;
}
.auth-pending-icon {
  width: 64px; height: 64px;
  background: var(--warning-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-size: 28px; color: var(--warning);
}
.auth-pending-box h3 { font-size: 16px; color: var(--gray-800); margin-bottom: 8px; }
.auth-pending-box p  { font-size: 12px; color: var(--gray-500); line-height: 1.6; }

/* 카드 푸터 */
.auth-footer {
  padding: 14px 36px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
  text-align: center;
  font-size: 11px; color: var(--gray-400);
}

/* ─── 관리자 페이지 ─── */
.admin-wrap {
  min-height: 100vh;
  background: var(--gray-50);
  font-family: 'Noto Sans KR', sans-serif;
}

.admin-topbar {
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
  color: #fff;
  padding: 0 28px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  position: sticky; top: 0; z-index: 100;
}
.admin-topbar-l { display: flex; align-items: center; gap: 12px; }
.admin-topbar-l .logo-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.admin-topbar-l h1 { font-size: 16px; font-weight: 700; }
.admin-topbar-l span { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 1px; display: block; }
.admin-topbar-r { display: flex; align-items: center; gap: 12px; font-size: 12px; }
.admin-topbar-r .user-chip {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.12);
  border-radius: 20px; padding: 5px 12px;
}
.admin-back-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px; color: #fff; font-size: 12px;
  font-family: inherit; cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.admin-back-btn:hover { background: rgba(255,255,255,.25); }
.admin-logout-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; background: rgba(220,38,38,.2);
  border: 1px solid rgba(220,38,38,.3);
  border-radius: 8px; color: #fca5a5; font-size: 12px;
  font-family: inherit; cursor: pointer; transition: all .15s;
}
.admin-logout-btn:hover { background: rgba(220,38,38,.35); }

.admin-content { max-width: 1200px; margin: 0 auto; padding: 28px 24px; }

/* 관리자 KPI */
.admin-kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 28px;
}
.admin-kpi {
  background: #fff; border-radius: 12px;
  padding: 18px 20px; border: 1px solid var(--gray-200);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex; align-items: center; gap: 14px;
}
.admin-kpi-icon {
  width: 44px; height: 44px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.kpi-blue   { background: #dbeafe; color: #2563eb; }
.kpi-yellow { background: #fef3c7; color: #d97706; }
.kpi-green  { background: #d1fae5; color: #059669; }
.kpi-red    { background: #fee2e2; color: #dc2626; }
.admin-kpi-val { font-size: 26px; font-weight: 800; color: var(--gray-800); line-height: 1; }
.admin-kpi-label { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* 섹션 카드 */
.admin-section {
  background: #fff; border-radius: 14px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  margin-bottom: 20px; overflow: hidden;
}
.admin-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--gray-100);
}
.admin-section-header h2 {
  font-size: 15px; font-weight: 700; color: var(--gray-800);
  display: flex; align-items: center; gap: 8px;
}
.admin-section-header h2 i { color: var(--primary); }
.admin-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--danger); color: #fff;
  border-radius: 10px; font-size: 11px; font-weight: 700;
}
.admin-badge.blue { background: var(--primary); }
.admin-badge.green { background: var(--success); }

/* 사용자 테이블 */
.user-table { width: 100%; border-collapse: collapse; }
.user-table thead tr {
  background: var(--gray-50); font-size: 11px;
  color: var(--gray-500); font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px;
}
.user-table th { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--gray-200); }
.user-table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); font-size: 13px; vertical-align: middle; }
.user-table tbody tr:hover { background: var(--gray-50); }
.user-table tbody tr:last-child td { border-bottom: none; }

/* 역할 배지 */
.role-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .2px;
}
.role-admin   { background: #ede9fe; color: #7c3aed; }
.role-edit    { background: #d1fae5; color: #065f46; }
.role-view    { background: #dbeafe; color: #1e40af; }
.role-pending { background: #fef3c7; color: #92400e; }

/* 승인 상태 배지 */
.approval-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
}
.approval-대기   { background: var(--warning-light); color: var(--warning); }
.approval-승인   { background: var(--success-light); color: var(--success); }
.approval-반려   { background: var(--danger-light);  color: var(--danger); }

/* 액션 버튼 그룹 */
.action-group { display: flex; gap: 6px; flex-wrap: wrap; }
.act-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px; border-radius: 7px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  border: 1.5px solid; transition: all .15s; font-family: inherit;
}
.act-btn-approve { background: var(--success-light); color: var(--success); border-color: #6ee7b7; }
.act-btn-approve:hover { background: #a7f3d0; }
.act-btn-reject  { background: var(--danger-light);  color: var(--danger);  border-color: #fca5a5; }
.act-btn-reject:hover  { background: #fecaca; }
.act-btn-admin   { background: #ede9fe; color: #7c3aed; border-color: #c4b5fd; }
.act-btn-admin:hover   { background: #ddd6fe; }
.act-btn-edit    { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.act-btn-edit:hover    { background: #a7f3d0; }
.act-btn-view    { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.act-btn-view:hover    { background: #bfdbfe; }
.act-btn-del     { background: var(--gray-100); color: var(--gray-500); border-color: var(--gray-300); }
.act-btn-del:hover     { background: var(--danger-light); color: var(--danger); border-color: #fca5a5; }

/* 권한 선택 드롭다운 */
.role-select {
  padding: 5px 10px; border: 1.5px solid var(--gray-200);
  border-radius: 7px; font-size: 12px; font-family: inherit;
  color: var(--gray-700); background: var(--gray-50);
  cursor: pointer; outline: none;
}
.role-select:focus { border-color: var(--primary); }

/* 검색/필터 바 */
.admin-filter-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50); flex-wrap: wrap;
}
.admin-search {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1.5px solid var(--gray-200);
  border-radius: 8px; padding: 7px 12px; min-width: 200px;
  flex: 1;
}
.admin-search i { color: var(--gray-400); font-size: 13px; }
.admin-search input {
  border: none; outline: none; font-size: 13px;
  font-family: inherit; color: var(--gray-800); width: 100%;
  background: transparent;
}
.admin-filter-sel {
  padding: 8px 12px; border: 1.5px solid var(--gray-200);
  border-radius: 8px; font-size: 12px; font-family: inherit;
  background: #fff; color: var(--gray-700); cursor: pointer;
}

/* 빈 상태 */
.admin-empty {
  text-align: center; padding: 48px 24px;
  color: var(--gray-400);
}
.admin-empty i { font-size: 36px; margin-bottom: 12px; display: block; }
.admin-empty p { font-size: 13px; }

/* 토스트 */
.admin-toast {
  position: fixed; bottom: 28px; right: 28px;
  padding: 12px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  display: flex; align-items: center; gap: 8px;
  opacity: 0; transform: translateY(10px);
  transition: all .3s; pointer-events: none; z-index: 999;
}
.admin-toast.show { opacity: 1; transform: none; }
.admin-toast.success { background: var(--success); }
.admin-toast.error   { background: var(--danger); }
.admin-toast.info    { background: var(--primary); }

/* ─── 회원가입 스텝 인디케이터 ─── */
.auth-card { max-width: 480px; }

.reg-steps {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px; gap: 0;
}
.reg-step {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: 0 0 auto;
}
.reg-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gray-200); color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; transition: all .3s;
}
.reg-step-label {
  font-size: 10px; color: var(--gray-400); font-weight: 500;
  white-space: nowrap; transition: all .3s;
}
.reg-step.active .reg-step-num {
  background: var(--primary); color: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.2);
}
.reg-step.active .reg-step-label { color: var(--primary); font-weight: 700; }
.reg-step.completed .reg-step-num {
  background: var(--success); color: #fff;
}
.reg-step.completed .reg-step-label { color: var(--success); }
.reg-step-line {
  flex: 1; height: 2px; background: var(--gray-200);
  margin: 0 6px; margin-bottom: 18px; min-width: 24px;
  transition: background .3s;
}

/* 스텝 패널 */
.reg-step-panel { animation: fadeIn .25s ease; }
.step-title {
  font-size: 14px; font-weight: 700; color: var(--gray-700);
  margin-bottom: 18px; display: flex; align-items: center; gap: 8px;
  padding-bottom: 10px; border-bottom: 1px solid var(--gray-100);
}
.step-title i { color: var(--primary); }

/* 아웃라인 버튼 */
.auth-btn-outline {
  background: #fff !important;
  color: var(--gray-600) !important;
  border: 1.5px solid var(--gray-300) !important;
  box-shadow: none !important;
}
.auth-btn-outline:hover {
  background: var(--gray-50) !important;
  transform: translateY(-1px);
}

/* ─── OTP 이메일 인증 ─── */
.otp-info-box {
  display: flex; align-items: flex-start; gap: 10px;
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 10px; padding: 12px 14px;
  font-size: 12px; color: #1e40af; margin-bottom: 16px;
  line-height: 1.5;
}
.otp-info-box i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.otp-info-box strong { font-weight: 700; display: block; margin-bottom: 2px; }

.otp-send-btn {
  padding: 0 16px; height: 42px; /* same height as auth-input */
  background: var(--primary); color: #fff;
  border: none; border-radius: 0 8px 8px 0;
  font-size: 12px; font-weight: 700; cursor: pointer;
  font-family: inherit; white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
  transition: background .2s; flex-shrink: 0;
}
.otp-send-btn:hover:not(:disabled) { background: var(--primary-dark); }
.otp-send-btn:disabled { opacity: .65; cursor: not-allowed; }

.otp-timer {
  font-size: 11px; font-weight: 500;
  color: var(--primary); margin-left: 6px;
}

/* 개발 모드 OTP 표시 박스 */
.otp-dev-box {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fffbeb; border: 1.5px dashed #f59e0b;
  border-radius: 10px; padding: 12px 14px;
  font-size: 12px; color: var(--gray-700); margin-top: 10px;
  line-height: 1.6;
}
.otp-dev-box i { font-size: 16px; flex-shrink: 0; margin-top: 2px; }

/* 인증 완료 메시지 */
.otp-verified-msg {
  display: flex; align-items: center; gap: 8px;
  background: var(--success-light); border-radius: 9px;
  padding: 10px 14px; font-size: 12px; font-weight: 600;
  color: var(--success); margin-top: 10px;
  animation: fadeIn .3s ease;
}

/* 비밀번호 규칙 박스 */
.pw-rule-box {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; margin-top: 6px;
}
.pw-rule {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--gray-400); font-weight: 500;
  transition: color .2s;
}
.pw-rule i { font-size: 10px; transition: color .2s; }
.pw-rule.ok { color: var(--success); }
.pw-rule.ok i { color: var(--success); }

/* ─── 카드 너비 (회원가입 스텝 2에서 좀 더 넓게) ─── */
.auth-card { max-width: 480px; }

/* 반응형 */
@media (max-width: 640px) {
  .auth-card { max-width: 100%; margin: 16px; border-radius: 16px; }
  .auth-body { padding: 24px 20px; }
  .auth-header { padding: 24px 20px 20px; }
  .auth-form-row { grid-template-columns: 1fr; }
  .admin-kpi-row { grid-template-columns: 1fr 1fr; }
  .admin-content { padding: 16px 14px; }
  .reg-step-label { display: none; }
  .reg-step-line { min-width: 16px; }
  .pw-rule-box { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .admin-kpi-row { grid-template-columns: 1fr; }
}
