/* =============================
   Asaas Pix API Explorer - CSS
   ============================= */

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-sidebar: #0f172a;
  --bg-hover: #334155;
  --bg-active: #1d4ed8;
  --border: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #3b82f6;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-yellow: #f59e0b;
  --accent-purple: #a855f7;
  --accent-pix: #32bcad;
  --method-get: #22c55e;
  --method-post: #3b82f6;
  --method-delete: #ef4444;
  --method-patch: #f59e0b;
  --sidebar-width: 280px;
  --header-height: 60px;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

/* ======= SCROLLBAR ======= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ======= LAYOUT ======= */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ======= HEADER ======= */
.app-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
}

.pix-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-pix), #1a9a8d);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.header-title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.header-title span:first-child {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-title span:last-child {
  font-size: 11px;
  color: var(--accent-pix);
  font-weight: 500;
}

.header-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 4px;
}

.header-env {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-env label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.env-select {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

.api-key-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

.api-key-wrapper label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.api-key-input {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  width: 280px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.api-key-input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.api-key-input.has-value {
  border-color: var(--accent-green);
}

.header-spacer { flex: 1; }

.env-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.env-badge.production {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
  border-color: rgba(34, 197, 94, 0.3);
}

.env-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ======= MAIN CONTENT ======= */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ======= SIDEBAR ======= */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-search {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-sidebar);
  z-index: 10;
}

.search-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 12px 7px 32px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.search-input:focus { outline: none; border-color: var(--accent-blue); }

.search-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

.sidebar-nav {
  padding: 8px 0 16px;
}

.nav-group {
  margin-bottom: 4px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 6px;
  cursor: pointer;
  user-select: none;
}

.nav-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.nav-group-arrow {
  color: var(--text-muted);
  font-size: 10px;
  transition: transform 0.2s;
}

.nav-group.open .nav-group-arrow {
  transform: rotate(90deg);
}

.nav-group-items {
  display: none;
}

.nav-group.open .nav-group-items {
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 18px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.12);
  border-left-color: var(--accent-blue);
  color: var(--accent-blue);
}

.nav-item.active .nav-item-name {
  color: var(--accent-blue);
}

.method-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  min-width: 38px;
  text-align: center;
  font-family: monospace;
  flex-shrink: 0;
}

.badge-GET { background: rgba(34, 197, 94, 0.15); color: var(--method-get); }
.badge-POST { background: rgba(59, 130, 246, 0.15); color: var(--method-post); }
.badge-DELETE { background: rgba(239, 68, 68, 0.15); color: var(--method-delete); }
.badge-PATCH { background: rgba(245, 158, 11, 0.15); color: var(--method-patch); }

.nav-item-name {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ======= CONTENT AREA ======= */
.content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Welcome Screen */
.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  gap: 16px;
}

.welcome-icon {
  font-size: 64px;
  margin-bottom: 8px;
}

.welcome-screen h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.welcome-screen p {
  color: var(--text-secondary);
  max-width: 400px;
  font-size: 14px;
}

.welcome-stats {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  text-align: center;
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-pix);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* API Detail Panel */
.api-panel {
  display: none;
  flex-direction: column;
  flex: 1;
}

.api-panel.visible {
  display: flex;
}

.api-panel-header {
  padding: 20px 24px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  flex-shrink: 0;
}

.route-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.route-method {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: monospace;
}

.route-method.GET { background: rgba(34, 197, 94, 0.15); color: var(--method-get); border: 1px solid rgba(34, 197, 94, 0.3); }
.route-method.POST { background: rgba(59, 130, 246, 0.15); color: var(--method-post); border: 1px solid rgba(59, 130, 246, 0.3); }
.route-method.DELETE { background: rgba(239, 68, 68, 0.15); color: var(--method-delete); border: 1px solid rgba(239, 68, 68, 0.3); }
.route-method.PATCH { background: rgba(245, 158, 11, 0.15); color: var(--method-patch); border: 1px solid rgba(245, 158, 11, 0.3); }

.route-endpoint {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.route-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.permission-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 3px 8px;
  border-radius: 20px;
  font-family: monospace;
  font-weight: 600;
}

/* ======= API PANEL BODY ======= */
.api-panel-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.params-section {
  width: 400px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.required-dot {
  color: var(--accent-red);
  font-size: 14px;
}

.form-hint {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: auto;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 11px;
}

.form-select {
  cursor: pointer;
}

.send-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent-blue);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
}

.send-btn:hover { background: #2563eb; }
.send-btn:active { transform: scale(0.98); }
.send-btn:disabled { background: var(--border); cursor: not-allowed; }

.send-btn .btn-icon { font-size: 16px; }

/* ======= RESPONSE SECTION ======= */
.response-section {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.response-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 10px;
  color: var(--text-muted);
}

.response-empty-icon { font-size: 36px; }
.response-empty-text { font-size: 13px; }

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

.status-code {
  font-weight: 700;
  font-family: monospace;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.status-2xx { background: rgba(34, 197, 94, 0.15); color: var(--method-get); }
.status-4xx { background: rgba(239, 68, 68, 0.15); color: var(--method-delete); }
.status-5xx { background: rgba(245, 158, 11, 0.15); color: var(--method-patch); }

.status-label {
  color: var(--text-secondary);
}

.response-time {
  margin-left: auto;
  color: var(--text-muted);
  font-family: monospace;
}

.response-body-wrapper {
  flex: 1;
}

.response-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.copy-btn {
  font-size: 11px;
  padding: 4px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.copy-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

.response-json {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  min-height: 100px;
}

.json-key { color: #93c5fd; }
.json-string { color: #86efac; }
.json-number { color: #fca5a5; }
.json-boolean { color: #c4b5fd; }
.json-null { color: #64748b; }

/* ======= URL BAR ======= */
.url-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
}

.url-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
}

.url-text {
  flex: 1;
  color: var(--text-primary);
}

/* ======= LOADING ======= */
.loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  padding: 20px;
  justify-content: center;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ======= TOAST ======= */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
  max-width: 300px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-blue); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ======= NOTICE BOXES ======= */
.notice {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.notice.warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

.notice.info {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

.notice-icon { flex-shrink: 0; }

/* ======= RESPONSIVE ======= */
@media (max-width: 900px) {
  .api-panel-body { flex-direction: column; }
  .params-section { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .api-key-input { width: 180px; }
}
