/* CKAN Swagger UX — Standalone Service Styles */

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f8f9fc;
  color: #1a1a2e;
}

.hidden { display: none !important; }

/* ── Landing page ────────────────────────────── */

.landing-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px;
}

.landing-header {
  text-align: center;
  margin-bottom: 36px;
}

.landing-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #16213e;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 15px;
  color: #64748b;
}

/* ── Input section ───────────────────────────── */

.input-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 32px;
}

.input-section > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.input-section > input[type="url"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  background: #fafbfc;
  color: #1a1a2e;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-section > input[type="url"]:focus {
  outline: none;
  border-color: #e94560;
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.input-hint {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 6px;
}

/* ── Auth section ────────────────────────────── */

.auth-section {
  margin-top: 16px;
}

.auth-section details {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.auth-section summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  background: #f8f9fc;
  user-select: none;
}

.auth-section summary:hover {
  background: #f1f5f9;
}

.auth-section details[open] summary {
  border-bottom: 1px solid #e5e7eb;
}

.auth-fields {
  padding: 14px;
}

.field-row {
  display: flex;
  gap: 12px;
}

.field {
  flex: 1;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

.field input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #1a1a2e;
  transition: border-color 0.15s;
}

.field input:focus {
  outline: none;
  border-color: #e94560;
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.auth-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 10px;
  line-height: 1.5;
}

/* ── Target info ─────────────────────────────── */

.target-info {
  margin-top: 14px;
  padding: 8px 12px;
  background: #fef9ee;
  border: 1px solid #f0d97a;
  border-radius: 6px;
  font-size: 13px;
}

.target-label {
  color: #946b00;
  font-weight: 600;
}

.target-domain {
  font-family: 'SF Mono', monospace;
  color: #92400e;
}

/* ── Status messages ─────────────────────────── */

.status-message {
  margin-top: 12px;
  font-size: 13px;
  min-height: 20px;
}

.status-message.error {
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 10px 14px;
  border-radius: 6px;
}

.status-message.loading {
  color: #6366f1;
}

.status-message.loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: #e94560;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* ── Buttons ─────────────────────────────────── */

.btn-primary {
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #16a34a;
  color: #fff;
  margin-top: 16px;
  transition: all 0.15s;
}

.btn-primary:hover:not(:disabled) {
  background: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Guide section ───────────────────────────── */

.guide-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 32px;
}

.guide-section h2 {
  font-size: 18px;
  font-weight: 700;
  color: #16213e;
  margin-bottom: 10px;
}

.guide-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin-top: 20px;
  margin-bottom: 8px;
}

.guide-section p {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 8px;
}

.guide-section pre {
  background: #1a1a2e;
  color: #a5b4fc;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.6;
  overflow-x: auto;
  margin-bottom: 8px;
}

.guide-section code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.guide-section p code {
  background: #eef2ff;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12.5px;
  color: #3730a3;
}

.guide-section ul {
  font-size: 14px;
  color: #475569;
  line-height: 1.8;
  margin: 0 0 8px 20px;
}

.guide-section ul code {
  background: #eef2ff;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12.5px;
  color: #3730a3;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.guide-section details {
  border: none;
}

.guide-section details summary {
  cursor: pointer;
  user-select: none;
  padding: 0;
  list-style: disclosure-closed;
}

.guide-section details[open] summary {
  list-style: disclosure-open;
  margin-bottom: 4px;
}

/* ── Footer ──────────────────────────────────── */

.landing-footer {
  text-align: center;
  padding: 16px 0;
  font-size: 13px;
  color: #94a3b8;
}

.landing-footer a {
  color: #6366f1;
  text-decoration: none;
}

.landing-footer a:hover {
  text-decoration: underline;
}

/* ── Explorer view ───────────────────────────── */

.explorer-header {
  background: linear-gradient(135deg, #16213e, #0f3460);
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.btn-back {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.btn-back:hover {
  background: rgba(255,255,255,0.2);
}

.explorer-title {
  font-size: 15px;
  font-weight: 600;
}

#swagger-ui {
  padding: 0 16px 32px;
}

/* ── Swagger UI overrides ────────────────────── */

.swagger-ui .topbar { display: none !important; }
.swagger-ui .info { margin: 16px 0 8px 0; }
.swagger-ui .scheme-container { display: none !important; }
.swagger-ui .authorization__btn { display: none !important; }
.swagger-ui section.models { display: none !important; }
.swagger-ui .auth-wrapper { display: none !important; }
.swagger-ui .info .title small { display: none !important; }
.swagger-ui .copy-to-clipboard { display: none !important; }
.swagger-ui .response-control-media-type { display: none !important; }
.swagger-ui .response-control-media-type--accept-controller { display: none !important; }

.swagger-ui .responses-inner {
  max-height: 500px;
  overflow-y: auto;
}

.swagger-ui select {
  max-width: 300px;
}

/* Data Dictionary table */
.swagger-ui .info .renderedMarkdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0;
}

.swagger-ui .info .renderedMarkdown table th {
  background: #16213e;
  color: #fff;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.swagger-ui .info .renderedMarkdown table td {
  padding: 6px 12px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}

.swagger-ui .info .renderedMarkdown table tr:hover td {
  background: #f0f4ff;
}

.swagger-ui .info .renderedMarkdown table code {
  background: #eef2ff;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  color: #3730a3;
}

/* Collapsible Data Dictionary */
.swagger-ui .info .renderedMarkdown details {
  margin-top: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.swagger-ui .info .renderedMarkdown details summary {
  padding: 10px 14px;
  cursor: pointer;
  background: #f1f5f9;
  font-size: 14px;
  color: #16213e;
  user-select: none;
}

.swagger-ui .info .renderedMarkdown details summary:hover {
  background: #e8edf4;
}

.swagger-ui .info .renderedMarkdown details[open] summary {
  border-bottom: 1px solid #e5e7eb;
}

.swagger-ui .info .renderedMarkdown details > *:not(summary) {
  padding: 0 14px;
}
