/* ==========================================
   CYGNUS PAY — API DOCS
   White Glass Theme
   ========================================== */

:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    --glass-blur: 18px;
    --text-primary: #111111;
    --text-secondary: #555555;
    --text-muted: #999999;
    --border: #e0e0e0;
    --border-subtle: #ebebeb;
    --accent: #111111;
    --accent-soft: rgba(17, 17, 17, 0.06);
    --code-bg: #f8f9fb;
    --code-border: #e2e4e8;
    --topbar-h: 60px;
    --sidebar-w: 260px;
    --radius: 14px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ── Topbar ── */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--topbar-h);
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    transition: box-shadow var(--transition);
}

.topbar.scrolled {
    box-shadow: 0 1px 12px rgba(0, 0, 0, 0.2);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 480px;
    margin: 0 auto;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform var(--transition);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
}

.brand-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.brand-name {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.brand-tag {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

.version-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    padding: 3px 10px;
    border-radius: 20px;
}

.topbar-link {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all var(--transition);
}

.topbar-link:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
}

/* ── Search ── */
.search-container {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    height: 40px;
    padding: 0 40px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    font-family: inherit;
    font-size: 0.88rem;
    color: #ffffff;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.search-shortcut {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.68rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 2px 8px;
    border-radius: 4px;
    pointer-events: none;
}

.search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 320px;
    overflow-y: auto;
    z-index: 200;
    box-shadow: var(--glass-shadow);
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--accent-soft);
}

.search-result-item .sr-title {
    font-weight: 600;
    font-size: 0.88rem;
}

.search-result-item .sr-section {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.search-no-results {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    padding: 24px 16px;
    overflow-y: auto;
    z-index: 100;
    background: var(--surface);
    border-right: 1px solid var(--border-subtle);
    transition: transform var(--transition);
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-heading {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 12px 6px;
    margin-bottom: 4px;
}

.sidebar-link {
    display: block;
    padding: 7px 12px;
    margin-bottom: 2px;
    font-size: 0.86rem;
    font-weight: 450;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: var(--accent-soft);
}

.sidebar-link.active {
    color: var(--text-primary);
    background: var(--accent-soft);
    font-weight: 600;
    border-left-color: var(--accent);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
    backdrop-filter: blur(4px);
}

/* ── Main Content ── */
.content {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    min-height: calc(100vh - var(--topbar-h));
}

/* ── Hero ── */
.hero {
    padding: 64px 48px 48px;
    background: linear-gradient(135deg, #ffffff 0%, #f0f1f3 100%);
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.03) 0%, transparent 70%);
}

.hero-inner {
    max-width: 720px;
    position: relative;
    z-index: 1;
}

.hero-eyebrow {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 10px;
    animation: fadeInUp 0.6s ease both;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 16px;
    animation: fadeInUp 0.6s ease 0.1s both;
}

.hero-description {
    font-size: 1.12rem;
    color: var(--text-secondary);
    max-width: 560px;
    line-height: 1.7;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.hero-meta {
    display: flex;
    gap: 32px;
    margin-top: 32px;
    flex-wrap: wrap;
    animation: fadeInUp 0.6s ease 0.3s both;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.meta-value {
    font-size: 0.88rem;
    font-weight: 500;
}

/* ── Sections ── */
.doc-section {
    padding: 56px 48px;
    border-bottom: 1px solid var(--border-subtle);
}

.section-inner {
    max-width: 820px;
}

.section-title {
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.section-lead {
    font-size: 1.02rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

.subsection-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 32px 0 12px;
}

/* ── Flow Grid ── */
.flow-grid {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.flow-card {
    flex: 1;
    min-width: 160px;
    padding: 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    text-align: center;
    transition: transform var(--transition), box-shadow var(--transition);
}

.flow-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.flow-step {
    width: 36px;
    height: 36px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    border-radius: 50%;
    font-size: 0.88rem;
}

.flow-card h3 {
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.flow-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.flow-arrow {
    display: flex;
    align-items: center;
    padding: 0 8px;
}

.flow-arrow svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

/* ── Endpoint Cards ── */
.endpoint-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    margin-bottom: 24px;
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.endpoint-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.endpoint-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-subtle);
}

.endpoint-url {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    font-weight: 500;
}

.endpoint-body {
    padding: 24px;
}

.endpoint-body h4 {
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 12px;
    margin-top: 24px;
}

.endpoint-body h4:first-child {
    margin-top: 0;
}

.body-hint {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
}

/* ── Method Badges ── */
.method {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.method.post {
    background: #111;
    color: #fff;
}

.method.get {
    background: #e8e8e8;
    color: #333;
}

.method.put {
    background: #555;
    color: #fff;
}

.method.delete {
    background: #333;
    color: #fff;
}

.method-sm {
    font-size: 0.68rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
    display: inline-block;
}

.method-sm.post {
    background: #111;
    color: #fff;
}

.method-sm.get {
    background: #e8e8e8;
    color: #333;
}

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge.required {
    background: #111;
    color: #fff;
}

.badge.optional {
    background: var(--accent-soft);
    color: var(--text-secondary);
}

.badge.conditional {
    background: #e8e8e8;
    color: #555;
}

.badge.auth-badge {
    background: var(--accent-soft);
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.badge.public-badge {
    background: #f0f0f0;
    color: #777;
    font-size: 0.72rem;
}

/* ── Tables ── */
.table-wrap {
    overflow-x: auto;
    margin-bottom: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

thead th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}

.ref-table tbody td {
    font-size: 0.84rem;
}

/* ── Code Blocks ── */
.code-block {
    position: relative;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    overflow: hidden;
}

.code-block pre {
    padding: 16px 20px;
    overflow-x: auto;
    margin: 0;
}

.code-block code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0;
    transition: all var(--transition);
}

.code-block:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.copy-btn.copied {
    background: #333;
    color: #fff;
    border-color: #333;
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.84em;
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--code-border);
}

.code-block code,
.endpoint-url {
    background: none;
    border: none;
    padding: 0;
}

/* ── Tabs ── */
.code-tabs {
    margin-bottom: 16px;
}

.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.tab {
    padding: 8px 18px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ── Callouts ── */
.callout {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    border-left: 3px solid;
    margin: 16px 0;
    font-size: 0.88rem;
    line-height: 1.6;
}

.callout strong {
    display: inline;
}

.callout.info {
    background: rgba(0, 0, 0, 0.02);
    border-left-color: #bbb;
    color: var(--text-secondary);
}

.callout.warning {
    background: rgba(0, 0, 0, 0.03);
    border-left-color: #666;
    color: var(--text-secondary);
}

.callout.tip {
    background: rgba(0, 0, 0, 0.02);
    border-left-color: #999;
    color: var(--text-secondary);
}

/* ── Assets Grid ── */
.assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.asset-card {
    padding: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    text-align: center;
    transition: transform var(--transition), box-shadow var(--transition);
}

.asset-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.asset-symbol {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.asset-name {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 4px 0;
}

.asset-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── Steps ── */
.steps-list {
    margin-bottom: 32px;
}

.step-item {
    display: flex;
    gap: 20px;
    margin-bottom: 28px;
}

.step-number {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    border-radius: 50%;
    font-size: 1rem;
}

.step-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.step-content p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

/* ── Footer ── */
.site-footer {
    padding: 40px 48px;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
}

.footer-inner p {
    font-size: 0.84rem;
    color: var(--text-muted);
}

/* ── Animations ── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.doc-section {
    animation: fadeInSection 0.5s ease both;
}

@keyframes fadeInSection {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ── Scroll Reveal (JS adds .visible) ── */
.endpoint-card,
.flow-card,
.asset-card,
.step-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.endpoint-card.visible,
.flow-card.visible,
.asset-card.visible,
.step-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 200;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .sidebar-toggle {
        display: flex;
    }

    .content {
        margin-left: 0;
    }

    .hero {
        padding: 48px 24px 36px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .doc-section {
        padding: 40px 24px;
    }

    .hero-meta {
        gap: 20px;
    }

    .topbar-center {
        max-width: 260px;
    }

    .search-shortcut {
        display: none;
    }

    .flow-arrow {
        display: none;
    }

    .flow-grid {
        flex-direction: column;
        gap: 12px;
    }

    .flow-card {
        min-width: unset;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 0 12px;
    }

    .brand-name {
        display: none;
    }

    .topbar-link {
        display: none;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.4rem;
    }

    .endpoint-header {
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .endpoint-body {
        padding: 16px;
    }

    .assets-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}