/* 관리자 대시보드 전용 스타일 */

.admin-body {
  background-image:
    radial-gradient(800px 400px at 50% -10%, rgba(0, 51, 153, 0.35) 0%, transparent 60%),
    radial-gradient(1200px 600px at 50% -20%, #1a2434 0%, #0c1015 60%);
}

.admin-header { padding-bottom: 18px; }
.admin-header .eu-flag-bar { margin-bottom: 8px; padding: 4px 10px; font-size: 11px; }
.admin-header .eu-flag-svg { width: 22px; height: 15px; }

.admin-header .brand {
  margin: 4px 0 8px;
}
.admin-header h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, #FFCC00, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.admin-header .brand-icon { font-size: 24px; }

.admin-top-actions {
  margin-top: 12px;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}

.admin-top-actions .small-btn {
  text-decoration: none;
  padding: 6px 12px;
  min-height: 32px;
  font-size: 13px;
}

.admin-top-actions #guildFilter {
  max-width: 180px;
}

.admin-main {
  max-width: 1200px;
  margin: 0 auto;
  padding:
    20px
    calc(16px + var(--safe-right))
    24px
    calc(16px + var(--safe-left));
  display: grid;
  gap: 16px;
}

@media (min-width: 980px) {
  .admin-main {
    grid-template-columns: 1fr 1fr;
  }
  .admin-main > .card:first-child,
  .admin-main > .card:nth-child(7) { grid-column: 1 / -1; }
}

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.kpi {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
}

.kpi-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

.kpi-lbl {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.progress-bar {
  margin-top: 14px;
  height: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #FFCC00, var(--accent), var(--accent-2));
  width: 0%;
  transition: width 0.6s ease;
}

.kpi-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.kpi-row .elite-pill { font-size: 12px; padding: 4px 12px; }

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  table-layout: auto;
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--panel);
  position: sticky;
  top: 0;
}

.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.data-table .status-submitted { color: #69d586; font-weight: 700; }
.data-table .status-not { color: var(--muted-2); }

.diff-pos { color: #69d586; font-weight: 700; }
.diff-neg { color: #ff8a82; font-weight: 700; }
.diff-zero { color: var(--muted); }

/* Member management */
.member-mgmt { display: flex; flex-direction: column; gap: 14px; }

.member-bulk summary {
  cursor: pointer;
  padding: 8px 0;
  font-weight: 600;
  color: var(--accent);
}

.member-bulk textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  resize: vertical;
  margin-top: 8px;
  outline: none;
}

.member-bulk textarea:focus { border-color: var(--accent); }

.member-bulk .actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.member-add {
  display: flex;
  gap: 8px;
}

.member-add input {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

.member-add input:focus { border-color: var(--accent); }

.member-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}

.member-chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 8px 5px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.member-chip button {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 50%;
}

.member-chip button:hover { background: rgba(248, 81, 73, 0.18); color: var(--danger); }

.member-group {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--panel-2);
}

.member-group-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 6px;
}

.member-group-header strong { color: var(--accent); font-size: 14px; }
.member-group-meta { font-size: 11.5px; color: var(--muted); }

.member-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#loginDialog input {
  font-size: 16px;
  letter-spacing: 2px;
  text-align: center;
}

/* ===== 비밀번호 변경 ===== */
.pw-change {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pw-change input {
  flex: 1 1 160px;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.pw-change input:focus { border-color: var(--accent); }
.pw-change button { flex: 0 0 auto; white-space: nowrap; min-width: 96px; }

@media (max-width: 520px) {
  .pw-change { flex-direction: column; }
  .pw-change button { width: 100%; }
}

/* ===== 성주 현황 관리 ===== */
.castle-lord-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cl-label {
  flex: 0 0 100px;
  font-weight: 700;
  font-size: 14px;
}

.cl-row input {
  flex: 1 1 180px;
  min-width: 0;
}

.cl-row button {
  flex: 0 0 auto;
  white-space: nowrap;
  min-width: 64px;
}

@media (max-width: 600px) {
  .cl-label { flex: 1 1 100%; }
  .cl-row button { width: auto; }
}

.cl-label { font-weight: 700; font-size: 14px; }

.cl-row input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
}
.cl-row input:focus { border-color: var(--accent); }

/* ===== 지침 편집 ===== */
#guidelinesArea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans KR", sans-serif;
  font-size: 14px;
  resize: vertical;
  outline: none;
  line-height: 1.6;
}
#guidelinesArea:focus { border-color: var(--accent); }

/* ===== 스코프 태그 (헤더) ===== */
.scope-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.scope-tag.scope-all {
  background: linear-gradient(135deg, #FFCC00, #FFB84A);
  color: #2a1900;
}

.scope-tag.scope-family {
  background: rgba(88, 166, 255, 0.18);
  color: #6fb5ff;
  border: 1px solid rgba(88, 166, 255, 0.35);
}

#guildFilter {
  font-size: 12.5px;
  padding: 6px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
}

/* ===== 계정 관리 ===== */
.account-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.account-add input,
.account-add select {
  flex: 1 1 130px;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 10px;
  font-size: 13.5px;
  outline: none;
}

.account-add button {
  flex: 0 0 auto;
  white-space: nowrap;
  min-width: 96px;
}

@media (max-width: 520px) {
  .account-add { flex-direction: column; align-items: stretch; }
  .account-add button { width: 100%; }
}

.account-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.acct-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.acct-user { font-weight: 700; }
.acct-scope {
  background: rgba(88, 166, 255, 0.15);
  color: #6fb5ff;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.acct-scope.super {
  background: linear-gradient(135deg, #FFCC00, #FFB84A);
  color: #2a1900;
}

/* ===== 문원 OCR 일괄 추출 ===== */
.ocr-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 14px;
  padding: 12px;
  background: rgba(88, 166, 255, 0.05);
  border: 1px dashed rgba(88, 166, 255, 0.3);
  border-radius: var(--radius-sm);
}

.ocr-header { display: flex; flex-direction: column; gap: 3px; }
.ocr-title { font-weight: 700; color: var(--info); font-size: 14px; }
.ocr-hint { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.ocr-hint code {
  background: var(--panel-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.ocr-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ocr-pick-label {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.ocr-controls select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 10px;
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
  flex: 1 1 140px;
  min-width: 0;
}

.ocr-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 6px;
}

.ocr-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.ocr-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ocr-thumb-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.ocr-thumb-remove:hover { background: rgba(248, 81, 73, 0.85); }

.ocr-thumb-idx {
  position: absolute;
  bottom: 3px;
  left: 3px;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.ocr-thumb.processing {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.ocr-thumb.processing::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 184, 74, 0.25);
  pointer-events: none;
}

.ocr-thumb.done::after {
  content: "✓";
  position: absolute;
  inset: 0;
  background: rgba(46, 160, 67, 0.55);
  color: white;
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.ocr-progress { display: flex; flex-direction: column; gap: 6px; }

.ocr-progress-bar {
  height: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.ocr-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
  transition: width 0.3s ease;
}

.ocr-progress-text {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ===== KPI 애니메이션 ===== */
.kpi {
  position: relative;
  overflow: hidden;
}

.kpi::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 184, 74, 0.06) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shimmer 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.kpi-num { animation: pop 0.4s ease; }

@keyframes pop {
  0%   { transform: scale(0.8); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); }
}

/* ===== Responsive: tablet (≤900px) ===== */
@media (max-width: 900px) {
  .admin-main {
    padding-left: calc(12px + var(--safe-left));
    padding-right: calc(12px + var(--safe-right));
  }
  .admin-header h1 { font-size: 22px; }
}

/* ===== Responsive: mobile (≤640px) ===== */
@media (max-width: 640px) {
  .admin-header { padding-bottom: 14px; }
  .admin-header h1 { font-size: 20px; letter-spacing: -0.3px; }
  .admin-header .brand-icon { font-size: 20px; }
  .admin-header .brand { gap: 6px; margin: 2px 0 6px; }

  .admin-top-actions { gap: 6px; margin-top: 10px; }
  .admin-top-actions .small-btn {
    padding: 5px 10px;
    min-height: 30px;
    font-size: 12px;
  }
  .admin-top-actions #guildFilter {
    font-size: 12px;
    padding: 5px 8px;
    max-width: 140px;
  }
  .scope-tag { font-size: 11px; padding: 3px 9px; }

  .admin-main {
    padding-left: calc(10px + var(--safe-left));
    padding-right: calc(10px + var(--safe-right));
    gap: 12px;
  }

  .kpi { padding: 12px 10px; }
  .kpi-num { font-size: 19px; }
  .kpi-lbl { font-size: 10.5px; letter-spacing: 0.4px; }
  .kpi-grid { gap: 8px; grid-template-columns: repeat(2, 1fr); }

  .data-table { font-size: 12.5px; }
  .data-table th { font-size: 10px; padding: 8px 6px; }
  .data-table td { padding: 8px 6px; }

  .list-header h2 { font-size: 15px; }
  .card h2 { font-size: 15.5px; }

  .member-add { flex-wrap: wrap; }
  .member-add input { flex: 1 1 100%; }
  .member-add button { width: 100%; }

  .member-group { padding: 8px 10px; }
  .member-group-header strong { font-size: 13px; }
  .member-group-meta { font-size: 11px; }

  .member-bulk textarea { font-size: 12.5px; }
  .member-bulk .actions { flex-wrap: wrap; }
  .member-bulk .actions button { flex: 1 1 0; }

  .cl-row { gap: 8px; }
  .cl-row input { padding: 9px 10px; font-size: 13.5px; }

  #guidelinesArea { font-size: 13.5px; }
}

/* ===== Responsive: small mobile (≤380px) ===== */
@media (max-width: 380px) {
  .admin-header .eu-flag-bar { font-size: 10.5px; padding: 3px 8px; }
  .admin-header .eu-flag-svg { width: 18px; height: 12px; }
  .admin-header h1 { font-size: 18px; }
  .admin-top-actions .small-btn { font-size: 11.5px; padding: 5px 8px; }
  .admin-top-actions #guildFilter { max-width: 120px; }

  .kpi-num { font-size: 17px; }
  .kpi-lbl { font-size: 10px; }

  .data-table { font-size: 12px; }
  .data-table th { font-size: 9.5px; }
}

/* ===== 문파 모집 정보 편집 + 즉석 매칭 ===== */

.guild-info-edit, .siege-help-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gi-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gi-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}

.gi-label.gi-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.gi-input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
}

.gi-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--panel);
}

.gi-toggle {
  display: flex;
  gap: 14px;
  font-size: 13px;
}

.gi-toggle label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

textarea.gi-input {
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}

.sh-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.sh-quick button {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s;
}

.sh-quick button:hover {
  background: var(--accent);
  color: #1a0d00;
  border-color: var(--accent);
}
