/* Shared UI components — referenced by main.css and standalone page stylesheets */

/* ── Badge (semantic coloured label: type, version, AI) ─── */
.dp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  border-radius: 0.375rem;
  padding: 0.25rem 0.5625rem;
  font-size: 0.719rem;
  font-weight: 600;
  white-space: nowrap;
}

.dp-badge--rest    { background: #e6f2fb; color: #0277bd; }
.dp-badge--graphql { background: #fce4ef; color: #d6336c; }
.dp-badge--soap    { background: #ece9fb; color: #6741d9; }
.dp-badge--ws      { background: #fff1e6; color: #e65100; }
.dp-badge--mcp     { background: #e0f7fa; color: #006064; }
.dp-badge--ai         { background: linear-gradient(135deg, #7c3aed, #a855f7); color: var(--white); }
.dp-badge--deprecated { background: var(--warning-surface); color: var(--warning); }

.dp-badge--version {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-family-mono);
  font-size: 0.78125rem;
}

.dp-badge--status-active   { background: var(--success-surface); color: var(--success); }
.dp-badge--status-inactive { background: var(--surface-sunken); color: var(--text-muted); }

/* ── Tag (neutral keyword label) ─────────────────────────── */
.dp-tag {
  display: inline-flex;
  align-items: center;
  background: var(--surface-sunken);
  color: var(--text-muted);
  border-radius: 0.375rem;
  padding: 0.25rem 0.5625rem;
  font-size: 0.719rem;
  font-weight: 500;
}

/* Tag group container */
.dp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4375rem;
  margin-top: 1rem;
}

.dp-tag--white {
  background: var(--white);
}

/* ── Message Overlay (inside cards) ─────────────────────── */
.message-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--surface);
  padding: 0.625rem 0.75rem;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.15);
}

.message-overlay.success {
  background-color: var(--surface);
  border: 1px solid var(--success);
  border-left: 4px solid var(--success);
}

.message-overlay.error {
  background-color: var(--surface);
  border: 1px solid var(--danger);
  border-left: 4px solid var(--danger);
}

.message-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.3125rem);
}

.message-content {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 0.5rem;
}

.message-icon {
  flex-shrink: 0;
  font-size: 1rem;
  width: 1rem;
  height: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.message-icon.success { color: var(--success); }
.message-icon.error   { color: var(--danger); }

.message-text {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-width: 100%;
}

.close-message {
  cursor: pointer;
  padding: 0.375rem;
  margin: -0.375rem -0.375rem -0.375rem 0.5rem;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s;
  color: var(--text);
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-message:hover { opacity: 1; }

/* ── Status Pill ─────────────────────────────────────────── */
.sub-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 0.875rem;
  padding: 0.3125rem 0.6875rem;
  font-size: 0.71875rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.sub-status-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  flex: none;
}

.sub-status-pill--active {
  background: var(--success-surface);
  color: var(--success);
}

.sub-status-pill--active .sub-status-dot {
  background: var(--success);
}

.sub-status-pill--inactive {
  background: var(--surface-sunken);
  color: var(--text-muted);
}

.sub-status-pill--inactive .sub-status-dot {
  background: var(--text-subtle);
}

/* ── Buttons (common-btn-*) ──────────────────────────────────── */
.common-btn-primary {
  display: inline-block;
  background-color: var(--primary);
  color: var(--white);
  font-size: 0.875rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 0.5rem;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s ease-in-out;
  box-shadow: 0 0.25rem 0.375rem rgba(0, 0, 0, 0.1);
}
.common-btn-primary[disabled],
.common-btn-primary.disabled {
  background-color: var(--primary);
  color: var(--white);
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.common-btn-light {
  display: inline-block;
  background-color: var(--primary-light);
  color: var(--white);
  font-size: 0.875rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 1.875rem;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s ease-in-out;
  box-shadow: 0 0.25rem 0.375rem rgba(0, 0, 0, 0.1);
}

.common-btn-light:hover { background-color: var(--primary); color: var(--white); }
.common-btn-light:active { background-color: var(--primary); color: var(--white); }
.common-btn-primary:hover { background-color: var(--primary-light); color: var(--white); }
.common-btn-primary:active { background-color: var(--primary); color: var(--white); }
.common-btn-primary:focus { outline: none; }


.common-btn-link {
  display: inline-block;
  color: var(--primary);
  font-size: 0.875rem;
  padding: 0.625rem 1.25rem;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s ease-in-out;
  box-shadow: none;
}
.common-btn-link:hover { color: var(--primary-light); text-decoration: none; }
.common-btn-link:active { color: var(--primary); }
.common-btn-link:focus { border: none; }

.common-btn-outlined {
  display: inline-block;
  background-color: transparent;
  color: var(--primary);
  font-size: 0.875rem;
  padding: 0.625rem 1.25rem;
  border: 0.0625rem solid var(--primary);
  border-radius: 0.5rem;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s ease-in-out;
}
.common-btn-outlined:hover { background-color: var(--primary-light); color: var(--white); border-color: var(--primary); }
.common-btn-outlined:active { background-color: var(--primary-light); color: var(--white); }
.common-btn-outlined:focus { outline: none; }
.common-btn-outlined disabled,
.common-btn-outlined.disabled { opacity: 0.5; }

.common-btn-danger { background-color: var(--danger); color: var(--white); }
.common-btn-danger:hover { background-color: var(--danger); color: var(--white); }
.common-btn-danger:active { background-color: var(--danger); color: var(--white); }
.common-btn-danger:focus { outline: none; }

/* ── Generic badge / type badge ──────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.3125rem 0.625rem;
  border-radius: 0.3125rem;
  font-size: 0.625rem;
  font-weight: 500;
}

.type-badge {
  display: inline-block;
  padding: 0.3125rem;
  border-radius: 0.3125rem;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ── Card shell ──────────────────────────────────────────────── */
.dev-card {
  height: 100%;
  border-radius: 0.75rem;
  padding: 1.25rem;
  background: var(--surface);
}

/* ── Custom Modal ────────────────────────────────────────────── */
.custom-modal {
  background-color: var(--overlay);
}

.custom-modal-content {
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  overflow: hidden;
  padding: 0;
  width: 100%;
}

.custom-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background-color: var(--white);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.custom-modal-title {
  font-size: 1rem;
  font-weight: 500;
}

.custom-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}

.custom-modal-body::-webkit-scrollbar { width: 0.5rem; }
.custom-modal-body::-webkit-scrollbar-track { background: var(--surface-sunken); border-radius: 0.25rem; }
.custom-modal-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 0.25rem; }
.custom-modal-body::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

.custom-modal .api-banner-content { padding: 1.5rem 2rem; min-height: auto; }
.custom-modal .api-title h4 { font-size: 1.35rem; white-space: normal; overflow: visible; text-overflow: unset; word-break: break-word; }
.custom-modal .api-title .api-description { font-size: 0.875rem; }
.custom-modal .masked-token { max-width: 100%; white-space: normal; word-break: break-all; overflow: visible; text-overflow: unset; }
.custom-modal .token-display { flex-wrap: wrap; gap: 0.35rem; }
.custom-modal .subscription-content .table { table-layout: fixed; width: 100%; }
.custom-modal .subscription-content .table th:nth-child(1),
.custom-modal .subscription-content .table td:nth-child(1) { width: 15%; }
.custom-modal .subscription-content .table th:nth-child(2),
.custom-modal .subscription-content .table td:nth-child(2) { width: 12%; }
.custom-modal .subscription-content .table th:nth-child(3),
.custom-modal .subscription-content .table td:nth-child(3) { width: 53%; word-break: break-all; }
.custom-modal .subscription-content .table th:nth-child(4),
.custom-modal .subscription-content .table td:nth-child(4) { width: 20%; }
.custom-modal .api-image-small { max-width: 4.375rem; max-height: 4.375rem; }

/* ── Primary / outline CTA buttons ──────────────────────────── */
.dp-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 1.25rem;
  padding: 0.6875rem 1.375rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  transition: opacity 0.15s, background 0.15s;
}

.dp-btn--primary { background: var(--cta-gradient); color: var(--white); }
.dp-btn--primary:hover { opacity: 0.9; color: var(--white); text-decoration: none; }
.dp-btn--primary:disabled,
.dp-btn--primary.disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.dp-btn--outline { background: var(--white); border: 1px solid var(--border-strong); color: var(--primary); }
.dp-btn--outline:hover { background: var(--surface-sunken); color: var(--primary); text-decoration: none; }

.dp-btn--ai { background: linear-gradient(135deg, #7c3aed, #a855f7); color: var(--white); border: none; }
.dp-btn--ai:hover { opacity: 0.9; color: var(--white); text-decoration: none; }

.dp-btn--lg { padding: 0.8125rem 1.75rem; font-size: 0.90625rem; }

.dp-btn--block {
  display: flex;
  width: 100%;
  justify-content: center;
  margin-top: 1rem;
  padding: 0.625rem;
  font-size: 0.84375rem;
}

.dp-btn--current,
.dp-btn--current:hover { background: var(--surface-sunken); color: var(--text-muted); border: none; cursor: default; pointer-events: none; }

/* ── Icon button ─────────────────────────────────────────────── */
.dp-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  padding: 0.3125rem;
  color: var(--text-muted);
  cursor: pointer;
  flex: none;
  transition: background 0.15s, color 0.15s;
}
.dp-btn-icon:hover { background: var(--border); color: var(--primary); }

.dp-btn-icon--bordered {
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--border);
  border-radius: 0.4375rem;
  background: var(--white);
  color: var(--text-muted);
  font-size: 0.8125rem;
  padding: 0;
}
.dp-btn-icon--bordered:hover { background: var(--surface-sunken); border-color: var(--border-strong); color: var(--text-muted); }

/* ── Inline copy button (shared across all copy buttons) ─────── */
.copy-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  padding: 0;
  transition: background 0.15s;
  flex: none;
}
.copy-btn:hover { background: var(--border); }
.copy-btn-icon {
  display: inline-flex;
  color: var(--text-muted);
  padding: 0.3125rem;
  font-size: 0.9375rem;
  line-height: 1;
}
.copy-btn-check {
  display: none;
  align-items: center;
  gap: 0.3125rem;
  background: var(--success-surface);
  color: var(--success);
  border-radius: 0.375rem;
  padding: 0.25rem 0.5625rem 0.25rem 0.4375rem;
  font-size: 0.71875rem;
  font-weight: 600;
  line-height: 1;
  font-family: inherit;
  white-space: nowrap;
}
.copy-btn--copied .copy-btn-icon { display: none; }
.copy-btn--copied .copy-btn-check { display: inline-flex; }

/* ── Empty state (centred, full-section) ─────────────────────── */
.dp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3.75rem 0 5rem;
}

.dp-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 0 80px;
}

.dp-empty-icon {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  background: var(--primary-surface);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.dp-empty-title {
  margin: 24px 0 0;
  font-size: 1.1875rem;
  font-weight: 700;
  color: var(--text-strong);
}

.dp-empty-desc {
  margin: 10px 0 0;
  max-width: 420px;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.dp-empty-state .dp-create-btn {
  margin-top: 24px;
  padding: 12px 26px;
}

.dp-empty .dp-btn {
  margin-top: 1.5rem;
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
.dp-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.dp-breadcrumb-item {
  color: var(--text-muted);
  text-decoration: none;
}
.dp-breadcrumb-item:hover {
  color: var(--text-strong);
  text-decoration: none;
}
.dp-breadcrumb-sep {
  font-size: 0.6875rem;
  color: var(--border-strong);
  flex: none;
}
.dp-breadcrumb-current {
  color: var(--text-strong);
}

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1;
}

.page-desc {
  margin: 9px 0 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.page-container {
  padding: 1rem 0;
}

/* ── Error box (inline validation/not-found message) ─────── */
.dp-error-box {
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6875rem 0.875rem;
  background: var(--danger-surface);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--surface));
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  color: var(--danger);
  line-height: 1.5;
}
.dp-error-box--visible { display: flex; }
.dp-error-box i { font-size: 0.875rem; flex: none; margin-top: 0.1em; }

/* ── Overview two-column body layout (shared: API + MCP) ──────── */
.aov-body {
  display: flex;
  gap: 1.875rem;
  align-items: flex-start;
  padding: 1.875rem 1rem 2.5rem;
}
.aov-body-main { flex: 1; min-width: 0; }
.aov-body-sidebar { width: 22.5rem; flex: none; }

/* ── Content section shell ────────────────────────────────────── */
.aov-section { margin-bottom: 1.875rem; }
.aov-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}
.aov-section-title { margin: 0; font-size: 1.0625rem; font-weight: 700; color: var(--text-strong); }
.aov-section-count { font-size: 0.78125rem; font-weight: 500; color: var(--text-muted); }

/* ── Endpoint / URL rows (shared: API endpoints + MCP URL) ────── */
.aov-endpoint-card {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1.125rem;
  margin-bottom: 0.75rem;
}
.aov-endpoint-label-row { display: flex; align-items: center; gap: 0.5625rem; }
.aov-endpoint-dot { width: 0.4375rem; height: 0.4375rem; border-radius: 50%; flex: none; }
.aov-endpoint-dot--prod    { background: var(--success); }
.aov-endpoint-dot--sandbox { background: var(--warning); }
.aov-endpoint-label { font-size: 0.78125rem; font-weight: 600; color: var(--text-strong); }
.aov-endpoint-url-row {
  margin-top: 0.6875rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 0.5625rem;
  padding: 0.6875rem 0.875rem;
}
.aov-endpoint-url {
  flex: 1;
  min-width: 0;
  font-family: var(--font-family-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
}

/* ── Subscription plans sidebar (shared: API + MCP) ───────────── */
.aov-plans-wrap { padding: 0; }
.aov-plans-title { margin: 0 0 0.875rem; font-size: 1.0625rem; font-weight: 700; color: var(--text-strong); }
.aov-plan-card {
  position: relative;
  overflow: hidden;
  border: 1.5px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.125rem 1.25rem;
  margin-bottom: 0.75rem;
  background: var(--white);
}
.aov-plan-card--featured    { border-color: color-mix(in srgb, var(--warning) 40%, var(--surface)); background: color-mix(in srgb, var(--warning) 6%, var(--surface)); }
.aov-plan-card--subscribed  { border-color: color-mix(in srgb, var(--success) 40%, var(--surface)); background: color-mix(in srgb, var(--success) 6%, var(--surface)); }
.aov-plan-card--suspended   { border-color: color-mix(in srgb, var(--warning) 35%, var(--surface)); background: color-mix(in srgb, var(--warning) 6%, var(--surface)); }

.aov-plan-ribbon {
  display: none;
  position: absolute;
  top: 0; right: 0;
  width: 7.25rem; height: 7.25rem;
  pointer-events: none;
}
.aov-plan-card--subscribed .aov-plan-ribbon,
.aov-plan-card--suspended  .aov-plan-ribbon { display: block; }
.aov-plan-ribbon-label {
  position: absolute;
  top: 1.25rem; right: -2.25rem;
  width: 9.375rem;
  text-align: center;
  transform: rotate(45deg);
  background: var(--success);
  color: var(--white);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 0.3125rem 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.aov-plan-card--suspended .mcp-ribbon-label { background: var(--warning); }
.aov-plan-card--suspended .api-ribbon-label  { background: var(--warning); }
.api-view-sub-btn { display: flex !important; align-items: center; justify-content: center; gap: 0.4375rem; }
.aov-plan-card-head { display: flex; align-items: center; justify-content: space-between; }
.aov-plan-name-row { display: flex; align-items: center; gap: 0.5625rem; }
.aov-plan-icon {
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}
.aov-plan-name { font-size: 0.9375rem; font-weight: 700; color: var(--text-strong); }
.aov-recommended-badge {
  background: var(--cta-gradient);
  color: var(--white);
  border-radius: 1.25rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.65625rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.aov-plan-limit { margin-top: 0.875rem; display: flex; align-items: baseline; gap: 0.4375rem; }
.aov-plan-count { font-size: 1.625rem; font-weight: 700; color: var(--primary); }
.aov-plan-unit  { font-size: 0.78125rem; color: var(--text-muted); }

.aov-plan-spinner {
  display: none;
  width: 0.875rem; height: 0.875rem;
  border: 2px solid color-mix(in srgb, var(--primary) 25%, var(--surface));
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: aov-spin .7s linear infinite;
  flex: none;
}
@keyframes aov-spin { to { transform: rotate(360deg); } }
.aov-btn-loading .aov-plan-spinner { display: inline-block; }
.aov-btn-loading {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  opacity: 0.85;
  pointer-events: none;
}

.aov-plan-error {
  display: none;
  margin-top: 0.625rem;
  align-items: flex-start;
  gap: 0.5rem;
  background: var(--danger-surface);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--surface));
  border-radius: 0.5625rem;
  padding: 0.5625rem 0.6875rem;
}
.aov-plan-error--visible { display: flex; }
.aov-plan-error-title { font-size: 0.75rem; font-weight: 600; line-height: 1.3; color: var(--danger); }
.aov-plan-error-desc  { margin-top: 0.125rem; font-size: 0.71875rem; line-height: 1.4; color: color-mix(in srgb, var(--danger) 72%, var(--ink)); }

.aov-existing-subs { margin-bottom: 1.25rem; }
.aov-existing-subs-title { font-size: 0.875rem; font-weight: 600; color: var(--text-strong); margin-bottom: 0.625rem; }

@media (max-width: 1024px) {
  .aov-body { flex-direction: column; }
  .aov-body-sidebar { width: 100%; }
}