/* Highlight.js Theme (Atom One Dark) Override where needed */
/* Ensure pre has position: relative for the copy button */
pre.has-copy-button {
    position: relative;
    padding: 0;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow-x: auto;
    background: #282c34;
    /* Atom One Dark background */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Ensure code has padding */
pre code.hljs {
    display: block;
    overflow-x: auto;
    padding: 20px 20px 20px 30px;
    /* Add padding to make room for button if needed, otherwise normal */
    font-family: 'Fira Code', 'Consolas', 'Monaco', 'Andale Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    border-radius: 8px;
}

/* Copy Button Styling */
pre button.snippet-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    color: #eee;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    opacity: 0;
}

/* Show button on hover */
pre.has-copy-button:hover button.snippet-copy-btn,
pre button.snippet-copy-btn:focus {
    opacity: 0.8;
}

pre button.snippet-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    opacity: 1;
}

pre button.snippet-copy-btn.copied {
    background-color: #28a745;
    border-color: #28a745;
    color: #fff;
    opacity: 1 !important;
}

/**
 * Responsive adjustments
 */
@media (hover: none) {

    /* Always show button on touch devices where hover isn't available */
    pre button.snippet-copy-btn {
        opacity: 0.8;
    }
}