/* ── Base Styles ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: "Geist", sans-serif;
  overflow-x: hidden;
  max-width: 100vw;
}

section[id] {
  scroll-margin-top: 72px;
}

/* ── Login overlay ── */
#loginOverlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #080a10;
  display: flex;
  align-items: center;
  justify-content: center;
}

#loginOverlay.hidden {
  display: none;
}

/* ── Modal / overlay ── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal {
  background: #0f1117;
  border: 1px solid #1e2130;
  border-radius: 12px;
  padding: 1.25rem;
  width: 360px;
  max-width: calc(100vw - 2rem);
  position: relative;
}

.modal h3 {
  font-size: 0.9375rem;
  font-weight: 800;
  color: #f3f4f6;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.modal p {
  font-size: 0.875rem;
  color: #8b8aa8;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.modal-close {
  position: absolute;
  top: 0.875rem;
  right: 0.875rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  transition: color 0.15s;
}

.modal-close:hover {
  color: #f3f4f6;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn-ghost {
  background: #1e2130;
  border: 1px solid #2e3350;
  color: #8b8aa8;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost:hover {
  background: #252840;
  color: #f3f4f6;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ── Toggle ── */
.tog-track {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #e8e9f2;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.tog-track.on {
  background: #5865f2;
}

.tog-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
}

.tog-track.on .tog-thumb {
  transform: translateX(18px);
}

/* ── Code ── */
pre {
  font-family: "Geist Mono", monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  max-width: 100%;
}

.code-block {
  background: #060810;
  border: 1px solid #1e2130;
  border-radius: 12px;
  padding: 1.25rem;
  overflow-x: auto;
  max-width: 100%;
}

.kw {
  color: #818cf8;
}

.fn {
  color: #a78bfa;
}

.str {
  color: #34d399;
}

.cmt {
  color: #4b5563;
  font-style: italic;
}

.num {
  color: #fb923c;
}

.key {
  color: #60a5fa;
}

/* ── Input ── */
.input-field {
  width: 100%;
  padding: 0.65rem 0.875rem;
  background: #0f1117;
  border: 1.5px solid #1e2130;
  border-radius: 12px;
  color: #f3f4f6;
  font-size: 0.875rem;
  font-family: "Geist", sans-serif;
  outline: none;
  transition: border-color 0.15s;
}

.input-field:focus {
  border-color: #5865f2;
}

.input-field::placeholder {
  color: #374151;
}

/* ── Sidebar links ── */
.sidebar-link {
  display: block;
  padding: 0.375rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  color: #6b7280;
  transition:
    background 0.12s,
    color 0.12s;
  cursor: pointer;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: #1e2130;
  color: #e5e7eb;
}

/* ── Toast ── */
#toast {
  transition:
    opacity 0.25s,
    transform 0.25s;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Spinner ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #1e2130;
  border-top-color: #5865f2;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ── Animations ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fu {
  animation: fadeUp 0.3s ease both;
}

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

/* ── Scroll fade-in animation ── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scroll-fade {
  opacity: 0;
  transform: translateY(30px);
}

.scroll-fade.visible {
  animation: fadeInUp 0.6s ease forwards;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 99px;
}

/* ── Light mode ── */
html.light body {
  background: #f4f5fa !important;
  color: #0f1117 !important;
}

html.light nav {
  background: rgba(244, 245, 250, 0.92) !important;
  border-color: #e2e4ef !important;
}

html.light .dark-surface {
  background: #fff !important;
  border-color: #e2e4ef !important;
}

html.light .dark-text {
  color: #0f1117 !important;
}

html.light .dark-text-2 {
  color: #4b5563 !important;
}

html.light .dark-text-3 {
  color: #6b7280 !important;
}

html.light .dark-border {
  border-color: #e2e4ef !important;
}

html.light .code-block {
  background: #ececec;
  border-color: #dbdbdb;
}

html.light .dark-code {
  background: #ececec;
  border-color: #dbdbdb;
}

html.light .input-field {
  background: #fff;
  border-color: #d1d5db;
  color: #111827;
}

html.light .modal {
  background: #fff;
  border-color: #e2e4ef;
}

html.light .modal h3 {
  color: #0f1117;
}

html.light .modal p {
  color: #54526e;
}

html.light .btn-ghost {
  background: #f4f5fa;
  border-color: #d1d5db;
  color: #54526e;
}

html.light .btn-ghost:hover {
  background: #e8e9f2;
  color: #0f1117;
}

html.light #loginOverlay {
  background: #f4f5fa;
}

html.light .sidebar-link:hover,
html.light .sidebar-link.active {
  background: #e2e4ef;
  color: #0f1117;
}

html.light footer {
  background: #f4f5fa !important;
  border-color: #e2e4ef !important;
}

html.light .lowerNav {
  background: rgba(244, 245, 250, 0.92) !important;
  border-color: #e2e4ef !important;
}

/* ══════════════════════════════════════════════════════════════════════════════
   DOCS-SPECIFIC LAYOUT STYLES
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Docs Layout Grid (2-column: sidebar + content) ── */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── Left Sidebar (Endpoint Navigation) ── */
.left-sidebar {
  position: sticky;
  top: 6rem;
  height: fit-content;
  align-self: start;
}

/* ── Section Fade Transition ── */
.endpoint-section {
  animation: fadeIn 0.3s ease-in-out;
}

.endpoint-section.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Mobile Hamburger Menu (in navbar) ── */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  margin-left: 0.5rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
}

.hamburger-btn span {
  width: 20px;
  height: 2px;
  background: #9ca3af;
  border-radius: 2px;
  transition: all 0.3s;
}

.hamburger-btn:hover span {
  background: #f3f4f6;
}

.hamburger-btn.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.open span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.open span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* ── Mobile Drawer ── */
.mobile-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 70;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.mobile-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-drawer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: #0f1117;
  border-right: 1px solid #1e2130;
  z-index: 80;
  padding: 2rem 1.5rem;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s ease-out;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #1e2130;
}

.mobile-drawer-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #f3f4f6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mobile-drawer-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.15s;
}

.mobile-drawer-close:hover {
  color: #f3f4f6;
}

/* ── Endpoint Section ── */
.endpoint-section {
  border: 1px solid #1e2130;
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: #0f1117;
}

/* ── Method Badge ── */
.method-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: "Geist Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.method-badge.get {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.method-badge.post {
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.method-badge.put {
  background: rgba(251, 146, 60, 0.1);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.2);
}

.method-badge.delete {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.method-badge.patch {
  background: rgba(168, 85, 247, 0.1);
  color: #a78bfa;
  border: 1px solid rgba(168, 85, 247, 0.2);
}

/* ── Status Badge ── */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: "Geist Mono", monospace;
}

.status-badge.success {
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-badge.error-client {
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.status-badge.error-server {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ── Parameter Table ── */
.param-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.param-table th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  border-bottom: 1px solid #1e2130;
}

.param-table td {
  padding: 0.75rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #1e2130;
  vertical-align: top;
}

.param-table td:first-child {
  font-family: "Geist Mono", monospace;
  color: #818cf8;
  font-weight: 500;
}

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

.param-table .param-type {
  font-family: "Geist Mono", monospace;
  font-size: 0.75rem;
  color: #a78bfa;
  background: rgba(168, 85, 247, 0.1);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  display: inline-block;
}

.param-table .param-required {
  font-size: 0.6875rem;
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  margin-left: 0.375rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* ── Response Block ── */
.response-block {
  margin-top: 1rem;
}

.response-block .status-badge {
  margin-bottom: 0.5rem;
}

/* ── Mobile Responsive ── */
@media (max-width: 1024px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .left-sidebar {
    display: none;
  }

  .hamburger-btn {
    display: flex;
  }

  .mobile-drawer-backdrop,
  .mobile-drawer {
    display: block;
  }
}

/* ── Mobile Horizontal Scroll Tabs ── */
@media (max-width: 768px) {
  .mobile-tabs {
    display: flex;
    overflow-x: auto;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #0f1117;
    border-bottom: 1px solid #1e2130;
    position: sticky;
    top: 3.5rem;
    z-index: 40;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .mobile-tabs::-webkit-scrollbar {
    display: none;
  }

  .mobile-tab {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
  }

  .mobile-tab.active {
    background: #1e2130;
    color: #e5e7eb;
    border-color: #2e3350;
  }
}

@media (min-width: 769px) {
  .mobile-tabs {
    display: none;
  }
}

/* ── Light Mode Overrides for Docs Styles ── */
html.light .endpoint-section {
  background: #fff;
  border-color: #e2e4ef;
}

html.light .param-table th {
  color: #4b5563;
}

html.light .param-table td {
  border-color: #e2e4ef;
}

html.light .mobile-tabs {
  background: #fff;
  border-color: #e2e4ef;
}

html.light .mobile-tab.active {
  background: #e2e4ef;
  color: #0f1117;
  border-color: #d1d5db;
}

html.light .mobile-drawer {
  background: #fff;
  border-color: #e2e4ef;
}

html.light .mobile-drawer-backdrop {
  background: rgba(0, 0, 0, 0.4);
}

html.light .mobile-drawer-header {
  border-color: #e2e4ef;
}

html.light .mobile-drawer-title {
  color: #0f1117;
}

html.light .hamburger-btn {
  background: #5865f2;
}

html.light .hamburger-btn:hover {
  background: #4752c4;
}
