/* Code block styling for editors */
.qm-code-block {
    margin: 0.75rem 0;
    background: #0b1220;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
    color-scheme: dark;
}

.qm-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #0f172a;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.qm-code-lang {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.18);
    border: 1px solid rgba(59, 130, 246, 0.35);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
}

.qm-code-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.qm-code-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    font-size: 0.75rem;
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 0.45rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qm-code-action:hover {
    background: rgba(148, 163, 184, 0.22);
    color: #fff;
}

.qm-code-action i {
    font-size: 0.75rem;
}

.qm-code-content pre {
    margin: 0;
    max-height: min(420px, 62vh);
    padding: 0.95rem 1rem 0.95rem 3.7rem;
    background: transparent;
    border-radius: 0 0 0.75rem 0.75rem;
    overflow-x: auto;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.42) rgba(15, 23, 42, 0.85);
}

.qm-code-content code {
    font-family: "JetBrains Mono", "Fira Code", Consolas, Menlo, Monaco, "Liberation Mono", monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

.qm-code-content pre::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.qm-code-content pre::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.9);
}

.qm-code-content pre::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.34);
    border: 2px solid rgba(15, 23, 42, 0.92);
    border-radius: 999px;
}

.qm-code-content pre::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

.line-numbers .line-numbers-rows {
    border-right: 1px solid rgba(148, 163, 184, 0.2);
}

.line-numbers-rows > span:before {
    color: rgba(148, 163, 184, 0.65);
}

/* Legacy editable block fallback */
.qm-code-editable {
    display: flex;
    gap: 0;
    background: #0b1220;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 0.75rem;
    overflow: hidden;
}

.qm-code-editable .qm-code-lines {
    padding: 1rem 0.6rem;
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid rgba(148, 163, 184, 0.2);
    color: rgba(148, 163, 184, 0.75);
    font-size: 0.8rem;
    line-height: 1.6;
    text-align: right;
    user-select: none;
}

.qm-code-editable pre {
    flex: 1;
    margin: 0;
    padding: 1rem;
    color: #e2e8f0;
    font-family: "JetBrains Mono", "Fira Code", Consolas, Menlo, Monaco, "Liberation Mono", monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre;
    overflow: auto;
    outline: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.42) rgba(15, 23, 42, 0.85);
}

.dark .qm-code-block {
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: 0 10px 26px rgba(2, 6, 23, 0.35);
}

.dark .qm-code-action {
    background: rgba(148, 163, 184, 0.18);
    border-color: rgba(148, 163, 184, 0.35);
}

.dark .line-numbers-rows > span:before {
    color: rgba(226, 232, 240, 0.55);
}

.dark .qm-code-content pre {
    scrollbar-color: rgba(148, 163, 184, 0.46) rgba(15, 23, 42, 0.92);
}

.dark .qm-code-content pre::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.96);
}

.dark .qm-code-content pre::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.42);
    border-color: rgba(15, 23, 42, 0.96);
}

/* Block editor baseline */
.editor-styles-wrapper pre[class*="language-"],
.block-editor-writing-flow pre[class*="language-"] {
    border-radius: 0.75rem;
    background: #0b1220;
}
