/**
 * MH Video Player Styles
 */

.mh-videoplayer-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
    background: transparent;
}

.mh-videoplayer-aspect-ratio {
    position: relative;
    width: 100%;
    height: 0;
    overflow: hidden;
    background: #000;
}

.mh-videoplayer-aspect-ratio iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.mh-video-player {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
}

/* Error message styling */
.mh-videoplayer-error {
    padding: 20px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #c33;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Loading state */
.mh-videoplayer-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mh-video-spinner 0.8s linear infinite;
}

@keyframes mh-video-spinner {
    to { transform: rotate(360deg); }
}

/* Responsive behavior */
@media (max-width: 768px) {
    .mh-videoplayer-wrapper {
        max-width: 100% !important;
    }
}

/* Video player controls customization (optional) */
.mh-video-player::-webkit-media-controls-panel {
    background-image: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}

.mh-video-player::-webkit-media-controls-play-button {
    transform: scale(1.2);
}

/* Focus state for accessibility */
.mh-video-player:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Poster image optimization */
.mh-video-player[poster] {
    object-fit: cover;
}

/* Full-width responsive container */
.mh-videoplayer-wrapper.full-width {
    max-width: 100%;
    width: 100%;
}

/* Center aligned player */
.mh-videoplayer-wrapper.center {
    margin-left: auto;
    margin-right: auto;
}

/* Rounded corners variant */
.mh-videoplayer-wrapper.rounded {
    border-radius: 8px;
    overflow: hidden;
}

.mh-videoplayer-wrapper.rounded .mh-video-player {
    border-radius: 8px;
}

/* Shadow variant */
.mh-videoplayer-wrapper.shadow {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

/* Thumbnail poster styles (lazy load) */
.mh-videoplayer-poster {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    overflow: hidden;
    z-index: 2;
}

.mh-videoplayer-poster-img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    z-index: 1 !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    max-width: none !important;
}

.mh-videoplayer-poster:hover .mh-videoplayer-play-btn svg path:first-child {
    fill: #cc0000;
    fill-opacity: 1;
}

.mh-videoplayer-play-btn {
    position: relative;
    z-index: 1;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.mh-videoplayer-play-btn:hover {
    transform: scale(1.1);
}

.mh-videoplayer-play-btn:focus {
    outline: 2px solid #fff;
    outline-offset: 4px;
    border-radius: 4px;
}

.mh-videoplayer-play-btn svg {
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Hide poster when video is loaded */
.mh-videoplayer-wrapper.video-loaded .mh-videoplayer-poster {
    display: none;
}

/* Thumbnail overlay (click-to-play) */
.mh-videoplayer-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 5;
}

.mh-videoplayer-thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mh-videoplayer-thumbnail .mh-videoplayer-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
}

.mh-videoplayer-thumbnail:hover .mh-videoplayer-play-btn {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Red hover effect for thumbnail play button */
.mh-videoplayer-thumbnail:hover .mh-videoplayer-play-btn svg .mh-play-bg {
    fill: #cc0000;
}

.mh-videoplayer-thumbnail .mh-videoplayer-title {
    z-index: 7;
}

/* Hide thumbnail when video is loaded */
.mh-videoplayer-wrapper.video-loaded .mh-videoplayer-thumbnail {
    display: none;
}

/* Loading state for thumbnail mode */
.mh-videoplayer-wrapper.mh-has-thumbnail.loading .mh-videoplayer-thumbnail {
    opacity: 0.7;
}

.mh-videoplayer-wrapper.mh-has-thumbnail.loading .mh-videoplayer-play-btn {
    animation: mh-pulse 1s infinite;
}

@keyframes mh-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Heading (h3 above player) */
.mh-videoplayer-heading {
    margin: 0 0 10px 0;
    padding: 0;
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
}

/* Title Overlay (bellyband style) */
.mh-videoplayer-title {
    position: absolute;
    bottom: 15%;
    left: 0;
    right: 0;
    z-index: 10;
    text-align: center;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.5);
    font-size: 18px;
    padding: 8px 36px;
    pointer-events: none;
    text-shadow: 0 0 2px #333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.4;
}

/* Hide title on error */
.mh-videoplayer-wrapper.mh-video-error .mh-videoplayer-title {
    display: none;
}

/* Responsive title adjustments */
@media (max-width: 768px) {
    .mh-videoplayer-title {
        font-size: 14px;
        padding: 6px 20px;
        bottom: 15%;
    }
}

@media (max-width: 480px) {
    .mh-videoplayer-title {
        font-size: 12px;
        padding: 4px 12px;
        bottom: 10%;
    }
}
