/* ═══════════════════════════════════════════════════════════════════
   7AZZANI API Documentation — Signal Design System
   Hardware-specular, console aesthetic for developer API reference.
   Scoped to .sg and .apid- to preserve isolation.
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Ambient Glow & Page Backdrop ─── */
.sg.apid-root {
  min-height: 100vh;
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(52, 211, 153, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 85% 20%, rgba(103, 232, 249, 0.04) 0%, transparent 40%),
    linear-gradient(to bottom, transparent, var(--bg));
  position: relative;
}

.sg.apid-root::before {
  content: '';
  position: absolute;
  inset: 0;
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, rgba(148, 163, 184, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.03) 1px, transparent 1px);
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 50%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 50%, transparent 100%);
}

.apid-container {
  position: relative;
  z-index: 1;
}

/* ─── Hero Section ─── */
.apid-hero {
  text-align: center;
  max-width: 58rem;
  margin-inline: auto;
  padding-top: clamp(2.5rem, 5vw, 4.5rem);
  padding-bottom: clamp(2rem, 4vw, 3.5rem);
}

.apid-hero .sg-eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.06);
  border: 1px solid rgba(52, 211, 153, 0.2);
  font: 600 0.68rem/1 var(--mono);
  letter-spacing: 0.2em;
  color: var(--green);
  text-transform: uppercase;
}

.apid-hero .sg-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  display: inline-block;
  animation: apid-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes apid-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.apid-hero h1 {
  font-size: clamp(2.5rem, 5.5vw, 4.4rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: #fff;
  margin-bottom: 1.2rem;
  text-wrap: balance;
}

.apid-hero h1 .tv {
  background: linear-gradient(135deg, #ffffff 30%, var(--green-2) 80%, var(--cyan) 110%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.apid-hero p.apid-sub {
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.65;
  margin-inline: auto;
  max-width: 44rem;
  margin-bottom: 2rem;
}

.apid-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 2.5rem;
}

/* ─── Active API Key Banner (If Logged In) ─── */
.apid-key-pill-strip {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(14, 23, 34, 0.8);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.apid-key-pill-label {
  color: var(--dim);
  font: 600 0.68rem/1 var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.apid-key-pill-label i {
  color: var(--green);
}

.apid-key-pill-value {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--green);
  background: rgba(52, 211, 153, 0.1);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.apid-key-pill-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  font-size: 0.85rem;
  transition: color 0.2s, transform 0.15s;
}

.apid-key-pill-btn:hover {
  color: #fff;
  transform: scale(1.1);
}

/* ─── Telemetry Summary Strip ─── */
.apid-telemetry {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  max-width: 64rem;
  margin-inline: auto;
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.apid-tele-item {
  position: relative;
  padding: 1.25rem 1.4rem;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  text-align: left;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

.apid-tele-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green), transparent 75%);
  opacity: 0.4;
  transition: opacity 0.25s;
}

.apid-tele-item:hover {
  border-color: var(--line-2);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.apid-tele-item:hover::before {
  opacity: 1;
}

.apid-tele-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--dim);
  font: 600 0.62rem/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.apid-tele-label i {
  color: var(--green);
  font-size: 0.75rem;
}

.apid-tele-val {
  font-family: var(--display);
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #fff;
}

.apid-tele-desc {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

/* ─── Floating Sticky Capsule Navigation Bar ─── */
.apid-nav-bar {
  position: sticky;
  top: 1rem;
  z-index: 45;
  width: 100%;
  padding-inline: 1rem;
  margin-bottom: 3.5rem;
  pointer-events: none;
}

.apid-nav-capsule {
  pointer-events: auto;
  max-width: max-content;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  background: rgba(10, 17, 25, 0.88);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.apid-nav-capsule::-webkit-scrollbar {
  display: none;
}

.apid-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  font: 600 0.78rem/1 var(--body);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  border: 1px solid transparent;
}

.apid-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.apid-nav-link.is-active {
  color: #04110c;
  background: var(--green);
  border-color: var(--green);
  font-weight: 700;
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.4);
}

/* ─── Global Documentation Section Styling (Scoped under .sg) ─── */
.sg section[id] {
  scroll-margin-top: 5.5rem;
  margin-bottom: clamp(3.5rem, 7vw, 5.5rem);
  position: relative;
}

/* Section Headings */
.sg section[id] > h2 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-wrap: balance;
}

.sg section[id] > h2 i {
  color: var(--green);
  font-size: 0.85em;
}

/* Card Panels (.bg-gray-800 to Signal .sg-card style) */
.sg .bg-gray-800 {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--r) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25) !important;
  transition: border-color 0.25s, box-shadow 0.25s !important;
}

.sg .bg-gray-800:hover {
  border-color: var(--line-2) !important;
}

/* Sub-cards (.bg-gray-700 & .bg-gray-900) */
.sg .bg-gray-700 {
  background: var(--panel-2) !important;
  border: 1px solid rgba(148, 163, 184, 0.1) !important;
  border-radius: calc(var(--r) - 0.35rem) !important;
}

.sg .bg-gray-900 {
  background: #060a10 !important;
  border: 1px solid rgba(148, 163, 184, 0.12) !important;
  border-radius: calc(var(--r) - 0.35rem) !important;
}

/* Typography Overrides */
.sg .text-white {
  color: #fff !important;
  font-family: var(--body);
}

.sg h3.text-white, .sg h3.text-2xl, .sg h3.text-xl {
  font-family: var(--display) !important;
  letter-spacing: -0.025em;
  color: #fff !important;
}

.sg .text-gray-300 {
  color: var(--ink) !important;
  line-height: 1.65;
}

.sg .text-gray-400 {
  color: var(--muted) !important;
  line-height: 1.55;
}

.sg .text-gray-500 {
  color: var(--dim) !important;
}

.sg a.text-emerald-400 {
  color: var(--green) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
}

.sg a.text-emerald-400:hover {
  color: var(--green-2) !important;
}

/* ─── Hero / Gradient Banners Override ─── */
.sg .bg-gradient-to-r.from-emerald-600.to-emerald-800 {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.15) 0%, rgba(14, 23, 34, 0.95) 75%) !important;
  border: 1px solid rgba(52, 211, 153, 0.3) !important;
  border-radius: var(--r) !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.sg .bg-gradient-to-r .text-emerald-100 {
  color: #d1fae5 !important;
}

/* ─── Code Snippets & Pre Blocks ─── */
.sg pre {
  background: #05080e !important;
  border: 1px solid rgba(148, 163, 184, 0.14) !important;
  border-radius: 0.75rem !important;
  padding: 1.15rem 1.25rem !important;
  font-family: var(--mono) !important;
  font-size: 0.85rem !important;
  line-height: 1.6 !important;
  color: #d4e5df !important;
  position: relative;
  overflow-x: auto;
}

.sg pre code {
  font-family: inherit !important;
  color: inherit !important;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

/* Inline Code Badges */
.sg code:not(pre code) {
  font-family: var(--mono) !important;
  font-size: 0.82em !important;
  color: var(--cyan) !important;
  background: rgba(103, 232, 249, 0.08) !important;
  border: 1px solid rgba(103, 232, 249, 0.2) !important;
  padding: 0.15rem 0.45rem !important;
  border-radius: 0.35rem !important;
  letter-spacing: -0.01em;
}

.sg code.text-emerald-400:not(pre code) {
  color: var(--green) !important;
  background: rgba(52, 211, 153, 0.08) !important;
  border-color: rgba(52, 211, 153, 0.25) !important;
}

/* Code block copy button */
.apid-code-wrapper {
  position: relative;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.apid-copy-btn {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  font: 600 0.68rem/1 var(--mono);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 2;
  backdrop-filter: blur(8px);
}

.apid-copy-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--green);
}

.apid-copy-btn.is-copied {
  color: var(--green);
  border-color: var(--green);
  background: rgba(52, 211, 153, 0.15);
}

/* ─── Endpoint Strips & Method Badges ─── */
.sg .border-l-4.border-emerald-500 {
  border-left: 3px solid var(--green) !important;
  background: rgba(14, 23, 34, 0.55);
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  border-right: 1px solid rgba(148, 163, 184, 0.08);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 0 0.75rem 0.75rem 0;
  padding: 1rem 1.25rem !important;
  margin-bottom: 1rem !important;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.sg .border-l-4.border-emerald-500:hover {
  background: rgba(14, 23, 34, 0.85);
  border-right-color: rgba(148, 163, 184, 0.18);
  transform: translateX(2px);
}

.sg .border-l-4.border-red-500 {
  border-left: 3px solid #fb7185 !important;
  background: rgba(251, 113, 133, 0.04);
  border-radius: 0 0.75rem 0.75rem 0;
  padding: 1rem 1.25rem !important;
  margin-bottom: 1rem !important;
}

.sg .border-l-4.border-yellow-500 {
  border-left: 3px solid var(--warm) !important;
  background: rgba(245, 196, 81, 0.04);
  border-radius: 0 0.75rem 0.75rem 0;
  padding: 1rem 1.25rem !important;
  margin-bottom: 1rem !important;
}

.sg .border-l-4.border-gray-500 {
  border-left: 3px solid var(--dim) !important;
  background: rgba(148, 163, 184, 0.04);
  border-radius: 0 0.75rem 0.75rem 0;
  padding: 1rem 1.25rem !important;
  margin-bottom: 1rem !important;
}

/* HTTP Method Badges */
.sg .bg-blue-600 {
  background: rgba(103, 232, 249, 0.12) !important;
  color: var(--cyan) !important;
  border: 1px solid rgba(103, 232, 249, 0.3) !important;
  font: 700 0.68rem/1 var(--mono) !important;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.55rem !important;
  border-radius: 4px !important;
}

.sg .bg-green-600 {
  background: rgba(52, 211, 153, 0.12) !important;
  color: var(--green) !important;
  border: 1px solid rgba(52, 211, 153, 0.3) !important;
  font: 700 0.68rem/1 var(--mono) !important;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.55rem !important;
  border-radius: 4px !important;
}

.sg .bg-red-600 {
  background: rgba(251, 113, 133, 0.12) !important;
  color: #fb7185 !important;
  border: 1px solid rgba(251, 113, 133, 0.3) !important;
  font: 700 0.68rem/1 var(--mono) !important;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.55rem !important;
  border-radius: 4px !important;
}

/* Endpoint URL Code */
.sg .border-l-4 code.text-gray-300 {
  color: #fff !important;
  font-size: 0.95rem !important;
  font-weight: 600;
  background: transparent !important;
  border: none !important;
  letter-spacing: -0.01em;
}

/* Interactive Details / Summary */
.sg details {
  margin-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  padding-top: 0.75rem;
}

.sg summary {
  color: var(--green) !important;
  font: 600 0.82rem/1.2 var(--body) !important;
  cursor: pointer;
  outline: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: color 0.15s;
  user-select: none;
}

.sg summary:hover {
  color: var(--green-2) !important;
}

.sg summary::marker,
.sg summary::-webkit-details-marker {
  color: var(--green);
}

/* ─── Rate Limits Table Styling ─── */
.sg table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 0.75rem;
  overflow: hidden;
}

.sg thead th {
  background: #080d14 !important;
  color: var(--dim) !important;
  font: 600 0.65rem/1 var(--mono) !important;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.85rem 1rem !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14) !important;
}

.sg tbody tr {
  border-bottom: 1px solid rgba(148, 163, 184, 0.08) !important;
  transition: background 0.15s;
}

.sg tbody tr:hover {
  background: rgba(255, 255, 255, 0.03) !important;
}

.sg tbody td {
  padding: 0.85rem 1rem !important;
  font-size: 0.88rem;
}

.sg tbody td.text-emerald-400 {
  color: var(--green) !important;
  font-family: var(--mono);
  font-weight: 600;
}

/* ─── Tabs Styling (SDKs & Examples) ─── */
.sg .sdk-tab, .sg .example-tab {
  font: 600 0.8rem/1 var(--body) !important;
  border-radius: 999px !important;
  padding: 0.55rem 1.15rem !important;
  cursor: pointer;
  transition: all 0.2s !important;
  border: 1px solid rgba(148, 163, 184, 0.15) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  color: var(--muted) !important;
}

.sg .sdk-tab:hover, .sg .example-tab:hover {
  color: #fff !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

.sg .sdk-tab.active, .sg .example-tab.active,
.sg .sdk-tab.bg-emerald-600, .sg .example-tab.bg-gray-700 {
  background: var(--green) !important;
  border-color: var(--green) !important;
  color: #04110c !important;
  font-weight: 700 !important;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.35);
}

/* ─── FAQ Accordion Overhaul ─── */
.sg #faq .bg-gray-800 {
  margin-bottom: 0.75rem;
  transition: border-color 0.2s, background 0.2s;
}

.sg #faq .bg-gray-800:hover {
  border-color: rgba(52, 211, 153, 0.3) !important;
}

.sg #faq button {
  padding: 0.25rem 0;
  outline: none;
}

.sg #faq h3 {
  font-family: var(--display) !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: #fff !important;
  display: flex;
  align-items: center;
}

.sg .faq-icon {
  color: var(--green) !important;
  transition: transform 0.2s ease-out;
  display: inline-block;
  font-size: 0.8em;
}

.sg .faq-icon.is-open {
  transform: rotate(90deg);
}

/* ─── Steps Circle Badges (Getting Started) ─── */
.sg .w-10.h-10.bg-emerald-600 {
  background: rgba(52, 211, 153, 0.15) !important;
  border: 1px solid var(--green) !important;
  color: var(--green) !important;
  font-family: var(--mono) !important;
  font-weight: 800 !important;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.25) !important;
}

/* ─── Notice Boxes (Security Warnings & Pro Tips) ─── */
.sg .border-yellow-600 {
  border-color: rgba(245, 196, 81, 0.35) !important;
  background: rgba(245, 196, 81, 0.05) !important;
}

.sg .text-yellow-400 {
  color: var(--warm) !important;
}

.sg .bg-emerald-900 {
  background: rgba(52, 211, 153, 0.06) !important;
  border-color: rgba(52, 211, 153, 0.3) !important;
}

/* ─── Responsive Media Queries ─── */
@media (max-width: 900px) {
  .apid-telemetry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .apid-telemetry {
    grid-template-columns: 1fr;
  }
  .apid-hero h1 {
    font-size: 2.3rem;
  }
  .apid-hero-actions {
    flex-direction: column;
    width: 100%;
  }
  .apid-hero-actions .sg-btn {
    width: 100%;
    justify-content: center;
  }
  .apid-nav-bar {
    top: 0.5rem;
    padding-inline: 0.5rem;
  }
  .apid-nav-capsule {
    max-width: 100%;
    justify-content: flex-start;
  }
  .sg .border-l-4.border-emerald-500,
  .sg .border-l-4.border-red-500,
  .sg .border-l-4.border-yellow-500 {
    padding: 0.85rem 1rem !important;
  }
}
