/**
 * Copy to Clipboard Widget Styles
 * Modern, responsive design with animations and customization support
 */

.copy-to-clipboard-widget {
    position: relative;
    display: block;
    font-family: inherit;
}

.copy-container {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.copy-to-clipboard-widget.layout-stacked .copy-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

/* Text Styles */
.copy-text {
    display: inline-block;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 14px;
    font-weight: 500;
    color: #333333;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 12px 16px;
    word-break: break-all;
    user-select: all;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 0;
}

.copy-text:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.copy-text:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Button Styles - Reduced specificity for Elementor controls */
.copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    min-height: 44px;
}

/* Fallback styles only when no Elementor styles are applied */
.copy-to-clipboard-widget:not([class*="elementor"]) .copy-button {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: #ffffff;
    border-radius: 4px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.copy-to-clipboard-widget:not([class*="elementor"]) .copy-button:hover {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3);
}

.copy-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.copy-button:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.copy-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Button States */
.copy-button.copied {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    animation: pulse 0.6s ease-in-out;
}

.copy-button.error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    animation: shake 0.6s ease-in-out;
}

/* Button Icon */
.copy-button .button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.copy-button .button-icon i,
.copy-button .button-icon svg {
    font-size: 16px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.copy-button .button-text {
    font-size: inherit;
    font-weight: inherit;
}

/* Icon Position Classes */
.copy-button.icon-before {
    flex-direction: row;
}

.copy-button.icon-after {
    flex-direction: row-reverse;
}

.copy-button.icon-only .button-text {
    display: none;
}

.copy-button.icon-only {
    min-width: 44px;
    padding: 12px;
}

/* Tooltip Styles */
.copy-tooltip {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #28a745;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.copy-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #28a745;
}

.copy-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

.copy-tooltip.error {
    background-color: #dc3545;
}

.copy-tooltip.error::after {
    border-top-color: #dc3545;
}

/* Layout Adjustments */
.copy-to-clipboard-widget.layout-stacked .copy-tooltip {
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
}

.copy-to-clipboard-widget.layout-inline .copy-tooltip {
    top: -45px;
    left: auto;
    right: 0;
    transform: translateX(0);
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(-4px);
    }
}

.copy-tooltip.show {
    animation: fadeInUp 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .copy-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .copy-text {
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .copy-button {
        font-size: 13px;
        padding: 10px 16px;
        min-height: 40px;
    }
    
    .copy-tooltip {
        font-size: 11px;
        padding: 6px 10px;
        top: -40px;
    }
}

@media (max-width: 480px) {
    .copy-text {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .copy-button {
        font-size: 12px;
        padding: 8px 14px;
        min-height: 36px;
    }
    
    .copy-button .button-icon i,
    .copy-button .button-icon svg {
        font-size: 14px;
        width: 14px;
        height: 14px;
    }
    
    .copy-button.icon-only {
        min-width: 36px;
        padding: 8px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .copy-text {
        color: #e9ecef;
        background-color: #343a40;
        border-color: #495057;
    }
    
    .copy-text:hover {
        background-color: #495057;
        border-color: #6c757d;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .copy-text {
        border-width: 2px;
    }
    
    .copy-button {
        border: 2px solid currentColor;
    }
    
    .copy-tooltip {
        border: 1px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .copy-button,
    .copy-text,
    .copy-tooltip {
        transition: none;
    }
    
    .copy-button:hover {
        transform: none;
    }
    
    .copy-tooltip.show {
        animation: none;
        transform: translateX(-50%);
    }
    
    @keyframes pulse {
        0%, 100% { transform: scale(1); }
    }
    
    @keyframes shake {
        0%, 100% { transform: translateX(0); }
    }
}

/* Focus Visible Support */
.copy-button:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.copy-text:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .copy-button {
        display: none;
    }
    
    .copy-tooltip {
        display: none;
    }
    
    .copy-text {
        background: transparent;
        border: 1px solid #000;
    }
}
