/* ==========================================================================
   Developer API Documentation Styles
   Template: app/templates/main/api_docs.html
   ========================================================================== */

.api-docs-container {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

/* Top Header Row */
.api-docs-header-bar {
  margin-bottom: 1.5rem;
}

.api-docs-title {
  font-size: 2.3rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0;
}

/* Page Guide Popover & SVG Constraints */
.info-help-popover-header {
  font-weight: 700;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.info-help-popover-header svg,
.faq-popover-icon {
  width: 1.15rem !important;
  height: 1.15rem !important;
  max-width: 1.15rem !important;
  max-height: 1.15rem !important;
  flex-shrink: 0;
  color: var(--color-primary) !important;
  stroke: var(--color-primary) !important;
}

.api-docs-header-bar .info-help-popover {
  width: 390px;
  max-width: calc(100vw - 32px);
  padding: 1.1rem 1.35rem;
}

@media (max-width: 768px) {
  .api-docs-header-bar .info-help-popover {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    bottom: auto !important;
    left: 0 !important;
    right: auto !important;
    transform: none;
    width: min(320px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    z-index: 100000 !important;
    box-sizing: border-box !important;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.22) !important;
  }
  .api-docs-header-bar .info-help-popover.popover-flip-up {
    top: auto !important;
    bottom: calc(100% + 8px) !important;
  }
}

/* Global Test Auth Banner */
.api-auth-card {
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
}

.api-auth-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.api-auth-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.api-auth-icon {
  width: 1.3rem;
  height: 1.3rem;
  color: var(--color-primary);
  flex-shrink: 0;
}

.api-auth-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}

.api-auth-status-badge {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.api-auth-status-active {
  background: rgba(39, 174, 96, 0.12);
  color: var(--color-success);
  border: 1px solid rgba(39, 174, 96, 0.3);
}

.api-auth-status-empty {
  background: rgba(138, 121, 104, 0.14);
  color: var(--color-text-muted);
  border: 1px solid rgba(138, 121, 104, 0.3);
}

.api-auth-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: end;
}

.api-auth-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.api-auth-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.api-auth-input {
  width: 100%;
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  color: var(--color-text-primary);
  font-family: monospace;
  box-sizing: border-box;
}

.api-auth-input:focus {
  outline: none;
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.15);
}

.api-auth-secret-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.api-auth-secret-toggle {
  position: absolute;
  right: 0.6rem;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
}

.api-auth-actions-group {
  display: flex;
  gap: 0.5rem;
}

/* Two-Column Layout Grid */
.api-layout-grid {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

/* Sticky Navigation Sidebar */
.api-sidebar-toc {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 1.4rem 1.25rem;
  scrollbar-width: thin;
}

.api-sidebar-toc::-webkit-scrollbar {
  width: 6px;
}

.api-sidebar-toc::-webkit-scrollbar-thumb {
  background: rgba(138, 121, 104, 0.25);
  border-radius: 10px;
}

.api-nav-search {
  width: 100%;
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  box-sizing: border-box;
}

.api-nav-search:focus {
  outline: none;
  border-color: var(--color-primary) !important;
}

.api-nav-section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin: 1.2rem 0 0.45rem 0.4rem;
  display: block;
}

.api-nav-section-title:first-of-type {
  margin-top: 0;
}

.api-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.api-nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--color-text-primary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.api-nav-link:hover {
  background: rgba(211, 84, 0, 0.08);
  color: var(--color-primary);
}

.api-nav-link.active {
  background: rgba(211, 84, 0, 0.14);
  color: var(--color-primary);
  font-weight: 700;
}

/* HTTP Method Badges */
.http-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.18rem 0.42rem;
  border-radius: 5px;
  letter-spacing: 0.04em;
  text-align: center;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.http-get {
  background: rgba(39, 174, 96, 0.12);
  color: #27AE60;
  border: 1px solid rgba(39, 174, 96, 0.3);
}

.http-post {
  background: rgba(41, 128, 185, 0.12);
  color: #2980B9;
  border: 1px solid rgba(41, 128, 185, 0.3);
}

.http-patch {
  background: rgba(211, 84, 0, 0.12);
  color: #D35400;
  border: 1px solid rgba(211, 84, 0, 0.3);
}

.http-delete {
  background: rgba(192, 57, 43, 0.12);
  color: #C0392B;
  border: 1px solid rgba(192, 57, 43, 0.3);
}

/* Main Content Area */
.api-content-pane {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-width: 0;
}

/* Section Card */
.api-section-header-card {
  padding: 2rem 2.2rem;
}

.api-section-header-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
}

.api-section-header-desc {
  font-size: 0.96rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0;
}

/* Endpoint Card */
.api-endpoint-card {
  padding: 2.2rem 2.2rem;
  scroll-margin-top: 100px;
}

.api-endpoint-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.api-endpoint-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.api-endpoint-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text-primary);
}

.api-endpoint-url-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.api-endpoint-url {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 600;
  background: #ffffff;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: var(--color-text-primary);
}

.api-auth-requirement-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(211, 84, 0, 0.08);
  color: var(--color-primary);
  border: 1px solid rgba(211, 84, 0, 0.2);
}

.api-auth-requirement-public {
  background: rgba(39, 174, 96, 0.08);
  color: var(--color-success);
  border: 1px solid rgba(39, 174, 96, 0.2);
}

/* Endpoint Split Layout (Docs Left, Interactive Right) */
.api-endpoint-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
}

.api-endpoint-docs-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.api-endpoint-desc {
  font-size: 0.94rem;
  color: var(--color-text-primary);
  line-height: 1.6;
  margin: 0;
}

.api-subheading {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0 0 0.6rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Parameters Table */
.api-table-wrapper {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.api-params-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.api-params-table th {
  background: rgba(0, 0, 0, 0.025);
  padding: 0.65rem 0.9rem;
  font-weight: 700;
  color: var(--color-text-muted);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.api-params-table td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  vertical-align: top;
  color: var(--color-text-primary);
  line-height: 1.45;
}

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

.api-param-name {
  font-family: monospace;
  font-weight: 700;
  color: var(--color-primary);
}

.api-required-star {
  color: #C0392B;
  font-weight: bold;
}

.api-param-type {
  font-size: 0.72rem;
  font-family: monospace;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: var(--color-text-muted);
  display: inline-block;
  margin-top: 0.2rem;
}

/* Interactive Code & Try-It Panel */
.api-interactive-box {
  background: #23272e;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
}

.api-tab-bar {
  display: flex;
  background: #1e2227;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.25rem 0.5rem;
  overflow-x: auto;
  gap: 0.35rem;
}

.api-tab-btn {
  background: none;
  border: none;
  color: #abb2bf;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.api-tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.api-tab-btn.active {
  color: #ffffff;
  background: var(--color-primary);
}

.api-code-content-wrap {
  position: relative;
  padding: 1rem 1.1rem;
}

.api-code-block {
  margin: 0;
  font-family: Consolas, Monaco, 'Andale Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #abb2bf;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

.api-copy-code-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: background 0.15s ease;
}

.api-copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Interactive Try It Form */
.api-tryit-form {
  padding: 1.25rem 1.25rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.api-tryit-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.api-tryit-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.api-tryit-input {
  width: 100%;
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.84rem;
  font-family: monospace;
  box-sizing: border-box;
}

.api-tryit-textarea {
  width: 100%;
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.82rem;
  font-family: monospace;
  box-sizing: border-box;
  resize: vertical;
  min-height: 120px;
}

.api-tryit-send-btn {
  padding: 0.55rem 1rem;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

/* Live Terminal Result */
.api-tryit-result {
  background: #1e2227;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.api-result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #abb2bf;
}

.api-status-tag {
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.api-status-2xx {
  background: rgba(39, 174, 96, 0.2);
  color: #2ecc71;
}

.api-status-4xx, .api-status-5xx {
  background: rgba(192, 57, 43, 0.25);
  color: #e74c3c;
}

.api-sim-tag {
  font-size: 0.74rem;
  font-weight: 700;
  color: #2ecc71;
  background: rgba(39, 174, 96, 0.16);
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  border: 1px solid rgba(39, 174, 96, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.api-simulation-notice-bar {
  margin-top: 0.85rem;
  padding: 0.65rem 0.95rem;
  background: rgba(211, 84, 0, 0.06);
  border: 1px solid rgba(211, 84, 0, 0.18);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.84rem;
  color: var(--color-text-primary);
  line-height: 1.45;
}

/* Responsive adjustments */
@media (max-width: 1080px) {
  .api-endpoint-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .api-layout-grid {
    grid-template-columns: 1fr;
  }
  .api-sidebar-toc {
    position: static;
    max-height: none;
    margin-bottom: 1.5rem;
  }
  .api-auth-inputs-grid {
    grid-template-columns: 1fr;
  }
  .api-auth-actions-group {
    width: 100%;
  }
  .api-auth-actions-group button {
    flex: 1;
  }
}

/* Visibility utilities to enforce zero inline CSS */
.api-hidden {
  display: none !important;
}
