/* CloudFront Video Integration - Frontend Styles */

.cfvi-video-container {
    position: relative;
    width: 100%;
    margin: 1rem 0;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cfvi-video-container.aspect-16-9 {
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
}

.cfvi-video-container.aspect-4-3 {
    padding-bottom: 75%; /* 4:3 aspect ratio */
    height: 0;
}

.cfvi-video-player {
    width: 100%;
    height: 100%;
    background: #000;
    border: none;
    outline: none;
    object-fit: contain;
}

/* Safari specific improvements */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .cfvi-video-player {
        -webkit-appearance: none;
        appearance: none;
        -webkit-background-clip: padding-box;
        background-clip: padding-box;
        -webkit-mask-image: -webkit-radial-gradient(white, black);
        mask-image: radial-gradient(white, black);
    }
    
    /* Force Safari to show video frame */
    .cfvi-video-player::-webkit-media-controls-start-playback-button {
        opacity: 0.8;
    }
}

.cfvi-video-container.aspect-16-9 .cfvi-video-player,
.cfvi-video-container.aspect-4-3 .cfvi-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Hide download button specifically - preserve other controls */
.cfvi-video-player::-webkit-media-controls-download-button {
    display: none !important;
}

/* Ensure picture-in-picture is visible */
.cfvi-video-player::-webkit-media-controls-picture-in-picture-button {
    display: block !important;
}

/* Custom loading indicator */
.cfvi-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 20px;
    border-radius: 4px;
    z-index: 10;
}

.cfvi-loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: cfvi-spin 1s ease-in-out infinite;
}

@keyframes cfvi-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error message styling */
.cfvi-error {
    background: #dc3545;
    color: #fff;
    padding: 15px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

.cfvi-error::before {
    content: "⚠ ";
    font-weight: bold;
}

/* Success message styling */
.cfvi-success {
    background: #28a745;
    color: #fff;
    padding: 15px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

.cfvi-success::before {
    content: "✓ ";
    font-weight: bold;
}

/* Responsive design */
@media (max-width: 768px) {
    .cfvi-video-container {
        margin: 0.5rem 0;
        border-radius: 4px;
    }
    
    .cfvi-loading {
        font-size: 14px;
        padding: 8px 16px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .cfvi-error {
        background: #c82333;
    }
    
    .cfvi-success {
        background: #218838;
    }
}

/* Focus states for accessibility */
.cfvi-video-player:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cfvi-video-container {
        border: 2px solid #000;
        box-shadow: none;
    }
    
    .cfvi-loading {
        border: 1px solid #fff;
        background: #000;
    }
}
