/**
 * API Debugger Stylesheet
 * Scoped strictly to #api-debugger-app and .api-debugger-seo-guide
 */

/* ==========================================================================
   CSS Variables & Color System
   ========================================================================== */
#api-debugger-app {
  --ad-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --ad-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Base Light Theme */
  --ad-bg: #ffffff;
  --ad-bg-alt: #f8fafc;
  --ad-bg-card: #ffffff;
  --ad-border: #e2e8f0;
  --ad-border-focus: #3b82f6;
  --ad-text: #0f172a;
  --ad-text-muted: #64748b;
  --ad-text-dim: #94a3b8;

  /* Accent & Brand Colors */
  --ad-primary: #2563eb;
  --ad-primary-hover: #1d4ed8;
  --ad-primary-text: #ffffff;

  /* Method Colors */
  --ad-method-get: #10b981;
  --ad-method-post: #3b82f6;
  --ad-method-put: #f59e0b;
  --ad-method-patch: #8b5cf6;
  --ad-method-delete: #ef4444;
  --ad-method-head: #6b7280;
  --ad-method-options: #06b6d4;

  /* Status Codes */
  --ad-status-2xx: #10b981;
  --ad-status-3xx: #f59e0b;
  --ad-status-4xx: #ef4444;
  --ad-status-5xx: #dc2626;

  /* Code Syntax Highlighting (Light) */
  --ad-code-bg: #f8fafc;
  --ad-code-key: #0369a1;
  --ad-code-string: #047857;
  --ad-code-number: #d97706;
  --ad-code-boolean: #7c3aed;
  --ad-code-null: #64748b;

  /* Card and Shadows */
  --ad-radius: 10px;
  --ad-radius-sm: 6px;
  --ad-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
  --ad-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --ad-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Overrides */
#api-debugger-app.theme-dark,
#api-debugger-app[data-applied-theme="dark"] {
  --ad-bg: #0b0f19;
  --ad-bg-alt: #111827;
  --ad-bg-card: #141c2e;
  --ad-border: #1e293b;
  --ad-border-focus: #60a5fa;
  --ad-text: #f1f5f9;
  --ad-text-muted: #94a3b8;
  --ad-text-dim: #64748b;

  --ad-primary: #3b82f6;
  --ad-primary-hover: #2563eb;

  /* Code Syntax Highlighting (Dark) */
  --ad-code-bg: #090d16;
  --ad-code-key: #38bdf8;
  --ad-code-string: #34d399;
  --ad-code-number: #fbbf24;
  --ad-code-boolean: #a78bfa;
  --ad-code-null: #94a3b8;

  --ad-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

/* Automatic Dark Mode if Theme is Auto and User OS prefers dark */
@media (prefers-color-scheme: dark) {
  #api-debugger-app.theme-auto:not([data-applied-theme="light"]) {
    --ad-bg: #0b0f19;
    --ad-bg-alt: #111827;
    --ad-bg-card: #141c2e;
    --ad-border: #1e293b;
    --ad-border-focus: #60a5fa;
    --ad-text: #f1f5f9;
    --ad-text-muted: #94a3b8;
    --ad-text-dim: #64748b;

    --ad-primary: #3b82f6;
    --ad-primary-hover: #2563eb;

    --ad-code-bg: #090d16;
    --ad-code-key: #38bdf8;
    --ad-code-string: #34d399;
    --ad-code-number: #fbbf24;
    --ad-code-boolean: #a78bfa;
    --ad-code-null: #94a3b8;
  }
}

/* ==========================================================================
   Base Container & Resets (Scoped)
   ========================================================================== */
#api-debugger-app {
  box-sizing: border-box;
  font-family: var(--ad-font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ad-text);
  background-color: var(--ad-bg);
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius);
  box-shadow: var(--ad-shadow);
  padding: 24px;
  margin: 20px 0;
  width: 100%;
  position: relative;
  text-align: left;
}

#api-debugger-app *,
#api-debugger-app *::before,
#api-debugger-app *::after {
  box-sizing: border-box;
}

.api-debugger-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ==========================================================================
   Header & Action Bar
   ========================================================================== */
.api-debugger-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ad-border);
  margin-bottom: 20px;
}

.api-debugger-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}

.api-debugger-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--ad-radius-sm);
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.api-debugger-title {
  margin: 0 !important;
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: var(--ad-text) !important;
  line-height: 1.2 !important;
}

.api-debugger-subtitle {
  margin: 4px 0 0 0 !important;
  font-size: 0.85rem !important;
  color: var(--ad-text-muted) !important;
  line-height: 1.2 !important;
}

.api-debugger-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Buttons & Controls
   ========================================================================== */
.api-debugger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--ad-font-sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  padding: 8px 14px;
  border-radius: var(--ad-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--ad-transition);
  text-decoration: none !important;
  white-space: nowrap;
  user-select: none;
}

.api-debugger-btn:focus-visible {
  outline: 2px solid var(--ad-border-focus);
  outline-offset: 2px;
}

.api-debugger-btn-primary {
  background-color: var(--ad-primary);
  color: var(--ad-primary-text) !important;
  border-color: var(--ad-primary);
}

.api-debugger-btn-primary:hover {
  background-color: var(--ad-primary-hover);
  border-color: var(--ad-primary-hover);
}

.api-debugger-btn-secondary {
  background-color: var(--ad-bg-alt);
  color: var(--ad-text) !important;
  border-color: var(--ad-border);
}

.api-debugger-btn-secondary:hover {
  background-color: var(--ad-border);
}

.api-debugger-btn-ghost {
  background: transparent;
  color: var(--ad-text-muted) !important;
  border-color: var(--ad-border);
}

.api-debugger-btn-ghost:hover {
  color: var(--ad-text) !important;
  background-color: var(--ad-bg-alt);
}

.api-debugger-btn-danger {
  background: transparent;
  color: var(--ad-method-delete) !important;
  border-color: transparent;
}

.api-debugger-btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.api-debugger-btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.api-debugger-btn-xs {
  padding: 4px 8px;
  font-size: 11px;
}

.api-debugger-btn-icon {
  padding: 8px;
  border-radius: var(--ad-radius-sm);
  border: 1px solid var(--ad-border);
  background: var(--ad-bg-alt);
  color: var(--ad-text);
  cursor: pointer;
}

.api-debugger-badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  background-color: var(--ad-primary);
  color: #fff;
  border-radius: 9999px;
  padding: 1px 6px;
  min-width: 16px;
}

/* Dark Mode Button Icons */
#api-debugger-app .icon-sun {
  display: none;
}
#api-debugger-app .icon-moon {
  display: inline-block;
}
#api-debugger-app.theme-dark .icon-sun,
#api-debugger-app[data-applied-theme="dark"] .icon-sun {
  display: inline-block;
}
#api-debugger-app.theme-dark .icon-moon,
#api-debugger-app[data-applied-theme="dark"] .icon-moon {
  display: none;
}

/* ==========================================================================
   Request Bar (Method + URL + Send)
   ========================================================================== */
.api-debugger-request-bar {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 20px;
  width: 100%;
}

.api-debugger-method-wrapper {
  flex-shrink: 0;
}

.api-debugger-method-select {
  height: 44px;
  padding: 0 14px;
  font-family: var(--ad-font-mono);
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--ad-radius-sm);
  border: 1px solid var(--ad-border);
  background-color: var(--ad-bg-alt);
  cursor: pointer;
  outline: none;
  transition: var(--ad-transition);
}

.api-debugger-method-select.method-get { color: var(--ad-method-get); }
.api-debugger-method-select.method-post { color: var(--ad-method-post); }
.api-debugger-method-select.method-put { color: var(--ad-method-put); }
.api-debugger-method-select.method-patch { color: var(--ad-method-patch); }
.api-debugger-method-select.method-delete { color: var(--ad-method-delete); }
.api-debugger-method-select.method-head { color: var(--ad-method-head); }
.api-debugger-method-select.method-options { color: var(--ad-method-options); }

.api-debugger-url-wrapper {
  flex-grow: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.api-debugger-url-input {
  width: 100%;
  height: 44px;
  padding: 0 38px 0 14px;
  font-family: var(--ad-font-mono);
  font-size: 13px;
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius-sm);
  background-color: var(--ad-bg-alt);
  color: var(--ad-text);
  outline: none;
  transition: var(--ad-transition);
}

.api-debugger-url-input:focus {
  border-color: var(--ad-border-focus);
  background-color: var(--ad-bg);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.api-debugger-btn-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--ad-text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.api-debugger-btn-clear:hover {
  color: var(--ad-text);
  background: var(--ad-border);
}

.api-debugger-send-wrapper {
  flex-shrink: 0;
}

.api-debugger-btn-send {
  height: 44px;
  padding: 0 24px;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.api-debugger-btn-send .btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: api-debugger-spin 0.6s linear infinite;
}

.api-debugger-btn-send.is-loading .btn-send-icon,
.api-debugger-btn-send.is-loading .btn-send-text {
  display: none;
}

.api-debugger-btn-send.is-loading .btn-spinner {
  display: inline-block;
}

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

/* ==========================================================================
   Notice / Alert Banner
   ========================================================================== */
.api-debugger-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--ad-radius-sm);
  margin-bottom: 20px;
  font-size: 13px;
  animation: api-debugger-fadein 0.2s ease;
}

.api-debugger-notice.notice-info {
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #2563eb;
}

.api-debugger-notice.notice-warning {
  background-color: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #d97706;
}

.api-debugger-notice.notice-error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

.api-debugger-notice.notice-success {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #059669;
}

.api-debugger-notice-message {
  flex-grow: 1;
}

.api-debugger-notice-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
}

.api-debugger-notice-close:hover {
  opacity: 1;
}

@keyframes api-debugger-fadein {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Main Layout: Cards Grid
   ========================================================================== */
.api-debugger-main-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.api-debugger-card {
  background: var(--ad-bg-card);
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius);
  overflow: hidden;
  box-shadow: var(--ad-shadow);
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

/* ==========================================================================
   Tabs Header & Navigation
   ========================================================================== */
.api-debugger-tabs-header {
  display: flex;
  align-items: center;
  background: var(--ad-bg-alt);
  border-bottom: 1px solid var(--ad-border);
  padding: 4px 8px 0 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  white-space: nowrap;
}

.api-debugger-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ad-text-muted);
  font-family: var(--ad-font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--ad-transition);
  border-radius: 4px 4px 0 0;
}

.api-debugger-tab-btn:hover {
  color: var(--ad-text);
}

.api-debugger-tab-btn.active {
  color: var(--ad-primary);
  border-bottom-color: var(--ad-primary);
  background: var(--ad-bg-card);
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  background: var(--ad-border);
  color: var(--ad-text-muted);
  border-radius: 9999px;
  padding: 1px 6px;
  min-width: 16px;
}

.tab-dot {
  width: 6px;
  height: 6px;
  background-color: var(--ad-primary);
  border-radius: 50%;
}

.api-debugger-tab-panel {
  padding: 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.api-debugger-tab-panel[hidden] {
  display: none !important;
}

/* ==========================================================================
   Key/Value Editor Table (Params, Headers, Form-Data)
   ========================================================================== */
.api-debugger-panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.api-debugger-panel-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--ad-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.api-debugger-kv-container {
  overflow-x: auto;
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius-sm);
  background: var(--ad-bg-card);
}

.api-debugger-kv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.api-debugger-kv-table th,
.api-debugger-kv-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--ad-border);
  vertical-align: middle;
}

.api-debugger-kv-table th {
  background: var(--ad-bg-alt);
  color: var(--ad-text-muted);
  font-weight: 600;
  text-align: left;
}

.api-debugger-kv-table tr:last-child td {
  border-bottom: none;
}

.api-debugger-kv-table .col-check {
  width: 32px;
  text-align: center;
}

.api-debugger-kv-table .col-del {
  width: 36px;
  text-align: center;
}

.api-debugger-kv-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ad-text);
  font-family: var(--ad-font-mono);
  font-size: 12px;
  outline: none;
  transition: var(--ad-transition);
}

.api-debugger-kv-input:hover {
  background: var(--ad-bg-alt);
}

.api-debugger-kv-input:focus {
  background: var(--ad-bg);
  border-color: var(--ad-border-focus);
}

.api-debugger-kv-table tr.row-disabled .api-debugger-kv-input {
  opacity: 0.4;
  text-decoration: line-through;
}

.btn-del-row {
  background: transparent;
  border: none;
  color: var(--ad-text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-del-row:hover {
  color: var(--ad-method-delete);
  background: rgba(239, 68, 68, 0.1);
}

/* ==========================================================================
   Body Editor Section
   ========================================================================== */
.api-debugger-body-type-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--ad-border);
}

.api-debugger-radio-pill {
  cursor: pointer;
  user-select: none;
}

.api-debugger-radio-pill input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.api-debugger-radio-pill span {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 9999px;
  background: var(--ad-bg-alt);
  border: 1px solid var(--ad-border);
  color: var(--ad-text-muted);
  transition: var(--ad-transition);
}

.api-debugger-radio-pill input:checked + span {
  background: var(--ad-primary);
  border-color: var(--ad-primary);
  color: #ffffff;
  font-weight: 600;
}

.api-debugger-toolbar-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.api-debugger-editor-wrapper {
  position: relative;
  flex-grow: 1;
}

.api-debugger-code-editor {
  width: 100%;
  min-height: 240px;
  font-family: var(--ad-font-mono);
  font-size: 12px;
  line-height: 1.6;
  padding: 12px;
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius-sm);
  background: var(--ad-code-bg);
  color: var(--ad-text);
  resize: vertical;
  outline: none;
  tab-size: 2;
}

.api-debugger-code-editor:focus {
  border-color: var(--ad-border-focus);
}

.api-debugger-editor-status {
  margin-top: 6px;
  font-size: 11px;
  font-family: var(--ad-font-mono);
}

.api-debugger-editor-status.status-error {
  color: var(--ad-method-delete);
}

.api-debugger-editor-status.status-success {
  color: var(--ad-status-2xx);
}

.api-debugger-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ad-text-muted);
}

/* ==========================================================================
   Auth Section
   ========================================================================== */
.api-debugger-auth-type-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.api-debugger-select,
.api-debugger-input {
  padding: 8px 12px;
  border-radius: var(--ad-radius-sm);
  border: 1px solid var(--ad-border);
  background: var(--ad-bg-alt);
  color: var(--ad-text);
  font-size: 13px;
  outline: none;
}

.api-debugger-select:focus,
.api-debugger-input:focus {
  border-color: var(--ad-border-focus);
}

.api-debugger-input-group {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.api-debugger-input-group .api-debugger-input {
  flex-grow: 1;
}

.api-debugger-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.api-debugger-hint {
  font-size: 12px;
  color: var(--ad-text-muted);
  margin-top: 6px !important;
}

.api-debugger-security-disclaimer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 10px 14px;
  background: var(--ad-bg-alt);
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius-sm);
  font-size: 12px;
  color: var(--ad-text-muted);
}

/* ==========================================================================
   Settings Tab Inside Tool
   ========================================================================== */
.api-debugger-settings-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.api-debugger-setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ==========================================================================
   Response Viewer & Metrics
   ========================================================================== */
.api-debugger-response-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: var(--ad-bg-alt);
  border-bottom: 1px solid var(--ad-border);
}

.api-debugger-response-status-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-debugger-status-label {
  font-weight: 700;
  color: var(--ad-text-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.api-debugger-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 9999px;
  font-family: var(--ad-font-mono);
  font-size: 12px;
  font-weight: 700;
  background: var(--ad-border);
  color: var(--ad-text-muted);
}

.api-debugger-status-badge.status-2xx {
  background: rgba(16, 185, 129, 0.15);
  color: var(--ad-status-2xx);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.api-debugger-status-badge.status-3xx {
  background: rgba(245, 158, 11, 0.15);
  color: var(--ad-status-3xx);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.api-debugger-status-badge.status-4xx {
  background: rgba(239, 68, 68, 0.15);
  color: var(--ad-status-4xx);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.api-debugger-status-badge.status-5xx {
  background: rgba(220, 38, 38, 0.15);
  color: var(--ad-status-5xx);
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.api-debugger-response-metrics {
  display: flex;
  align-items: center;
  gap: 14px;
}

.api-debugger-metric {
  font-size: 12px;
  display: flex;
  gap: 4px;
}

.metric-label {
  color: var(--ad-text-muted);
}

.metric-value {
  font-family: var(--ad-font-mono);
  font-weight: 600;
  color: var(--ad-text);
}

.api-debugger-resp-tabs {
  justify-content: space-between;
}

.api-debugger-resp-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.api-debugger-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.api-debugger-search-input {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--ad-border);
  background: var(--ad-bg);
  color: var(--ad-text);
  width: 140px;
}

.resp-search-count {
  position: absolute;
  right: 6px;
  font-size: 10px;
  color: var(--ad-text-muted);
}

/* ==========================================================================
   Code & Pretty Display
   ========================================================================== */
.api-debugger-code-panel {
  position: relative;
  padding: 0 !important;
  overflow: hidden;
  height: 380px;
}

.api-debugger-code-display,
.api-debugger-raw-display {
  margin: 0;
  padding: 16px;
  height: 100%;
  overflow: auto;
  font-family: var(--ad-font-mono);
  font-size: 12px;
  line-height: 1.6;
  background: var(--ad-code-bg);
  color: var(--ad-text);
  scrollbar-width: thin;
}

/* JSON Highlighting Classes */
.ad-json-key { color: var(--ad-code-key); font-weight: 600; }
.ad-json-string { color: var(--ad-code-string); }
.ad-json-number { color: var(--ad-code-number); }
.ad-json-boolean { color: var(--ad-code-boolean); font-weight: 600; }
.ad-json-null { color: var(--ad-code-null); font-style: italic; }
.ad-highlight-match { background-color: rgba(251, 191, 36, 0.4); outline: 1px solid #f59e0b; }

.api-debugger-empty-response {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ad-text-dim);
  text-align: center;
  gap: 12px;
}

.api-debugger-empty-cell {
  text-align: center;
  color: var(--ad-text-muted);
  padding: 24px;
}

/* Preview Sandboxed Container */
.api-debugger-preview-container {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 16px;
}

.api-debugger-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

.api-debugger-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--ad-radius-sm);
}

/* ==========================================================================
   Modals & Drawers
   ========================================================================== */
.api-debugger-modal,
.api-debugger-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.api-debugger-modal-backdrop,
.api-debugger-drawer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.api-debugger-modal-dialog {
  position: relative;
  background: var(--ad-bg-card);
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius);
  box-shadow: var(--ad-shadow-lg);
  width: 90%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2;
  animation: api-debugger-modal-pop 0.2s ease;
}

.api-debugger-modal-lg {
  max-width: 780px;
}

.api-debugger-modal-header,
.api-debugger-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ad-border);
}

.api-debugger-modal-footer {
  border-top: 1px solid var(--ad-border);
  border-bottom: none;
  background: var(--ad-bg-alt);
  gap: 8px;
}

.api-debugger-modal-header h3 {
  margin: 0 !important;
  font-size: 1.1rem !important;
  color: var(--ad-text) !important;
}

.api-debugger-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--ad-text-muted);
  cursor: pointer;
  padding: 4px;
}

.api-debugger-modal-body {
  padding: 20px;
  overflow-y: auto;
}

@keyframes api-debugger-modal-pop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Code Generator Modal Styles */
.api-debugger-codegen-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.api-debugger-lang-btn {
  background: var(--ad-bg-alt);
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ad-text-muted);
  cursor: pointer;
}

.api-debugger-lang-btn.active {
  background: var(--ad-primary);
  border-color: var(--ad-primary);
  color: #ffffff;
  font-weight: 600;
}

.api-debugger-code-box {
  background: var(--ad-code-bg);
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius-sm);
  padding: 16px;
  font-family: var(--ad-font-mono);
  font-size: 12px;
  line-height: 1.6;
  max-height: 320px;
  overflow: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

/* History Drawer */
.api-debugger-drawer {
  justify-content: flex-end;
}

.api-debugger-drawer-panel {
  position: relative;
  background: var(--ad-bg-card);
  width: 380px;
  max-width: 90vw;
  height: 100%;
  border-left: 1px solid var(--ad-border);
  box-shadow: var(--ad-shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 2;
  animation: api-debugger-slide-in 0.25s ease;
}

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

.api-debugger-drawer-header h3 {
  margin: 0 !important;
  font-size: 1.1rem !important;
  color: var(--ad-text) !important;
}

.api-debugger-drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-debugger-drawer-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--ad-text-muted);
  cursor: pointer;
}

.api-debugger-drawer-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px;
}

.api-debugger-history-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.api-debugger-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius-sm);
  background: var(--ad-bg-alt);
  cursor: pointer;
  transition: var(--ad-transition);
}

.api-debugger-history-item:hover {
  background: var(--ad-bg);
  border-color: var(--ad-border-focus);
}

.api-debugger-hist-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.api-debugger-hist-method-url {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ad-font-mono);
  font-size: 12px;
}

.api-debugger-hist-url {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  color: var(--ad-text);
}

.api-debugger-hist-meta {
  font-size: 10px;
  color: var(--ad-text-muted);
}

@keyframes api-debugger-slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 900px) {
  .api-debugger-main-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #api-debugger-app {
    padding: 14px;
  }

  .api-debugger-request-bar {
    flex-direction: column;
  }

  .api-debugger-method-wrapper,
  .api-debugger-url-wrapper,
  .api-debugger-send-wrapper {
    width: 100%;
  }

  .api-debugger-btn-send {
    width: 100%;
  }

  .api-debugger-field-row {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   SEO & FAQ Guide Section Styles
   ========================================================================== */
.api-debugger-seo-guide {
  font-family: var(--ad-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  color: #334155;
  margin: 40px auto;
  max-width: 1100px;
  line-height: 1.7;
}

.api-debugger-seo-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 32px;
  margin-bottom: 12px;
}

.api-debugger-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.api-debugger-guide-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px;
}

.api-debugger-guide-card h3 {
  margin: 0 0 8px 0;
  font-size: 1.05rem;
  color: #1e293b;
}

.api-debugger-guide-card p {
  margin: 0;
  font-size: 0.9rem;
  color: #64748b;
}

.api-debugger-faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.api-debugger-faq-item {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.api-debugger-faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  font-weight: 600;
  font-size: 1rem;
  color: #0f172a;
  cursor: pointer;
  list-style: none;
}

.api-debugger-faq-question::-webkit-details-marker {
  display: none;
}

.api-debugger-faq-icon {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.api-debugger-faq-item[open] .api-debugger-faq-icon {
  transform: rotate(180deg);
}

.api-debugger-faq-answer {
  padding: 0 18px 16px 18px;
  color: #475569;
  font-size: 0.95rem;
}

.api-debugger-faq-answer p {
  margin: 0;
}
