/* =============================================
   auth.css — 탁상감정 인증 공통 스타일
   (login.html / profile.html / admin.html 공유)
   ============================================= */

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

body {
  font-family: 'Noto Sans KR', 'Pretendard', sans-serif;
  background: #f1f5f9;
  color: #0f172a;
  min-height: 100vh;
}

/* ── 공통 카드 ── */
.auth-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(15,23,42,.08);
  padding: 40px 44px;
}

/* ── 공통 폼 ── */
.auth-field { margin-bottom: 18px; }
.auth-field label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
  letter-spacing: .02em;
}
.auth-field input,
.auth-field select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: .95rem;
  color: #0f172a;
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
  outline: none;
}
.auth-field input:focus,
.auth-field select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.auth-field .field-hint {
  font-size: .75rem;
  color: #94a3b8;
  margin-top: 4px;
}
.auth-error-msg {
  font-size: .82rem;
  color: #dc2626;
  margin-top: 5px;
  display: none;
}
.auth-error-msg.visible { display: block; }

/* ── 버튼 공통 ── */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 22px;
  border: none;
  border-radius: 9px;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s, transform .1s, box-shadow .18s;
  text-decoration: none;
}
.auth-btn:active { transform: scale(.97); }
.auth-btn-primary {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: #fff;
  width: 100%;
  padding: 13px;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(59,130,246,.25);
}
.auth-btn-primary:hover { background: linear-gradient(135deg, #1e3a8a, #2563eb); }
.auth-btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1.5px solid #e2e8f0;
}
.auth-btn-secondary:hover { background: #e2e8f0; }
.auth-btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1.5px solid #fecaca;
}
.auth-btn-danger:hover { background: #fee2e2; }
.auth-btn-sm { padding: 5px 13px; font-size: .8rem; border-radius: 7px; }
.auth-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ── 배지 ── */
.auth-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: .74rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-admin   { background: #ede9fe; color: #6d28d9; }
.badge-user    { background: #dbeafe; color: #1d4ed8; }
.badge-active  { background: #dcfce7; color: #16a34a; }
.badge-inactive{ background: #fef9c3; color: #a16207; }
.badge-pending { background: #fff7ed; color: #c2410c; }
.badge-approved{ background: #dcfce7; color: #15803d; }

/* ─────────────────────────────────────────────
   LOGIN PAGE
   ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #1e40af 100%);
}
.login-wrap {
  width: 100%;
  max-width: 440px;
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(59,130,246,.4);
}
.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -.01em;
}
.login-logo p {
  font-size: .78rem;
  color: rgba(255,255,255,.6);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 4px;
}
.login-card { padding: 36px 40px 32px; }
.login-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 24px;
}
.login-footer {
  text-align: center;
  margin-top: 20px;
}
.login-footer a, .login-footer button.link-btn {
  background: none; border: none; padding: 0;
  color: rgba(255,255,255,.75);
  font-size: .82rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.login-footer a:hover, .login-footer button.link-btn:hover { color: #fff; }

/* ─────────────────────────────────────────────
   MODAL
   ───────────────────────────────────────────── */
.auth-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(2px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.auth-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.auth-modal {
  background: #fff;
  border-radius: 16px;
  padding: 36px 40px 32px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  transform: translateY(12px);
  transition: transform .2s;
  position: relative;
}
.auth-modal-overlay.open .auth-modal { transform: translateY(0); }
.auth-modal h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 22px;
  color: #0f172a;
}
.auth-modal-close {
  position: absolute;
  top: 16px; right: 18px;
  background: #f1f5f9;
  border: none;
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  color: #64748b;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.auth-modal-close:hover { background: #e2e8f0; }
.auth-modal-note {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .8rem;
  color: #166534;
  margin-bottom: 16px;
}

/* ─────────────────────────────────────────────
   AUTH LAYOUT (profile / admin 공통 헤더+레이아웃)
   ───────────────────────────────────────────── */
.auth-layout { display: flex; flex-direction: column; min-height: 100vh; }

.auth-topbar {
  background: #0f172a;
  color: #fff;
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.auth-topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}
.auth-topbar-brand .brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .95rem;
}
.auth-topbar-brand .brand-name {
  font-size: 1rem; font-weight: 700; letter-spacing: -.01em;
}
.auth-topbar-right {
  display: flex; align-items: center; gap: 14px;
}
.auth-topbar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; color: rgba(255,255,255,.85);
}
.auth-topbar-user .avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; color: #fff;
}
.auth-topbar-link {
  color: rgba(255,255,255,.7);
  font-size: .82rem;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.auth-topbar-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.auth-topbar-link.active { color: #60a5fa; }

.auth-main {
  flex: 1;
  padding: 32px 28px;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}
.auth-page-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-page-title i { color: #3b82f6; }

/* ─────────────────────────────────────────────
   PROFILE PAGE
   ───────────────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 680px) { .profile-grid { grid-template-columns: 1fr; } }
.profile-section-title {
  font-size: .95rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f1f5f9;
  display: flex; align-items: center; gap: 8px;
}
.profile-section-title i { color: #3b82f6; font-size: .88rem; }

/* ─────────────────────────────────────────────
   ADMIN PAGE
   ───────────────────────────────────────────── */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.admin-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  padding: 7px 14px;
  min-width: 220px;
}
.admin-search-wrap i { color: #94a3b8; }
.admin-search-wrap input {
  border: none; outline: none;
  font-size: .88rem; color: #0f172a;
  background: transparent; width: 100%;
}

/* 사용자 테이블 */
.user-table-wrap { overflow-x: auto; }
.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
}
.user-table thead th {
  background: #f8fafc;
  padding: 11px 14px;
  text-align: left;
  font-weight: 700;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.user-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.user-table tbody tr:hover { background: #f8fafc; }
.user-table .td-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.user-empty-row td {
  text-align: center;
  color: #94a3b8;
  padding: 40px;
  font-size: .9rem;
}

/* 탭 */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid #e2e8f0;
}
.admin-tab-btn {
  padding: 9px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: .9rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  display: flex; align-items: center; gap: 7px;
}
.admin-tab-btn:hover { color: #1e40af; }
.admin-tab-btn.active { color: #1e40af; border-bottom-color: #3b82f6; }
.admin-tab-panel { display: none; }
.admin-tab-panel.active { display: block; }

/* 활동 로그 */
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}
.log-table thead th {
  background: #f8fafc;
  padding: 9px 12px;
  text-align: left;
  font-weight: 700;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.log-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.log-action-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: .74rem;
  font-weight: 700;
}
.action-login    { background: #dbeafe; color: #1d4ed8; }
.action-logout   { background: #f1f5f9; color: #64748b; }
.action-create   { background: #dcfce7; color: #16a34a; }
.action-update   { background: #fef9c3; color: #a16207; }
.action-delete   { background: #fef2f2; color: #dc2626; }
.action-approve  { background: #ede9fe; color: #6d28d9; }
.action-password_change { background: #fff7ed; color: #c2410c; }

/* 통계 카드 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(15,23,42,.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card .stat-label {
  font-size: .78rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}
.stat-card .stat-icon {
  font-size: 1.1rem;
  margin-bottom: 2px;
}
.stat-card.blue   .stat-icon { color: #3b82f6; }
.stat-card.green  .stat-icon { color: #16a34a; }
.stat-card.orange .stat-icon { color: #f59e0b; }
.stat-card.purple .stat-icon { color: #7c3aed; }

/* ─────────────────────────────────────────────
   헤더 유저 드롭다운 (index.html에서 사용)
   ───────────────────────────────────────────── */
.header-user-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.header-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  padding: 5px 12px 5px 6px;
  color: #fff;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  transition: background .15s;
}
.header-user-btn:hover { background: rgba(255,255,255,.15); }
.header-user-btn .avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
}
.header-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(15,23,42,.15);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  z-index: 500;
  display: none;
}
.header-user-dropdown.open { display: block; }
.user-dropdown-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #f1f5f9;
}
.user-dropdown-header .dd-name {
  font-weight: 700; font-size: .92rem; color: #0f172a;
}
.user-dropdown-header .dd-username {
  font-size: .78rem; color: #64748b; margin-top: 1px;
}
.user-dropdown-menu { padding: 6px 0; }
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: .87rem;
  color: #334155;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background .12s;
}
.user-dropdown-item:hover { background: #f8fafc; }
.user-dropdown-item i { width: 16px; color: #94a3b8; }
.user-dropdown-item.danger { color: #dc2626; }
.user-dropdown-item.danger i { color: #fca5a5; }
.user-dropdown-divider { height: 1px; background: #f1f5f9; margin: 4px 0; }
