/**
 * Copy Code Button Styles
 *
 * Styles for the copy button in Gutenberg Code and Preformatted blocks.
 * Position: absolute, right side, vertically centered.
 *
 * @package Assistouest
 * @version 1.0.0
 */

/* Target blocks need relative positioning for absolute button placement */
.wp-block-code,
.wp-block-preformatted {
    position: relative;
}

/* Copy button base styles */
.assistouest-copy-btn {
    position: absolute !important;
    right: 0 !important;
    top: 50% !important;
    transform: translateY(-50%);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    color: #4a5568;
    background-color: #f1f3f5;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

/* Hover state */
.assistouest-copy-btn:hover {
    background-color: #fff;
    border-color: #006ce1;
    color: #006ce1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Active/Click state */
.assistouest-copy-btn:active {
    transform: translateY(-50%) scale(0.96);
}

/* Success state - Copied! */
.assistouest-copy-btn.is-copied {
    background-color: #006ce1;
    border-color: #006ce1;
    color: #fff;
}

/* Error state */
.assistouest-copy-btn.is-error {
    background-color: #fc8181;
    border-color: #fc8181;
    color: #fff;
}

/* Focus state for accessibility */
.assistouest-copy-btn:focus {
    outline: 2px solid #4299e1;
    outline-offset: 2px;
}

/* Ensure code blocks have enough right padding for the button */
.wp-block-code code,
.wp-block-preformatted pre {
    padding-right: 70px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .assistouest-copy-btn {
        right: 0;
        padding: 5px 10px;
        font-size: 11px;
    }

    .wp-block-code code,
    .wp-block-preformatted pre {
        padding-right: 60px;
    }
}

/* Dark mode support (if parent theme supports it) */
@media (prefers-color-scheme: dark) {
    .assistouest-copy-btn {
        color: #a0aec0;
        background-color: rgba(45, 55, 72, 0.9);
        border-color: #4a5568;
    }

    .assistouest-copy-btn:hover {
        background-color: #2d3748;
        border-color: #718096;
        color: #e2e8f0;
    }
}
