/* =============================================================================
   Scalar OpenAPI Plugin Styling
   XGateway Figma Design System Integration
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Container Styling
   ----------------------------------------------------------------------------- */

/* Scalar API containers - smooth height transition during theme switch */
.scalar-api {
  transition: min-height 0.2s ease-out;
}

/* Tone down tag section header (e.g., "Invoice") */
.scalar-api .tag-section-container > section > .section-header-wrapper h2.section-header-label {
  font-size: 0.7rem !important;
  font-weight: 500 !important;
  color: #767B82 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
}

/* -----------------------------------------------------------------------------
   OpenAPI REST Header Component (manual and macro-generated)
   ----------------------------------------------------------------------------- */

.openapi-rest-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: var(--md-code-bg-color, #f5f5f5);
  border-radius: 4px;
  margin-bottom: 1rem;
  font-family: var(--md-code-font-family, monospace);
  font-size: clamp(0.65rem, 2vw, 0.85rem);
  min-width: 0;
}

.openapi-method {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: clamp(0.6rem, 1.8vw, 0.7rem);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.openapi-method-post   { background: #f59e0b; color: #1a1a00; }
.openapi-method-get    { background: #00a67d; color: #ffffff; }
.openapi-method-put    { background: #0284c7; color: #ffffff; }
.openapi-method-patch  { background: #d97706; color: #ffffff; }
.openapi-method-delete { background: #ef4444; color: #ffffff; }

.openapi-url-copy {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  transition: background-color 0.15s;
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
}

.openapi-url-copy:hover {
  background: rgba(0, 0, 0, 0.08);
}

[data-md-color-scheme="slate"] .openapi-url-copy:hover {
  background: rgba(255, 255, 255, 0.08);
}

.openapi-url-server,
.openapi-url-path {
  word-break: break-all;
  overflow-wrap: anywhere;
}

.openapi-url-server {
  color: #767B82;
}

.openapi-url-path {
  color: var(--md-default-fg-color, #333);
  font-weight: 500;
}

/* On narrow screens, stack server and path vertically */
@media (max-width: 480px) {
  .openapi-rest-header {
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
  }
  
  .openapi-url-copy {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .openapi-url-server,
  .openapi-url-path {
    width: 100%;
    line-height: 1.4;
  }
}

/* Manual code element inside rest-header */
.openapi-rest-header code {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-all;
  overflow-wrap: anywhere;
  background: transparent;
  font-size: inherit;
}

.openapi-copy-icon,
.openapi-check-icon {
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.openapi-url-copy:hover .openapi-copy-icon {
  opacity: 0.6;
}

.openapi-url-copy.copied .openapi-copy-icon {
  opacity: 0;
}

.openapi-url-copy.copied .openapi-check-icon {
  opacity: 1;
  color: #00a67d;
}
