/**
 * Video Hero Widget Styles
 * Responsive, LCP Optimized
 */

/* ==================== Base Container ==================== */
.video-hero-container {
    position: relative;
    width: 100%;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    contain: layout style paint;
    /* Border radius desteği */
    border-radius: inherit;
}

/* ==================== Background Layer ==================== */
.video-hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    /* Border radius inherit */
    border-radius: inherit;
}

.video-hero-poster,
.video-hero-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    /* LCP Optimizasyonu */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* Border radius inherit */
    border-radius: inherit;
}

/* Desktop image - hide on mobile */
.video-hero-poster-desktop {
    display: block;
    object-fit: cover;
    object-position: center center;
}

/* Mobile image - hide on desktop, ensure full cover */
.video-hero-poster-mobile {
    display: none;
    object-fit: cover;
    object-position: center center;
    /* Ensure mobile image covers full container */
    min-width: 100%;
    min-height: 100%;
}

/* Video wrapper */
.video-hero-video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    /* Border radius inherit */
    border-radius: inherit;
}

/* YouTube & Vimeo iframe - tam kaplama */
.video-hero-video-wrapper iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw; /* 16:9 aspect ratio */
    min-width: 100%;
    min-height: 100%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: none;
    object-fit: cover;
    /* GPU acceleration for smooth playback */
    will-change: transform;
    transform: translate3d(-50%, -50%, 0);
}

/* Self-hosted video - tam kaplama */
.video-hero-video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Hide poster when video is loaded - smooth transition */
.video-hero-container.video-loaded .video-hero-poster {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

/* ==================== Overlay ==================== */
.video-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2;
    pointer-events: none;
    /* Border radius inherit */
    border-radius: inherit;
}

/* ==================== Content ==================== */
.video-hero-content {
    position: relative;
    z-index: 3;
    max-width: 600px;
    padding: 60px 40px;
    box-sizing: border-box;
}

/* Title */
.video-hero-title {
    color: #ffffff;
    font-size: 48px;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 20px 0;
    padding: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Description */
.video-hero-description {
    color: rgba(255, 255, 255, 0.85);
    font-size: 16px;
    line-height: 1.7;
    margin: 0 0 30px 0;
    padding: 0;
}

/* ==================== Buttons ==================== */
.video-hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.video-hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    border: 2px solid transparent;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.video-hero-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Primary Button */
.video-hero-btn-primary {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.video-hero-btn-primary:hover {
    background-color: #ffffff;
    color: #2563eb;
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

.video-hero-btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.video-hero-btn-secondary {
    background-color: #ffffff;
    color: #2563eb;
    border-color: #2563eb;
}

.video-hero-btn-secondary:hover {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

.video-hero-btn-secondary:active {
    transform: translateY(0);
}

/* Button Icon */
.video-hero-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
}

.video-hero-btn-icon svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

.video-hero-btn-icon i {
    font-size: inherit;
}

/* ==================== Responsive - Tablet ==================== */
@media screen and (max-width: 1024px) {
    .video-hero-container {
        min-height: 70vh;
    }

    .video-hero-content {
        max-width: 500px;
        padding: 50px 30px;
    }

    .video-hero-title {
        font-size: 40px;
    }

    .video-hero-description {
        font-size: 15px;
    }
}

/* ==================== Responsive - Mobile ==================== */
@media screen and (max-width: 767px) {
    .video-hero-container {
        min-height: 100svh; /* Safe viewport height for mobile */
        align-items: flex-end;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    /* Show mobile image, hide desktop */
    .video-hero-poster-desktop {
        display: none !important;
    }

    .video-hero-poster-mobile {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center center !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
    }

    /* Fallback if no mobile image provided */
    .video-hero-background:not(:has(.video-hero-poster-mobile)) .video-hero-poster-desktop {
        display: block !important;
        object-fit: cover !important;
        object-position: center center !important;
    }

    .video-hero-content {
        max-width: 100%;
        width: 100%;
        padding: 30px 20px 50px;
    }

    .video-hero-title {
        font-size: 28px;
        line-height: 1.3;
        margin-bottom: 16px;
    }

    .video-hero-description {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 24px;
    }

    .video-hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .video-hero-btn {
        width: 100%;
        padding: 16px 24px;
        font-size: 15px;
        justify-content: center;
    }

    /* Better touch target */
    .video-hero-btn:active {
        transform: scale(0.98);
    }

    /* Fix iframe overflow on mobile */
    .video-hero-video-wrapper iframe {
        width: 177.77vh; /* 16:9 for portrait */
        height: 100vh;
    }
}

/* ==================== Responsive - Small Mobile ==================== */
@media screen and (max-width: 375px) {
    .video-hero-content {
        padding: 20px 16px 40px;
    }

    .video-hero-title {
        font-size: 24px;
    }

    .video-hero-description {
        font-size: 13px;
    }

    .video-hero-btn {
        padding: 14px 20px;
        font-size: 14px;
    }
}

/* ==================== Landscape Mobile ==================== */
@media screen and (max-width: 896px) and (orientation: landscape) {
    .video-hero-container {
        min-height: 100vh;
        align-items: center;
    }

    .video-hero-content {
        max-width: 60%;
        padding: 30px;
    }

    .video-hero-title {
        font-size: 28px;
    }

    .video-hero-buttons {
        flex-direction: row;
    }

    .video-hero-btn {
        width: auto;
    }
}

/* ==================== Reduced Motion ==================== */
@media (prefers-reduced-motion: reduce) {
    .video-hero-btn,
    .video-hero-poster,
    .video-hero-bg-image {
        transition: none;
    }

    .video-hero-btn:hover {
        transform: none;
    }

    /* Disable video on reduced motion preference */
    .video-hero-video-wrapper {
        display: none !important;
    }

    .video-hero-container.video-loaded .video-hero-poster {
        opacity: 1;
        visibility: visible;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    .video-hero-container {
        min-height: auto;
        background: #fff !important;
    }

    .video-hero-video-wrapper,
    .video-hero-overlay {
        display: none !important;
    }

    .video-hero-title,
    .video-hero-description {
        color: #000 !important;
    }
}

/* ==================== High Contrast Mode ==================== */
@media (prefers-contrast: high) {
    .video-hero-btn {
        border-width: 3px;
    }

    .video-hero-title {
        text-shadow: none;
    }
}

/* ==================== Dark Mode Support ==================== */
@media (prefers-color-scheme: dark) {
    .video-hero-btn-secondary {
        background-color: rgba(255, 255, 255, 0.95);
    }
}

/* ==================== Focus States for Accessibility ==================== */
.video-hero-btn:focus {
    outline: none;
}

.video-hero-btn:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.5);
}

/* ==================== Loading State ==================== */
.video-hero-container[data-loading="true"] .video-hero-video-wrapper {
    opacity: 0;
}

.video-hero-container[data-loading="false"] .video-hero-video-wrapper {
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* ==================== Elementor Editor Fixes ==================== */
.elementor-editor-active .video-hero-container {
    pointer-events: auto;
}

.elementor-editor-active .video-hero-video-wrapper {
    pointer-events: none;
}

.elementor-editor-active .video-hero-content {
    pointer-events: auto;
}