/**
 * 360 Woo Video Player - Custom Gallery
 * Desktop: Thumbs venstre, main højre
 * Mobile: Main øverst, thumbs slider under
 */

/* ==========================================================================
   GALLERY CONTAINER
   ========================================================================== */

.wvp-gallery {
    display: flex;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    position: -webkit-sticky;
    position: sticky;
    top: 20px;
    align-self: flex-start;
    height: fit-content;
}

/* Single item - kun billede uden thumbnails */
.wvp-gallery.wvp-single-item {
    display: block;
}

.wvp-gallery.wvp-single-item .wvp-gallery-main {
    width: 100%;
    max-width: 100%;
}

/* ==========================================================================
   MAIN IMAGE/VIDEO
   ========================================================================== */

.wvp-gallery-main {
    flex: 1;
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    padding-bottom: 100%; /* 1:1 aspect ratio */
    height: 0 !important;
}

.wvp-main-item {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
}

.wvp-main-item.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

/* Billeder - contain */
.wvp-main-item.wvp-main-image img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    border-radius: 11px;
}

/* Video thumbnails - cover */
.wvp-main-item.wvp-main-video img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 11px;
}

.wvp-main-item a {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   PLAY BUTTON - MAIN
   ========================================================================== */

/* Ultra specifik selector for at overskrive alle tema styles */
.wvp-play-btn,
.wvp-play-btn[type="button"],
.wvp-play-btn[type="button"]:not(:disabled),
button.wvp-play-btn,
button.wvp-play-btn:not(:disabled),
button[type="button"].wvp-play-btn,
button[type="button"].wvp-play-btn:not(:disabled),
.wvp-gallery .wvp-play-btn,
.wvp-gallery button.wvp-play-btn,
.elementor .wvp-play-btn,
.elementor button.wvp-play-btn {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 70px !important;
    height: 70px !important;
    background: #8c7131 !important;
    background-color: #8c7131 !important;
    border: none !important;
    border-width: 0 !important;
    border-style: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    color: #fff !important;
}

.wvp-play-btn:hover,
.wvp-play-btn[type="button"]:hover,
.wvp-play-btn[type="button"]:not(:disabled):hover,
button.wvp-play-btn:hover,
button.wvp-play-btn:not(:disabled):hover {
    transform: translate(-50%, -50%) scale(1.1) !important;
    background: #a08339 !important;
    background-color: #a08339 !important;
    box-shadow: 0 6px 25px rgba(0,0,0,0.4) !important;
    border: none !important;
}

.wvp-play-btn:active,
.wvp-play-btn[type="button"]:active,
button.wvp-play-btn:active {
    transform: translate(-50%, -50%) scale(0.95) !important;
}

.wvp-play-btn:focus,
.wvp-play-btn[type="button"]:focus,
button.wvp-play-btn:focus {
    outline: none !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
    border: none !important;
}

.wvp-play-btn svg {
    width: 28px !important;
    height: 28px !important;
    fill: #fff !important;
    margin-left: 4px !important;
    color: #fff !important;
}

/* ==========================================================================
   THUMBNAILS - DESKTOP (venstre kolonne)
   ========================================================================== */

.wvp-gallery-thumbs {
    flex: 0 0 100px;
    order: -1;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
}

.wvp-gallery-thumbs::-webkit-scrollbar {
    width: 4px;
}

.wvp-gallery-thumbs::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.wvp-gallery-thumbs::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.wvp-thumbs-track {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wvp-thumb-item {
    position: relative;
    width: 100px !important;
    height: 100px !important;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.wvp-thumb-item:hover {
    border-color: #8c7131;
}

.wvp-thumb-item.active {
    border-color: #8c7131;
}

.wvp-thumb-item img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}

/* Play icon på video thumbs */
.wvp-thumb-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: #8c7131;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.wvp-thumb-play svg {
    width: 12px;
    height: 12px;
    fill: #fff;
    margin-left: 2px;
}

/* ==========================================================================
   VIDEO MODAL
   ========================================================================== */

.wvp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wvp-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.wvp-modal-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.wvp-modal-wrap {
    position: relative;
    width: 90%;
    max-width: 1000px;
    z-index: 1;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.wvp-modal[aria-hidden="false"] .wvp-modal-wrap {
    transform: scale(1);
}

.wvp-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wvp-modal-close:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

.wvp-modal-video {
    position: relative;
    padding-bottom: 56.25%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.wvp-modal-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   MOBILE LAYOUT
   ========================================================================== */

@media (max-width: 768px) {
    .wvp-gallery {
        flex-direction: column;
        gap: 10px;
    }
    
    .wvp-gallery-main {
        order: 1;
        width: 100%;
    }
    
    .wvp-gallery-thumbs {
        order: 2;
        flex: none;
        width: 100%;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .wvp-gallery-thumbs::-webkit-scrollbar {
        display: none;
    }
    
    .wvp-thumbs-track {
        flex-direction: row;
        gap: 8px;
        padding: 4px 0;
    }
    
    .wvp-thumb-item {
        width: 70px !important;
        height: 70px !important;
        flex-shrink: 0;
    }
    
    .wvp-play-btn {
        width: 56px;
        height: 56px;
    }
    
    .wvp-play-btn svg {
        width: 22px;
        height: 22px;
    }
    
    .wvp-thumb-play {
        width: 24px;
        height: 24px;
    }
    
    .wvp-thumb-play svg {
        width: 10px;
        height: 10px;
    }
    
    .wvp-modal-wrap {
        width: 95%;
    }
    
    .wvp-modal-close {
        top: -45px;
        width: 40px;
        height: 40px;
        font-size: 28px;
    }
}

/* ==========================================================================
   VERY SMALL SCREENS
   ========================================================================== */

@media (max-width: 480px) {
    .wvp-thumb-item {
        width: 60px !important;
        height: 60px !important;
    }
    
    .wvp-play-btn {
        width: 50px;
        height: 50px;
    }
    
    .wvp-play-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* ==========================================================================
   ELEMENTOR OVERRIDES
   ========================================================================== */

.elementor .wvp-gallery-main {
    padding-bottom: 100% !important;
    height: 0 !important;
}

.elementor .wvp-gallery-main,
.elementor .wvp-main-item,
.elementor .wvp-thumb-item,
.elementor .wvp-thumb-item img {
    max-width: 100% !important;
    max-height: none !important;
}

.elementor .wvp-main-item {
    height: 100% !important;
    padding-bottom: 0 !important;
}

/* Billeder - contain */
.elementor .wvp-main-item.wvp-main-image img {
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

/* Video - cover */
.elementor .wvp-main-item.wvp-main-video img {
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Skjul galleri i Elementor sticky spacer */
.elementor-sticky__spacer .wvp-gallery {
    display: none !important;
}

/* Single item i Elementor */
.elementor .wvp-gallery.wvp-single-item {
    display: block !important;
}

.elementor .wvp-gallery.wvp-single-item .wvp-gallery-main {
    width: 100% !important;
    max-width: 100% !important;
}

/* ==========================================================================
   STICKY SUPPORT - Elementor columns
   ========================================================================== */

/* Sørg for at parent column tillader sticky */
.elementor-widget-shortcode:has(.wvp-gallery) {
    height: fit-content !important;
}

/* Alternativ support for browsere uden :has() */
.wvp-gallery-wrapper {
    position: -webkit-sticky;
    position: sticky;
    top: 20px;
    align-self: flex-start;
    height: fit-content;
}
