/* ─── 테마 변수 ─── */
:root {
  --bg-primary:     #0f1923;
  --bg-secondary:   #1a2635;
  --bg-card:        #1e2e42;
  --bg-input:       #142030;
  --border:         #2a4060;
  --accent:         #3d8ef0;
  --accent-hover:   #5aa3ff;
  --text-primary:   #d0e8ff;
  --text-secondary: #7a9fcc;
  --text-muted:     #4a6a8a;
  --success:        #3db87a;
  --error:          #e05050;
  --warning:        #e0a030;
  --font-mono:      'Courier New', Courier, monospace;
  --font-sans:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius:         6px;
  --radius-lg:      10px;
  --shadow:         0 4px 16px rgba(0, 0, 0, 0.4);
  --sidebar-width:  220px;
  --sidebar-collapsed-width: 56px;
}

[data-theme="light"] {
  --bg-primary:     #f5f7fa;
  --bg-secondary:   #ffffff;
  --bg-card:        #ffffff;
  --bg-input:       #f0f4f8;
  --border:         #d0dce8;
  --accent:         #1e6fd9;
  --accent-hover:   #1558b0;
  --text-primary:   #1a2635;
  --text-secondary: #4a6a8a;
  --text-muted:     #8aa0b8;
  --shadow:         0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ─── 리셋 ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ─── 상단 고정 바 ─── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 25;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.devcha-icon {
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius);
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

.topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.json-output {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  white-space: pre;
  overflow-x: auto;
  min-height: 120px;
  margin-top: 12px;
}

.json-error {
  color: #e05252;
  font-size: 13px;
  margin-top: 8px;
  min-height: 20px;
}

/* ─── 사이드바 ─── */
.sidebar {
  position: fixed;
  left: 0; top: 48px; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 20;
  overflow: hidden;
  transform: translateX(calc(-1 * var(--sidebar-width)));
  transition: transform 0.25s ease;
}

body.sidebar-open .sidebar { transform: translateX(0); }
body.sidebar-open .sidebar-overlay { display: block; }



.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ─── 탭 버튼 (사이드바 내) ─── */
.tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 9px 10px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  width: 100%;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

.tab-btn:hover { color: var(--text-primary); background: var(--bg-card); }

.tab-btn.active {
  color: var(--accent);
  background: var(--bg-card);
  border-left-color: var(--accent);
}

.tab-icon {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
  color: inherit;
}

.tab-label {
  overflow: hidden;
  transition: opacity 0.2s;
  white-space: nowrap;
}


/* ─── 사이드바 하단 ─── */
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-copyright {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 8px 4px;
  line-height: 1.5;
  opacity: 1;
  transition: opacity 0.2s;
  white-space: nowrap;
  overflow: hidden;
}


.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 15px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.topbar-btn:hover { background: var(--bg-card); color: var(--text-primary); }

/* ─── 본문 래퍼 ─── */
.main-wrapper {
  margin-top: 48px;
  margin-left: 0;
  min-height: 100vh;
}

/* ─── 메인 콘텐츠 ─── */
.content { max-width: 960px; margin: 0 auto; padding: 32px 24px; }

/* ─── 기능 소개 프레임 ─── */
.feature-intro {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  margin-bottom: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.feature-intro-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.feature-intro-body { display: flex; flex-direction: column; gap: 4px; }

.feature-intro-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.feature-intro-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── 햄버거 버튼 ─── */
.hamburger {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ─── 오버레이 (모바일) ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 19;
}

/* ─── 모바일 반응형 ─── */
@media (max-width: 768px) {
  .content { padding: 20px 16px; }
}

/* ─── 카드 ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sample-btn {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  padding: 3px 10px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.sample-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── 폼 요소 ─── */
label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

textarea, input[type="text"], input[type="number"],
input[type="datetime-local"], input[type="date"], select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}

textarea:focus, input:focus, select:focus {
  border-color: var(--accent);
}

textarea { min-height: 120px; }

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

.form-row-inline {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.form-row-inline > * { flex: 1; }
.form-row-inline .btn-group { flex: 0 0 auto; }

/* ─── 라디오 그룹 ─── */
.radio-group { display: flex; gap: 16px; margin-bottom: 16px; }

.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  margin: 0;
}

/* ─── 버튼 ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { color: var(--text-primary); border-color: var(--accent); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── 결과 영역 ─── */
.result-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 12px;
  min-height: 80px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-primary);
  margin-top: 8px;
}

.result-box.error { color: var(--error); border-color: var(--error); }
.result-box.success { color: var(--success); }

/* ─── 결과 그리드 (Timestamp) ─── */
.result-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 16px;
  margin-top: 12px;
}

.result-label { color: var(--text-secondary); font-size: 12px; }
.result-value { font-family: var(--font-mono); font-size: 13px; color: var(--text-primary); }

/* ─── 빈 상태 ─── */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 80px 0;
  font-size: 16px;
}

/* ─── OpenAPI 테이블 ─── */
.endpoint-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.endpoint-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.endpoint-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(42, 64, 96, 0.5);
  vertical-align: middle;
}

.endpoint-table tr:hover td { background: rgba(61, 142, 240, 0.05); }

.method-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.method-GET    { background: rgba(61, 184, 122, 0.15); color: var(--success); }
.method-POST   { background: rgba(61, 142, 240, 0.15); color: var(--accent); }
.method-PUT    { background: rgba(224, 160, 48, 0.15); color: var(--warning); }
.method-DELETE { background: rgba(224, 80, 80, 0.15);  color: var(--error); }

.path-text {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.param-input {
  width: 80px !important;
  padding: 4px 8px !important;
  font-size: 12px !important;
  min-height: unset !important;
  resize: none;
}

/* ─── 응답 표시 영역 ─── */
.response-area {
  margin-top: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.response-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.status-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 12px;
}

.status-2xx { background: rgba(61, 184, 122, 0.2); color: var(--success); }
.status-4xx { background: rgba(224, 160, 48, 0.2); color: var(--warning); }
.status-5xx { background: rgba(224, 80, 80, 0.2);  color: var(--error); }

.response-body {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
}

/* ─── cURL 모달 ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

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

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 640px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

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

.modal-header h2 { font-size: 15px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-card); }

.modal-body { overflow-y: auto; padding: 20px; flex: 1; }

/* ─── cURL 단계 ─── */
.steps { margin-bottom: 20px; }

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(42, 64, 96, 0.4);
  opacity: 0.35;
  transition: opacity 0.3s;
}

.step-item.done, .step-item.failed { opacity: 1; }

.step-icon { width: 20px; text-align: center; font-size: 14px; }

.step-name { flex: 1; font-size: 13px; }

.step-ms {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 70px;
  text-align: right;
}

.step-item.done   .step-icon::before { content: '✓'; color: var(--success); }
.step-item.failed .step-icon::before { content: '✗'; color: var(--error); }
.step-item:not(.done):not(.failed) .step-icon::before { content: '○'; }

.step-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 4px;
  padding-left: 32px;
}

/* ─── 계정 패널 ─── */
.account-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 29;
}

body.account-open .account-overlay { display: block; }

.account-panel {
  position: fixed;
  top: 48px; right: 0; bottom: 0;
  width: 360px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 30;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow: hidden;
}

body.account-open .account-panel { transform: translateX(0); }

.account-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.account-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: var(--radius);
}

.account-panel-close:hover { color: var(--text-primary); background: var(--bg-card); }

.account-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.my-ip-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.my-ip-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.my-ip-value {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 8px 10px;
  line-height: 1.6;
}

.info-group { display: flex; flex-direction: column; gap: 6px; }

.info-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-textarea {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 8px 10px;
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

#info-device { min-height: 280px; }

@media (max-width: 768px) {
  .account-panel { width: 100%; }
}

/* ─── 유틸 ─── */
.hidden { display: none !important; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
