/* FinalShot Documentation - Dark Theme
   Colors derived from UITheme.cs Dark palette:
     Background:   rgb(16, 18, 22)    #101216
     CardBg:       rgb(22, 26, 34)    #161A22
     Border:       rgb(45, 48, 55)    #2D3037
     Divider:      rgb(35, 40, 50)    #232832
     TextPrimary:  rgb(220, 220, 220) #DCDCDC
     TextSecondary:rgb(140, 150, 165) #8C96A5
     AccentBlue:   rgb(0, 120, 212)   #0078D4
     AccentGreen:  rgb(0, 200, 100)   #00C864
     AccentAmber:  rgb(255, 160, 30)  #FFA01E
*/

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #101216;
    --bg-card: #161A22;
    --bg-input: #23262D;
    --border: #2D3037;
    --border-strong: #3C404A;
    --divider: #232832;
    --text-primary: #DCDCDC;
    --text-secondary: #8C96A5;
    --accent-blue: #0078D4;
    --accent-green: #00C864;
    --accent-amber: #FFA01E;
    --code-bg: #1A1E26;
    --code-border: #2D3037;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
}

/* Layout */
.layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 240px;
    min-width: 240px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--divider);
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.sidebar-brand {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 4px;
}

.sidebar-brand span {
    color: var(--accent-blue);
}

.sidebar-nav {
    padding: 12px 0;
}

.nav-link {
    display: block;
    padding: 8px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s, background-color 0.15s;
    border-left: 2px solid transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-input);
}

.nav-link.active {
    color: var(--text-primary);
    border-left-color: var(--accent-blue);
    background-color: rgba(0, 120, 212, 0.08);
}

/* Main Content */
.main {
    margin-left: 240px;
    flex: 1;
    min-width: 0;
}

.content {
    max-width: 860px;
    margin: 0 auto;
    padding: 40px 48px 80px;
}

/* Typography */
h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 40px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--divider);
}

h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 28px;
    margin-bottom: 8px;
}

h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 6px;
}

/* Anchor # symbol on hover for h2 and h3 */
h2[id],
h3[id] {
    position: relative;
    cursor: pointer;
}

h2[id] a.anchor-link,
h3[id] a.anchor-link {
    color: inherit;
    text-decoration: none;
}

h2[id] .anchor-hash,
h3[id] .anchor-hash {
    color: var(--accent-blue);
    font-size: 0.85em;
    margin-left: 8px;
    font-weight: 400;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

h2[id]:hover .anchor-hash,
h3[id]:hover .anchor-hash {
    opacity: 0.7;
}

/* Anchor highlight when URL hash matches */
.anchor-highlight {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

h2.anchor-highlight,
h3.anchor-highlight {
    background-color: rgba(0, 120, 212, 0.08);
    border-radius: 4px;
    padding-left: 8px;
    margin-left: -8px;
    padding-right: 8px;
}

.api-block.anchor-highlight {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* API block anchor # link */
.api-anchor {
    color: var(--accent-blue);
    font-size: 0.8rem;
    text-decoration: none;
    opacity: 0;
    margin-left: 2px;
    padding: 0 2px;
    transition: opacity 0.15s;
    font-weight: 400;
    vertical-align: baseline;
    position: relative;
    top: -1px;
}

.api-block-header:hover .api-anchor {
    opacity: 0.7;
}

.api-anchor:hover {
    opacity: 1;
    text-decoration: none;
}

p {
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 0.9rem;
}

p strong {
    color: var(--text-primary);
    font-weight: 600;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 32px;
}

/* Links */
a {
    color: var(--accent-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Lists */
ul, ol {
    margin-bottom: 12px;
    padding-left: 24px;
}

li {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 6px;
}

li strong {
    color: var(--text-primary);
}

/* Code */
code {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85em;
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 3px;
    padding: 1px 5px;
    color: var(--accent-blue);
}

pre {
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 4px;
    padding: 14px 16px;
    margin-bottom: 16px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-primary);
}

/* Copy button for code blocks */
.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-secondary);
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, border-color 0.15s;
    z-index: 2;
}

pre:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.copy-btn.copied {
    color: var(--accent-green);
    border-color: var(--accent-green);
}

/* API Block Component */
.api-block {
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 12px;
    overflow: hidden;
}

.api-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background-color: #0A2A4A;
    border-bottom: 1px solid var(--border);
    min-height: 36px;
}

.api-name {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.api-name-group {
    display: inline-flex;
    align-items: baseline;
    gap: 0;
}

.api-default {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-left: 12px;
}

.api-block-content {
    padding: 10px 14px;
    background-color: var(--bg-card);
}

.api-block-content p {
    margin-bottom: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.api-block-content p strong {
    color: var(--text-primary);
}

.api-type {
    display: inline-block;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.75rem;
    color: var(--accent-amber);
    background-color: rgba(255, 160, 30, 0.1);
    padding: 1px 6px;
    border-radius: 3px;
    margin-right: 6px;
}

/* Page anchor navigation */
.page-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 8px;
}

.page-nav a {
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 3px 0;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.page-nav a:hover {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
    text-decoration: none;
}

/* Section divider */
.section-divider {
    border: none;
    border-top: 1px solid var(--divider);
    margin: 32px 0;
}

/* Note / Info blocks */
.note {
    background-color: rgba(0, 120, 212, 0.08);
    border-left: 3px solid var(--accent-blue);
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 0 4px 4px 0;
}

.note p {
    margin-bottom: 0;
    font-size: 0.85rem;
}

.warning {
    background-color: rgba(255, 160, 30, 0.08);
    border-left: 3px solid var(--accent-amber);
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 0 4px 4px 0;
}

.warning p {
    margin-bottom: 0;
    font-size: 0.85rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 0.85rem;
}

th {
    text-align: left;
    padding: 8px 12px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-weight: 600;
}

td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

tr:nth-child(even) td {
    background-color: rgba(22, 26, 34, 0.5);
}

/* Feature cards */
.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.feature-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
}

.feature-card h4 {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 0.82rem;
    margin-bottom: 0;
}

.feature-card code {
    font-size: 0.8em;
}

/* Command list */
.command-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 16px;
}

.command-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--divider);
}

.command-list li:last-child {
    border-bottom: none;
}

/* Category header for API sections */
.category-header {
    margin-top: 36px;
    margin-bottom: 16px;
}

.category-header h3 {
    margin-top: 0;
    color: var(--accent-blue);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
        min-width: 200px;
    }

    .main {
        margin-left: 200px;
    }

    .content {
        padding: 24px 24px 60px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .sidebar {
        position: static;
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-nav {
        display: flex;
        padding: 0;
        overflow-x: auto;
    }

    .nav-link {
        white-space: nowrap;
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 10px 16px;
    }

    .nav-link.active {
        border-left-color: transparent;
        border-bottom-color: var(--accent-blue);
    }

    .main {
        margin-left: 0;
    }

    .content {
        padding: 20px 16px 60px;
    }

    .layout {
        flex-direction: column;
    }
}

/* ======================================== */
/* Search bar                               */
/* ======================================== */
.sidebar-search {
    padding: 12px 16px 8px;
}

.sidebar-search input {
    width: 100%;
    padding: 7px 10px;
    font-size: 0.8rem;
    font-family: 'Segoe UI', -apple-system, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
    transition: border-color 0.15s;
}

.sidebar-search input:focus {
    border-color: var(--accent-blue);
}

.sidebar-search input::placeholder {
    color: var(--text-secondary);
}

/* ======================================== */
/* Theme toggle                             */
/* ======================================== */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px 12px;
    border-top: 1px solid var(--divider);
}

.theme-toggle-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.theme-toggle-btn {
    position: relative;
    width: 36px;
    height: 20px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.theme-toggle-btn::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: transform 0.2s, background-color 0.2s;
}

.theme-toggle-btn.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.theme-toggle-btn.active::after {
    transform: translateX(16px);
    background-color: #fff;
}

/* Light theme overrides */
body.light {
    --bg: #F5F6F8;
    --bg-card: #FFFFFF;
    --bg-input: #ECEEF1;
    --border: #D4D6DA;
    --border-strong: #B8BABE;
    --divider: #E0E2E6;
    --text-primary: #1A1A1A;
    --text-secondary: #555555;
    --accent-blue: #0078D4;
    --accent-green: #00A050;
    --accent-amber: #CC7A00;
    --code-bg: #ECEEF1;
    --code-border: #D4D6DA;
}

body.light .api-block-header {
    background-color: #E0ECF5;
}

body.light .sidebar {
    background-color: #FFFFFF;
}

/* ======================================== */
/* Back to top button                       */
/* ======================================== */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 40px;
    height: 40px;
    background-color: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s, background-color 0.15s;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: #005fa3;
}

/* ======================================== */
/* Search highlight                         */
/* ======================================== */
.search-hidden {
    display: none !important;
}

.search-highlight {
    background-color: rgba(255, 160, 30, 0.35);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

body.light .search-highlight {
    background-color: rgba(255, 160, 30, 0.45);
}
