:root {
    --primary: #363062;
    --primary-dark: #2a2550;
    --primary-light: #d8d5e8;
    --primary-bg: #f4f3f9;
    --secondary: #f99417;
    --secondary-dark: #d97a0a;
    --secondary-light: #fff4e0;
    --dark: #1a1730;
    --body: #1e1e2e;
    --muted: #6b6781;
    --muted-light: #9b97ad;
    --border: #e5e3ed;
    --bg-light: #f8f8fb;
    --code-bg: #f3f2f7;
    --code-dark-bg: #1a1730;
    --code-dark-text: #e5e3ed;
    --warn: #d97a0a;
    --warn-bg: #fff4e0;
    --warn-text: #8a4a00;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--body);
    font-size: 16px;
    line-height: 1.65;
    background: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


.cover-logo {
    display: block;
    width: clamp(220px, 38vw, 380px);
    height: auto;
    margin: 0 0 28px 0;
}

.footer-logo {
    width: 140px;
    height: auto;
    opacity: 0.75;
    margin-bottom: 12px;
}

/* ============ COVER ============ */
.cover {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1730 0%, #363062 55%, #4a3f7a 100%);
    color: #fff;
    padding: 96px 24px;
    min-height: 70vh;
    display: flex;
    align-items: center;
}

.cover::before {
    content: "";
    position: absolute;
    top: -120px;
    right: -120px;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(249, 148, 23, 0.30) 0%, rgba(249, 148, 23, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.cover::after {
    content: "";
    position: absolute;
    bottom: -150px;
    left: -100px;
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(249, 148, 23, 0.18) 0%, rgba(249, 148, 23, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.cover-inner {
    position: relative;
    z-index: 1;
    max-width: 880px;
    margin: 0 auto;
    width: 100%;
}

.cover-tag {
    display: inline-block;
    font-size: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #f99417;
    border: 1px solid rgba(249, 148, 23, 0.5);
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 28px;
}

.cover-title {
    font-size: clamp(56px, 11vw, 96px);
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
    margin: 0 0 18px 0;
    background: linear-gradient(90deg, #ffffff 0%, #f99417 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cover-subtitle {
    font-size: clamp(18px, 2.4vw, 22px);
    font-weight: 300;
    color: #d8d5e8;
    margin: 0 0 14px 0;
}

.cover-desc {
    font-size: 16px;
    color: #9b97ad;
    max-width: 560px;
    line-height: 1.65;
    margin: 0 0 40px 0;
}

.cover-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 22px;
}

.cover-meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #9b97ad;
    margin-bottom: 4px;
}

.cover-meta-value {
    font-size: 15px;
    color: #f5f4fa;
    font-weight: 500;
}

/* ============ LAYOUT ============ */
.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 64px 24px 96px;
}

.section {
    padding-top: 56px;
    padding-bottom: 8px;
}

.section:first-of-type {
    padding-top: 0;
}

/* ============ TYPOGRAPHY ============ */
h1,
h2,
h3,
h4 {
    color: var(--dark);
    font-weight: 700;
    margin: 0;
}

h1 {
    font-size: 36px;
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
    line-height: 1.15;
}

.h1-num {
    color: var(--primary);
    font-weight: 800;
    margin-right: 14px;
}

h1+.lead {
    color: var(--muted);
    font-size: 18px;
    margin: 0 0 32px 0;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    font-weight: 400;
}

h2 {
    font-size: 22px;
    margin: 36px 0 12px 0;
}

h3 {
    font-size: 17px;
    margin: 24px 0 10px 0;
    color: #44406a;
}

p {
    margin: 0 0 14px 0;
}

ul,
ol {
    margin: 0 0 14px 0;
    padding-left: 24px;
}

li {
    margin-bottom: 6px;
}

strong {
    color: var(--dark);
    font-weight: 600;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============ TOC ============ */
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid var(--border);
}

.toc-list li {
    border-bottom: 1px solid var(--border);
}

.toc-list a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 14px 6px;
    color: var(--body);
    font-size: 16px;
    transition: background 0.15s, color 0.15s;
    border-radius: 4px;
}

.toc-list a:hover {
    background: var(--primary-bg);
    color: var(--primary-dark);
    text-decoration: none;
}

.toc-num {
    color: var(--primary);
    font-weight: 700;
    width: 36px;
    flex-shrink: 0;
}

.toc-title {
    flex: 1;
}

.toc-page {
    color: var(--muted-light);
    font-weight: 500;
    font-size: 14px;
}

/* ============ CALLOUTS ============ */
.callout,
.note {
    padding: 16px 20px;
    margin: 18px 0;
    border-radius: 0 8px 8px 0;
    font-size: 15px;
}

.callout {
    background: var(--primary-bg);
    border-left: 3px solid var(--primary);
}

.callout strong {
    color: #1e40af;
}

.note {
    background: var(--warn-bg);
    border-left: 3px solid var(--warn);
}

.note strong {
    color: var(--warn-text);
}

/* ============ TABLES ============ */
.table-wrap {
    overflow-x: auto;
    margin: 16px 0 24px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

th {
    background: #f1f5f9;
    color: var(--dark);
    text-align: left;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #cbd5e1;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

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

td code {
    background: transparent;
    padding: 0;
    color: var(--primary);
    font-weight: 500;
}

/* ============ CODE ============ */
code {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    background: var(--code-bg);
    color: var(--dark);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 13.5px;
}

pre {
    background: var(--code-dark-bg);
    color: var(--code-dark-text);
    padding: 18px 20px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13.5px;
    line-height: 1.6;
    margin: 16px 0;
    overflow-x: auto;
    white-space: pre;
}

pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

pre .com {
    color: #64748b;
}

pre .key {
    color: #b8b3d9;
}

pre .str {
    color: #f99417;
}

pre .tag {
    color: #f9a8d4;
}

/* ============ FEATURE GRID ============ */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin: 22px 0;
}

.feature-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    background: #fff;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.feature-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
}

.feature-card .icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--secondary);
    border-radius: 50%;
    margin-bottom: 10px;
    box-shadow: 0 0 0 5px var(--secondary-light);
}

.feature-card h4 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: var(--dark);
}

.feature-card p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.55;
}

/* ============ PAGE LIST ============ */
.page-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.page-list-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.15s;
}

.page-list-item:hover {
    border-color: var(--primary);
}

.page-list-item strong {
    display: block;
    color: var(--dark);
    font-size: 15px;
    margin-bottom: 2px;
}

.page-list-item code {
    font-size: 12.5px;
    background: transparent;
    color: var(--primary);
    padding: 0;
}

/* ============ KEY VALUE LIST ============ */
.kv-list {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin: 18px 0;
}

.kv-row {
    display: flex;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
}

.kv-row:last-child {
    border-bottom: none;
}

.kv-key {
    width: 40%;
    padding: 12px 16px;
    background: var(--bg-light);
    font-weight: 600;
    color: #44406a;
}

.kv-val {
    flex: 1;
    padding: 12px 16px;
}

/* ============ CLOSING ============ */
.closing {
    text-align: center;
    padding: 56px 32px;
    border: 2px solid var(--border);
    border-radius: 16px;
    margin: 48px 0 0 0;
    background: linear-gradient(180deg, var(--bg-light) 0%, #fff 100%);
}

.closing h2 {
    border: none;
    color: var(--primary-dark);
    margin: 0 0 4px 0;
    font-size: 18px;
}

.closing p {
    color: #475569;
    margin: 8px 0;
}

.thank-you {
    font-size: 56px;
    font-weight: 800;
    background: #f99417;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 16px 0 14px 0;
    letter-spacing: -1.5px;
    line-height: 1;
}

/* ============ FOOTER ============ */
.doc-footer {
    border-top: 1px solid var(--border);
    margin-top: 64px;
    padding: 32px 24px;
    text-align: center;
    color: var(--muted-light);
    font-size: 14px;
}

/* ============ MOBILE ============ */
@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    .container {
        padding: 40px 18px 64px;
    }

    .cover {
        padding: 64px 20px;
        min-height: 60vh;
    }

    h1 {
        font-size: 28px;
    }

    h2 {
        font-size: 19px;
    }

    h3 {
        font-size: 16px;
    }

    .kv-row {
        flex-direction: column;
    }

    .kv-key {
        width: 100%;
        padding: 10px 14px 4px;
    }

    .kv-val {
        padding: 4px 14px 10px;
    }

    pre {
        font-size: 12.5px;
        padding: 14px 16px;
    }
}

/* ============ PRINT ============ */
@media print {
    body {
        font-size: 10.5pt;
    }

    @page {
        size: A4;
        margin: 22mm 18mm 22mm 18mm;

        @bottom-center {
            content: "Trendexa Documentation  •  Page " counter(page) " of " counter(pages);
            font-family: 'Inter', sans-serif;
            font-size: 9pt;
            color: #9b97ad;
        }
    }

    @page :first {
        margin: 0;

        @bottom-center {
            content: "";
        }
    }

    .cover {
        page-break-after: always;
        min-height: auto;
        height: 297mm;
        width: 210mm;
        padding: 60mm 22mm 25mm 22mm;
        align-items: flex-start;
    }

    .cover-inner {
        max-width: 100%;
    }

    .cover-title {
        font-size: 64pt;
    }

    .cover-subtitle {
        font-size: 16pt;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .section {
        page-break-after: always;
        padding-top: 0;
    }

    .section:last-of-type {
        page-break-after: auto;
    }

    .feature-card:hover,
    .page-list-item:hover {
        transform: none;
        box-shadow: none;
        border-color: var(--border);
    }

    a {
        color: inherit;
        text-decoration: none;
    }

    .doc-footer {
        display: none;
    }
}