/**
 * HRW Music Video Elementor Widget Styles
 */

/* Widget container */
.hrw-music-container {
    width: 100%;
    margin: 0 auto;
}

/* Video wrapper */
.hrw-music-video-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

/* Responsive iframe */
.hrw-music-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: inherit;
}

/* Hidden state (before button click) - only on frontend */
.hrw-music-container.video-hidden .hrw-music-video-wrapper {
    display: none;
}

/* Visible state (after button click) */
.hrw-music-container.video-visible .hrw-music-video-wrapper {
    display: block !important;
    animation: fadeInUp 0.5s ease;
}

/* Force show when triggered directly */
.hrw-music-container .hrw-music-video-wrapper.force-show {
    display: block !important;
    opacity: 1 !important;
}

/* Fade in animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state */
.hrw-music-video-wrapper.loading {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.hrw-music-video-wrapper.loading::before {
    content: "Loading video...";
    color: #666;
    font-style: italic;
}

/* Editor-only styles */
.hrw-music-editor-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.4;
}

.hrw-music-editor-info p {
    margin: 8px 0;
}

.hrw-music-editor-info p:first-child {
    margin-top: 0;
}

.hrw-music-editor-info p:last-child {
    margin-bottom: 0;
}

.hrw-music-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 12px;
    margin-top: 16px;
    color: #856404;
}

.hrw-music-warning p {
    margin: 0;
}

.hrw-music-placeholder,
.hrw-music-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 24px;
    text-align: center;
    color: #721c24;
    font-size: 14px;
}

.hrw-music-placeholder {
    background: #d1ecf1;
    border-color: #b8daff;
    color: #0c5460;
}

/* Button triggered state (optional styling for the trigger button) */
button.video-triggered,
.video-triggered {
    background-color: #28a745 !important;
    color: white !important;
    transform: scale(0.98);
    transition: all 0.3s ease;
}

/* Alignment */
.hrw-music-container[data-align="left"] {
    margin-left: 0;
    margin-right: auto;
}

.hrw-music-container[data-align="center"] {
    margin-left: auto;
    margin-right: auto;
}

.hrw-music-container[data-align="right"] {
    margin-left: auto;
    margin-right: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .hrw-music-video-wrapper {
        border-radius: 4px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .hrw-music-editor-info,
    .hrw-music-warning,
    .hrw-music-placeholder,
    .hrw-music-error {
        padding: 16px;
        font-size: 13px;
    }
}

/* Accessibility improvements */
.hrw-music-container:focus-within .hrw-music-video-wrapper {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hrw-music-video-wrapper {
        border: 2px solid currentColor;
        box-shadow: none;
    }
    
    .hrw-music-editor-info {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .hrw-music-video-wrapper {
        transition: none;
    }
    
    .hrw-music-container.video-visible .hrw-music-video-wrapper {
        animation: none;
    }
    
    @keyframes fadeInUp {
        from, to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    button.video-triggered,
    .video-triggered {
        transform: none;
        transition: none;
    }
}

/* Editor preview adjustments */
.elementor-editor-active .hrw-music-container.video-hidden .hrw-music-video-wrapper {
    display: block; /* Always show in editor */
}

/* Widget spacing in editor */
.elementor-editor-active .hrw-music-container {
    min-height: 100px;
}

/* Hover effects for video wrapper */
.hrw-music-video-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}