/* Enhanced Code Block Styles */

/* Code block container */
.highlight {
    position: relative;
    margin: 1.5rem 0;
    border-radius: 6px;
    border: 2px solid var(--border-primary);
    background: var(--bg-code);
    overflow: hidden;
}

/* Code block toolbar */
.code-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    font-family: 'Lexend Deca', sans-serif;
    font-size: 0.85rem;
}

.code-language {
    color: var(--text-heading-secondary);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-actions {
    display: flex;
    gap: 0.5rem;
}

/* Copy button */
.copy-button {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Lexend Deca', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-button:hover {
    background: var(--hover-bg);
    border-color: var(--text-link);
}

.copy-button:active {
    transform: scale(0.95);
}

.copy-button.copied {
    background: var(--text-code);
    color: var(--bg-primary);
    border-color: var(--text-code);
}

/* Code content area */
.highlight > div {
    overflow-x: auto;
}

.highlight pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
}

/* Line numbers table layout */
.highlight .lntable {
    width: 100%;
    border-spacing: 0;
    border: none;
    overflow: auto;
    display: block;
}

.highlight .lntd {
    padding: 0;
    vertical-align: top;
}

/* Line numbers column */
.highlight .lnt,
.highlight .ln {
    padding: 0 0.75rem;
    color: var(--text-primary);
    opacity: 0.5;
    user-select: none;
    text-align: right;
}

/* Code column */
.highlight .lntd:last-child {
    width: 100%;
}

.highlight .lntd:last-child pre {
    padding-left: 1rem;
}

/* Highlighted lines */
.highlight .hl {
    display: block;
    background-color: rgba(255, 255, 0, 0.15);
    margin: 0 -1rem;
    padding: 0 1rem;
}

[data-theme="dark"] .highlight .hl {
    background-color: rgba(255, 255, 0, 0.1);
}

/* Code content */
.highlight code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .highlight {
        margin: 1rem -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .code-toolbar {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    .copy-button {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .highlight pre {
        padding: 0.75rem;
    }

    .highlight .lnt,
    .highlight .ln {
        padding: 0 0.5rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .copy-button {
        transition: none;
    }
}

/* Print styles */
@media print {
    .code-toolbar {
        display: none;
    }

    .highlight {
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}
