/* Burak Code Blocks — GitHub benzeri güvenli kod gösterimi */

:root {
    --bcb-bg: #f6f8fa;
    --bcb-bg-toolbar: #f6f8fa;
    --bcb-border: #d0d7de;
    --bcb-text: #24292f;
    --bcb-muted: #57606a;
    --bcb-gutter-bg: #f6f8fa;
    --bcb-gutter-text: #8c959f;
    --bcb-gutter-border: #d0d7de;
    --bcb-btn-bg: #ffffff;
    --bcb-btn-border: #d0d7de;
    --bcb-btn-hover: #f3f4f6;
    --bcb-accent: #0969da;
    --bcb-shadow: 0 1px 3px rgba(27, 31, 36, 0.08);
    --bcb-radius: 8px;
    --bcb-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-code-theme="light"]) {
        --bcb-bg: #0d1117;
        --bcb-bg-toolbar: #161b22;
        --bcb-border: #30363d;
        --bcb-text: #e6edf3;
        --bcb-muted: #8b949e;
        --bcb-gutter-bg: #161b22;
        --bcb-gutter-text: #6e7681;
        --bcb-gutter-border: #30363d;
        --bcb-btn-bg: #21262d;
        --bcb-btn-border: #30363d;
        --bcb-btn-hover: #30363d;
        --bcb-accent: #58a6ff;
        --bcb-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    }
}

:root[data-code-theme="dark"] {
    --bcb-bg: #0d1117;
    --bcb-bg-toolbar: #161b22;
    --bcb-border: #30363d;
    --bcb-text: #e6edf3;
    --bcb-muted: #8b949e;
    --bcb-gutter-bg: #161b22;
    --bcb-gutter-text: #6e7681;
    --bcb-gutter-border: #30363d;
    --bcb-btn-bg: #21262d;
    --bcb-btn-border: #30363d;
    --bcb-btn-hover: #30363d;
    --bcb-accent: #58a6ff;
    --bcb-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

:root[data-code-theme="light"] {
    --bcb-bg: #f6f8fa;
    --bcb-bg-toolbar: #f6f8fa;
    --bcb-border: #d0d7de;
    --bcb-text: #24292f;
    --bcb-muted: #57606a;
    --bcb-gutter-bg: #f6f8fa;
    --bcb-gutter-text: #8c959f;
    --bcb-gutter-border: #d0d7de;
    --bcb-btn-bg: #ffffff;
    --bcb-btn-border: #d0d7de;
    --bcb-btn-hover: #f3f4f6;
    --bcb-accent: #0969da;
    --bcb-shadow: 0 1px 3px rgba(27, 31, 36, 0.08);
}

/* Ana blok */
.burak-single-content .burak-code-block,
.burak-code-block,
.burak-single-content .burak-code-block,
.burak-single-content .code-snippet.burak-code-block {
    margin: 1.25rem 0;
    border: 1px solid var(--bcb-border);
    border-radius: var(--bcb-radius);
    background: var(--bcb-bg);
    box-shadow: var(--bcb-shadow);
    overflow: hidden;
    max-width: 100%;
    color: var(--bcb-text);
}

/* Toolbar */
.burak-code-block__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    background: var(--bcb-bg-toolbar);
    border-bottom: 1px solid var(--bcb-border);
}

.burak-code-block__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
    min-width: 0;
}

.burak-code-block__lang {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--bcb-accent);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.burak-code-block__title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--bcb-text);
}

.burak-code-block__filename,
.burak-code-block__hint {
    font-family: var(--bcb-font);
    font-size: 0.76rem;
    color: var(--bcb-muted);
    padding: 0.12rem 0.45rem;
    border: 1px solid var(--bcb-border);
    border-radius: 5px;
    background: var(--bcb-btn-bg);
}

.burak-code-block__actions {
    flex-shrink: 0;
}

.burak-code-block__copy,
.burak-code-block .code-snippet-copy {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 30px;
    padding: 0 0.65rem;
    border: 1px solid var(--bcb-btn-border);
    border-radius: 6px;
    background: var(--bcb-btn-bg);
    color: var(--bcb-text);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.burak-code-block__copy:hover,
.burak-code-block .code-snippet-copy:hover {
    background: var(--bcb-btn-hover);
    border-color: var(--bcb-muted);
}

.burak-code-block__copy.is-copied,
.burak-code-block .code-snippet-copy.is-copied {
    color: #1a7f37;
    border-color: #1a7f37;
}

/* Viewport — yatay scroll */
.burak-code-block__viewport {
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--bcb-muted) transparent;
}

.burak-code-block__viewport::-webkit-scrollbar {
    height: 8px;
}

.burak-code-block__viewport::-webkit-scrollbar-thumb {
    background: var(--bcb-muted);
    border-radius: 999px;
}

/* Satır numaraları */
.burak-code-block__gutter {
    flex: 0 0 auto;
    padding: 0.85rem 0.55rem 0.85rem 0.75rem;
    background: var(--bcb-gutter-bg);
    border-right: 1px solid var(--bcb-gutter-border);
    text-align: right;
    user-select: none;
    font-family: var(--bcb-font);
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--bcb-gutter-text);
}

.burak-code-block__line {
    display: block;
    min-width: 1.6rem;
}

/* Kod alanı — satırlar bozulmasın */
.burak-code-block__pre,
.burak-code-block .code-snippet-pre {
    margin: 0;
    padding: 0.85rem 1rem;
    background: transparent;
    overflow: visible;
    flex: 1 1 auto;
    min-width: 0;
}

.burak-code-block__pre code,
.burak-code-block .code-snippet-pre code {
    display: block;
    font-family: var(--bcb-font);
    font-size: 0.84rem;
    line-height: 1.55;
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
    color: var(--bcb-text);
    tab-size: 4;
}

/* Prism override — tema uyumu */
.burak-code-block pre[class*="language-"],
.burak-code-block code[class*="language-"] {
    background: transparent;
    text-shadow: none;
}

/* Markup kart varyantları — ORJİNAL HALİ / DÜZENLENMİŞ HALİ */
.burak-code-block--markup-original,
.burak-code-block--markup-edited {
    --bcb-markup-header-bg: #fff5f5;
    --bcb-markup-divider: #f0b4b8;
    --bcb-markup-hint-bg: #fff0f1;
    --bcb-markup-hint-text: #cf222e;
    --bcb-markup-hint-border: #f5c2c7;
    --bcb-markup-code-bg: #ffffff;
    --bcb-markup-gutter-bg: #f6f8fa;
    border-color: #e1e4e8;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    background: var(--bcb-markup-code-bg);
}

.burak-code-block--markup-edited {
    --bcb-markup-header-bg: #f0fff4;
    --bcb-markup-divider: #8fd9ab;
    --bcb-markup-hint-bg: #f0fff4;
    --bcb-markup-hint-text: #116329;
    --bcb-markup-hint-border: #8fd9ab;
}

.burak-code-block--markup-original .burak-code-block__toolbar,
.burak-code-block--markup-edited .burak-code-block__toolbar {
    padding: 0.7rem 1rem;
    background: var(--bcb-markup-header-bg);
    border-bottom: 1px solid var(--bcb-markup-divider);
}

.burak-code-block--markup-original .burak-code-block__lang,
.burak-code-block--markup-edited .burak-code-block__lang {
    padding: 0.22rem 0.62rem;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: #0969da;
    color: #fff;
    box-shadow: none;
}

.burak-code-block--markup-original .burak-code-block__title,
.burak-code-block--markup-edited .burak-code-block__title {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #24292f;
}

.burak-code-block--markup-original .burak-code-block__hint,
.burak-code-block--markup-edited .burak-code-block__hint {
    font-family: var(--bcb-font);
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--bcb-markup-hint-text);
    background: var(--bcb-markup-hint-bg);
    border: 1px solid var(--bcb-markup-hint-border);
    border-radius: 6px;
    padding: 0.18rem 0.5rem;
}

.burak-code-block--markup-original .burak-code-block__copy,
.burak-code-block--markup-edited .burak-code-block__copy {
    height: 32px;
    padding: 0 0.75rem;
    border-radius: 8px;
    background: #fff;
    border-color: #d0d7de;
    font-size: 0.78rem;
    font-weight: 600;
    color: #24292f;
}

.burak-code-block--markup-original .burak-code-block__viewport,
.burak-code-block--markup-edited .burak-code-block__viewport {
    background: var(--bcb-markup-code-bg);
    overflow-x: hidden;
}

.burak-code-block--markup-original .burak-code-block__gutter,
.burak-code-block--markup-edited .burak-code-block__gutter {
    background: var(--bcb-markup-gutter-bg);
    border-right-color: #e1e4e8;
    padding: 0.9rem 0.6rem 0.9rem 0.85rem;
    align-self: stretch;
}

.burak-code-block--markup-original .burak-code-block__pre,
.burak-code-block--markup-edited .burak-code-block__pre {
    padding: 0.9rem 1rem;
    background: var(--bcb-markup-code-bg);
    min-width: 0;
    max-width: 100%;
}

.burak-code-block--markup-original .burak-code-block__pre code,
.burak-code-block--markup-edited .burak-code-block__pre code {
    font-size: 0.82rem;
    color: #24292f;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-code-theme="light"]) .burak-code-block--markup-original,
    :root:not([data-code-theme="light"]) .burak-code-block--markup-edited {
        --bcb-markup-code-bg: #0d1117;
        --bcb-markup-gutter-bg: #161b22;
        border-color: #30363d;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    }

    :root:not([data-code-theme="light"]) .burak-code-block--markup-original {
        --bcb-markup-header-bg: #2d1f1f;
        --bcb-markup-divider: #6e3a3a;
        --bcb-markup-hint-bg: #3d2020;
        --bcb-markup-hint-text: #ff8a8a;
        --bcb-markup-hint-border: #6e3a3a;
    }

    :root:not([data-code-theme="light"]) .burak-code-block--markup-edited {
        --bcb-markup-header-bg: #1a2e22;
        --bcb-markup-divider: #2f6f4a;
        --bcb-markup-hint-bg: #1a2e22;
        --bcb-markup-hint-text: #7ee787;
        --bcb-markup-hint-border: #2f6f4a;
    }

    :root:not([data-code-theme="light"]) .burak-code-block--markup-original .burak-code-block__title,
    :root:not([data-code-theme="light"]) .burak-code-block--markup-edited .burak-code-block__title {
        color: #e6edf3;
    }

    :root:not([data-code-theme="light"]) .burak-code-block--markup-original .burak-code-block__copy,
    :root:not([data-code-theme="light"]) .burak-code-block--markup-edited .burak-code-block__copy {
        background: #21262d;
        border-color: #30363d;
        color: #e6edf3;
    }
}

:root[data-code-theme="dark"] .burak-code-block--markup-original,
:root[data-code-theme="dark"] .burak-code-block--markup-edited {
    --bcb-markup-code-bg: #0d1117;
    --bcb-markup-gutter-bg: #161b22;
    border-color: #30363d;
}

:root[data-code-theme="dark"] .burak-code-block--markup-original {
    --bcb-markup-header-bg: #2d1f1f;
    --bcb-markup-divider: #6e3a3a;
    --bcb-markup-hint-bg: #3d2020;
    --bcb-markup-hint-text: #ff8a8a;
    --bcb-markup-hint-border: #6e3a3a;
}

:root[data-code-theme="dark"] .burak-code-block--markup-edited {
    --bcb-markup-header-bg: #1a2e22;
    --bcb-markup-divider: #2f6f4a;
    --bcb-markup-hint-bg: #1a2e22;
    --bcb-markup-hint-text: #7ee787;
    --bcb-markup-hint-border: #2f6f4a;
}

/* Eski code-snippet yapısı ile uyumluluk (renderCode dışındaki bloklar) */
.burak-single-content .code-snippet:not(.burak-code-block) {
    margin: 1.25rem 0;
}

.burak-single-content .code-snippet:not(.burak-code-block) .code-snippet-wrap {
    position: relative;
    border: 1px solid var(--bcb-border, #d0d7de);
    border-radius: var(--bcb-radius, 8px);
    background: var(--bcb-bg, #f6f8fa);
    overflow: hidden;
    max-width: 100%;
}

.burak-single-content .code-snippet:not(.burak-code-block) .code-snippet-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
}

/* Responsive */
@media (max-width: 640px) {
    .burak-code-block__toolbar {
        flex-wrap: wrap;
    }

    .burak-code-block__copy-label {
        display: none;
    }

    .burak-code-block__copy,
    .burak-code-block .code-snippet-copy {
        width: 32px;
        padding: 0;
        justify-content: center;
    }

    .burak-code-block__pre code,
    .burak-code-block .code-snippet-pre code {
        font-size: 0.78rem;
    }
}

/* JS kapalı — kod yine okunabilir */
.noscript .burak-code-block__pre code {
    white-space: pre-wrap;
    word-break: break-word;
}
