/**
 * Copy Button Component
 * Reusable copy-to-clipboard button styling for various contexts
 */

/* Flex wrapper for copyable elements */
.copyable-wrapper {
    display: flex;
    align-items: stretch;
}

.copyable-wrapper > .copyable {
    flex: 1 1 auto;
    min-width: 0;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.copyable-wrapper > .copy-btn {
    flex: 0 0 auto;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-left: none;
}

/* Base button styling */
button.copy-btn {
    padding: 0.5rem;
    margin: 0;
    line-height: 1;
    font-size: 1rem;
    cursor: pointer;
    border: 1px solid rgba(255, 217, 61, 0.4);
    background: #FFF8E7;
    color: #333;
    border-radius: 6px;
    transition: all 0.2s ease;
}

button.copy-btn:hover {
    background: #FFF0D0;
}

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

/* Inline variant (for homepage code elements in flex containers) */
button.copy-btn--inline {
    flex: 0 0 auto;
    border-radius: 0 10px 10px 0;
    padding: 6px 8px;
    font-size: 120%;
    line-height: 0;
}

/* Settings panel variant (darker theme for overlay settings) */
.settings-panel button.copy-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    margin-top: 0.5rem;
}

.settings-panel button.copy-btn:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Dark mode for homepage/general context */
@media (prefers-color-scheme: dark) {
    button.copy-btn:not(.settings-panel button.copy-btn) {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
        color: #fff;
    }

    button.copy-btn:not(.settings-panel button.copy-btn):hover {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* Homepage is always dark, force dark button style */
.container button.copy-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.container button.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Focus state for accessibility */
button.copy-btn:focus-visible {
    outline: 2px solid var(--settings-accent);
    outline-offset: 2px;
}
