/* Developer Workbench — shared UI for data-tool pages */

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

html,
body {
  max-width: 100%;
}

body {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  min-height: 100vh;
}

.wb-container {
  min-height: calc(100vh - 69px - 79px);
  padding: 1.5rem 1rem 2.5rem;
  max-width: 72rem;
  margin: 0 auto;
}

/* ── Page header ── */
.wb-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.wb-header-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.wb-header-icon svg {
  width: 1.375rem;
  height: 1.375rem;
  color: #fff;
  stroke-width: 2;
}

.wb-header-body {
  flex: 1;
  min-width: 200px;
}

.wb-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.wb-subtitle {
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.55;
  max-width: 42rem;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding: 0.25rem 0.65rem;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ── Workspace shell ── */
.wb-workspace {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

/* ── Toolbar ── */
.wb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.875rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.wb-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  flex: 1;
  min-width: 0;
}

.wb-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Options (inside toolbar) ── */
.options-row,
#toolOptions:not(:empty) {
  display: contents;
}

.option-item {
  min-width: 140px;
}

.option-item .form-label,
.wb-option .form-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.4rem;
}

.form-textarea,
.form-select,
.form-input {
  display: block;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #0f172a;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.form-select,
.form-input {
  min-height: 2.25rem;
}

.form-textarea {
  min-height: 280px;
  resize: vertical;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Monaco, Menlo, Consolas,
    monospace;
  font-size: 0.8125rem;
  line-height: 1.65;
  tab-size: 2;
}

.form-textarea--compact {
  min-height: 2.75rem;
  max-height: 6rem;
  resize: none;
}

.form-textarea--output {
  min-height: 280px;
  background: #f8fafc;
  color: #1e293b;
  border-color: #e2e8f0;
}

.form-textarea:focus,
.form-select:focus,
.form-input:focus {
  outline: 0;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-textarea[readonly] {
  cursor: default;
}

/* ── Panel grid ── */
.wb-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 320px;
}

.wb-panels--stacked {
  grid-template-columns: 1fr;
}

.wb-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.wb-panel + .wb-panel {
  border-left: 1px solid #e2e8f0;
}

.wb-panels--stacked .wb-panel + .wb-panel {
  border-left: none;
  border-top: 1px solid #e2e8f0;
}

.wb-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.wb-panel-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wb-panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  min-height: 0;
}

.wb-panel-body .form-textarea,
.wb-panel-body .form-input {
  flex: 1;
  min-height: 260px;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
}

.wb-panel-body .form-textarea--compact,
.wb-panel-body .form-input--compact {
  min-height: 2.75rem;
  flex: none;
}

.wb-panel-output .wb-panel-body .form-textarea,
.wb-panel-output .wb-panel-body .output-html {
  background: #f8fafc;
}

.wb-panel-body .form-group {
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.wb-panel-body .form-group .form-textarea {
  flex: 1;
}

/* ── Buttons ── */
.wb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.875rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.4;
}

.wb-btn svg {
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
}

.wb-btn--primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.wb-btn--primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.wb-btn--ghost {
  background: #fff;
  color: #475569;
  border-color: #cbd5e1;
}

.wb-btn--ghost:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #1e293b;
}

.wb-btn--subtle {
  background: transparent;
  color: #64748b;
  border-color: transparent;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
}

.wb-btn--subtle:hover {
  background: #e2e8f0;
  color: #334155;
}

.wb-kbd {
  display: inline-block;
  margin-left: 0.15rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.625rem;
  font-weight: 600;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.25rem;
  line-height: 1.3;
}

.wb-toolbar--live .calculate-button {
  display: none;
}

.form-input--compact {
  font-family: ui-monospace, Monaco, Menlo, Consolas, monospace;
  font-size: 0.875rem;
}

/* legacy class aliases (generator may still emit these) */
.calculate-button,
.copy-button,
.secondary-button,
.clear-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.875rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}

.calculate-button,
.copy-button {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.calculate-button:hover,
.copy-button:hover {
  background: #1d4ed8;
}

.secondary-button,
.clear-button {
  background: #fff;
  color: #475569;
  border-color: #cbd5e1;
}

.secondary-button:hover,
.clear-button:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.button-container {
  display: contents;
}

/* ── Status bar ── */
.wb-statusbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-top: 1px solid #e2e8f0;
  background: #fafbfc;
  min-height: 2.25rem;
}

.wb-statusbar::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.wb-statusbar.success::before {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.wb-statusbar.error::before {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.status,
.wb-statusbar .status-text {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.4;
}

.status.success,
.wb-statusbar.success .status-text {
  color: #047857;
}

.status.error,
.wb-statusbar.error .status-text {
  color: #b91c1c;
}

/* ── HTTP status output ── */
.output-html {
  flex: 1;
  min-height: 260px;
  max-height: 520px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
}

.status-group {
  margin-bottom: 1rem;
}

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

.status-group h3 {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 0.35rem;
  padding: 0 0.25rem;
}

.status-row {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.5rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  transition: background 0.12s;
}

.status-row:hover {
  background: #fff;
}

.status-row + .status-row {
  margin-top: 0.125rem;
}

.status-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, Monaco, Menlo, Consolas, monospace;
}

.status-code--1xx {
  background: #e0f2fe;
  color: #0369a1;
}

.status-code--2xx {
  background: #d1fae5;
  color: #047857;
}

.status-code--3xx {
  background: #fef3c7;
  color: #b45309;
}

.status-code--4xx {
  background: #fee2e2;
  color: #b91c1c;
}

.status-code--5xx {
  background: #ede9fe;
  color: #6d28d9;
}

.status-name {
  font-weight: 600;
  color: #1e293b;
}

.status-desc {
  color: #64748b;
}

.output-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: #94a3b8;
  font-size: 0.875rem;
}

/* ── Reference card ── */
.reference-card {
  margin-top: 1.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid #3b82f6;
}

.reference-card h2 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.reference-card p,
.reference-card li {
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.7;
}

.reference-card ul {
  padding-left: 1.125rem;
  margin-top: 0.35rem;
}

.reference-card li + li {
  margin-top: 0.2rem;
}

/* ── Footer ── */
.aw-footer {
  padding: 1.5rem 0;
  font-size: 12px;
  text-align: center;
  color: #94a3b8;
  border-top: 1px solid #e2e8f0;
  background: transparent;
}

.footer-text-copyright a {
  color: #64748b;
  text-decoration: none;
}

.footer-text-copyright a:hover {
  color: #334155;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .wb-panels {
    grid-template-columns: 1fr;
  }

  .wb-panel + .wb-panel {
    border-left: none;
    border-top: 1px solid #e2e8f0;
  }

  .wb-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .wb-toolbar-actions {
    justify-content: flex-end;
  }

  .option-item {
    min-width: 100%;
  }
}

@media (max-width: 640px) {
  .wb-header {
    justify-content: flex-start !important;
    text-align: left !important;
  }

  .wb-header-body {
    flex: 1 !important;
    min-width: 0;
  }

  .wb-title,
  .wb-subtitle {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .wb-toolbar-left {
    display: flex !important;
    width: 100%;
    flex-direction: column;
    grid-template-columns: none !important;
  }

  .wb-toolbar-left .option-item,
  .wb-toolbar-left .form-input,
  .wb-toolbar-left .form-select {
    width: 100%;
    min-width: 0;
  }

  .wb-container {
    padding: 1rem 0.75rem 2rem;
  }

  .wb-title {
    font-size: 1.25rem;
  }

  .wb-header-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .form-textarea,
  .wb-panel-body .form-textarea {
    min-height: 200px;
  }

  .wb-toolbar-actions {
    width: 100%;
  }

  .wb-toolbar-actions .wb-btn,
  .wb-toolbar-actions .calculate-button,
  .wb-toolbar-actions .secondary-button,
  .wb-toolbar-actions .clear-button {
    flex: 1;
  }
}
