/**
 * Video Background Styles
 */

/* Block inserter styles - make the block stand out */
.editor-block-list-item-genexpress-gp-video-background .block-editor-block-icon {
    background-color: #0073aa;
    color: white;
    padding: 4px;
    border-radius: 4px;
}

.editor-block-list-item-genexpress-gp-video-background .block-editor-block-types-list__item-title {
    font-weight: bold;
    color: #0073aa;
}

/* Match GeneratePress block search highlighting */
.components-search-item__highlight-gp {
    background-color: #0073aa;
    color: white;
    padding: 1px 4px;
    border-radius: 2px;
}

/* Alignment styles */
.genexpress-video-background.align-left {
    float: left;
    margin-right: 1.5em;
    margin-bottom: 1.5em;
}

.genexpress-video-background.align-center {
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1.5em;
}

.genexpress-video-background.align-right {
    float: right;
    margin-left: 1.5em;
    margin-bottom: 1.5em;
}

/* Clear floats after alignment */
.genexpress-video-background.align-left::after,
.genexpress-video-background.align-right::after {
    content: "";
    display: table;
    clear: both;
}

/* Main container styles */
.genexpress-video-background {
    position: relative;
    overflow: hidden;
    width: 100%;
    background-color: var(--generate-content-background, #f7f8f9);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5em;
    /* Match GenerateBlocks container appearance */
    --gblocks-block-margin-bottom: 0;
    --gblocks-block-default-padding-left: 0;
    --gblocks-block-default-padding-right: 0;
    /* Ensure min-height to make video visible */
    min-height: 250px;
}

.genexpress-video-background__inner {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.genexpress-video-background__video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translateX(-50%) translateY(-50%);
    object-fit: cover;
    /* Default z-index, will be overridden by inline style */
    z-index: -1;
    /* Default opacity, will be overridden by inline style */
    opacity: 0.5;
    /* Smooth transitions for opacity changes */
    transition: opacity 0.3s ease;
    /* Make sure pointer events don't block content clicks */
    pointer-events: none;
}

.genexpress-video-background__content {
    position: relative;
    /* Default z-index to ensure content stays on top */
    z-index: 2;
    padding: 2em;
    /* Set proper padding to match GeneratePress containers */
    padding: var(--gblocks-container-padding, 40px);
    /* Allow some min-height in case content is empty */
    min-height: 200px;
    /* Make sure it's over the video */
    z-index: 2 !important;
}

/* Play button styling for autoplay-blocked videos */
.genexpress-video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    background-color: var(--generate-button-background-color, #1e73be);
    color: var(--generate-button-text-color, #ffffff);
    border: none;
    border-radius: 3px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    font-family: var(--generate-font-family, -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif);
    /* Enable pointer events for the button */
    pointer-events: auto;
}

.genexpress-video-play-button:hover {
    background-color: var(--generate-button-background-color-hover, #156bbf);
    color: var(--generate-button-text-color-hover, #ffffff);
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.genexpress-video-play-button:focus {
    outline: 2px solid var(--generate-button-background-color, #1e73be);
    outline-offset: 2px;
}

/* GeneratePress compatibility - match colors and styles */
.genexpress-video-background .gb-container {
    background-color: transparent;
}

/* Video background placeholder */
.genexpress-video-background__placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.05);
    text-align: center;
    padding: 20px;
    color: var(--generate-text-color, #222222);
    z-index: 1;
}

/* Block editor specific styles */
.editor-styles-wrapper .genexpress-video-background {
    border: 1px solid #007cba; /* Blue border for editor to make it look like GB blocks */
    min-height: 250px; /* Ensure there's enough space in editor */
}

.editor-styles-wrapper .genexpress-video-background .block-editor-inner-blocks {
    margin: 0;
}

/* Make the block blue in the editor to match GeneratePress/GenerateBlocks appearance */
.wp-block-genexpress-gp-video-background,
.wp-block-genexpress-video-background {
    border: 1px dashed #0073aa;
    background: rgba(0, 115, 170, 0.05);
}

/* Interactive editing features */
.wp-block-genexpress-gp-video-background:hover .genexpress-video-background__video {
    /* Highlight the video slightly when hovering over the block to make it clear it's editable */
    filter: brightness(1.1);
}

.wp-block-genexpress-gp-video-background.is-selected .genexpress-video-background__inner::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px dashed #0073aa;
    pointer-events: none;
    z-index: 3;
}

/* Specific styling for GenerateBlocks compatible implementation */
.gp-video-background {
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

/* Make sure the video container takes up full space */
.gp-video-background .genexpress-video-background__inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Ensure content is placed properly relative to video */
.gp-video-background .genexpress-video-background__content {
    position: relative;
    z-index: 2;
}

/* Front-end specific styles */
body:not(.editor-styles-wrapper) .genexpress-video-background {
    height: auto;
    width: 100%;
}

/* Fix for video backgrounds with GenerateBlocks */
.genexpress-video-background.gb-container .gb-inside-container {
    z-index: 2;
    position: relative;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .genexpress-video-background__content {
        padding: var(--gblocks-container-padding-right-mobile, 30px) var(--gblocks-container-padding-left-mobile, 30px);
    }
    
    /* Adjust video for better mobile display */
    .genexpress-video-background__video {
        /* On mobile, sometimes we need more width to properly cover the container */
        min-width: 110%;
        min-height: 110%;
    }
} 