/**
 * Frontend Styles for Parkland Autoplay Video Block
 * Responsive design with accessibility considerations
 */

/* Main video wrapper */
.parkland-autoplay-video-wrapper {
    position: relative;
    display: block;
    margin: 1.5em 0;
    max-width: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background: #000;
    transition: all 0.3s ease;
}

.parkland-autoplay-video-wrapper:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Alignment classes */
.parkland-autoplay-video-wrapper.alignleft {
    float: left;
    margin-right: 1.5em;
    margin-left: 0;
}

.parkland-autoplay-video-wrapper.alignright {
    float: right;
    margin-left: 1.5em;
    margin-right: 0;
}

.parkland-autoplay-video-wrapper.aligncenter {
    margin-left: auto;
    margin-right: auto;
    display: block;
}

.parkland-autoplay-video-wrapper.alignwide {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.parkland-autoplay-video-wrapper.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Video container */
.parkland-autoplay-video-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
}

/* Video element */
.parkland-autoplay-video-container video {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    border: none;
    outline: none;
    background: #000;
}

/* Loading state */
.parkland-autoplay-video-wrapper.video-loading {
    position: relative;
}

.parkland-autoplay-video-wrapper.video-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: parkland-video-spin 1s linear infinite;
    z-index: 10;
}

@keyframes parkland-video-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Play button */
.parkland-video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.parkland-video-play-button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

.parkland-video-play-button:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.parkland-video-play-button .play-icon {
    margin-left: 4px; /* Slight offset to center the triangle */
}

/* Video caption */
.parkland-video-caption {
    padding: 1em;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    font-size: 0.9em;
    line-height: 1.4;
    color: #6c757d;
}

.parkland-video-caption p {
    margin: 0;
}

/* Error state */
.parkland-video-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc3545;
    font-size: 0.9em;
    text-align: center;
    padding: 1em;
}

.parkland-video-error p {
    margin: 0;
}

/* Accessibility notice */
.parkland-video-accessibility-notice {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 0.5em;
    font-size: 0.8em;
    text-align: center;
    z-index: 5;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .parkland-autoplay-video-wrapper {
        margin: 1em 0;
        border-radius: 4px;
    }
    
    .parkland-video-play-button {
        width: 60px;
        height: 60px;
        font-size: 20px;
    }
    
    .parkland-autoplay-video-wrapper.alignleft,
    .parkland-autoplay-video-wrapper.alignright {
        float: none;
        margin-left: auto;
        margin-right: auto;
        display: block;
    }
}

@media (max-width: 480px) {
    .parkland-autoplay-video-wrapper {
        margin: 0.5em 0;
    }
    
    .parkland-video-play-button {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
    
    .parkland-video-caption {
        padding: 0.75em;
        font-size: 0.85em;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .parkland-autoplay-video-wrapper {
        border: 2px solid #000;
    }
    
    .parkland-video-play-button {
        border: 2px solid #fff;
        background: #000;
    }
    
    .parkland-video-caption {
        border-top: 2px solid #000;
        background: #fff;
        color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .parkland-autoplay-video-wrapper {
        transition: none;
    }
    
    .parkland-video-play-button {
        transition: none;
    }
    
    .parkland-video-play-button:hover {
        transform: translate(-50%, -50%);
    }
    
    @keyframes parkland-video-spin {
        0% { transform: translate(-50%, -50%) rotate(0deg); }
        100% { transform: translate(-50%, -50%) rotate(0deg); }
    }
}

/* Focus styles for accessibility */
.parkland-autoplay-video-wrapper:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Video states */
.parkland-autoplay-video-wrapper.video-ready {
    opacity: 1;
}

.parkland-autoplay-video-wrapper.video-autoplay-success .parkland-video-play-button {
    display: none;
}

.parkland-autoplay-video-wrapper.video-autoplay-failed .parkland-video-play-button {
    display: flex;
}

/* Ensure video maintains aspect ratio */
.parkland-autoplay-video-container {
    aspect-ratio: 16 / 9;
}

.parkland-autoplay-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Fallback for browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
    .parkland-autoplay-video-container {
        position: relative;
        width: 100%;
        height: 0;
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
    }
    
    .parkland-autoplay-video-container video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}
