/*
Theme Name: Listivo Child
Theme URI: https://listivotheme.com/
Author: TangibleDesign
Author URI: https://tangibledesign.net/
Description: Listivo
Template: listivo
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: translation-ready
Text Domain: listivo
*/

/* ==========================================
    LEGACY VIDEO HELP (BASIC ONLY)
   ========================================== */

.video-help-container {
  margin-top: 10px;
  display: block;
  width: 100%;
}

.video-help-container a:hover {
  color: #005bb5;
  text-decoration: underline;
}

/* ==========================================
   🔗 BASIC INTEGRATION UTILITIES
   ========================================== */

/* Basic divider for sections */
.or-divider {
  margin: 20px 0;
  text-align: center;
  position: relative;
}

.or-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e0e0e0;
}

.or-divider span {
  background: white;
  padding: 0 15px;
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

/* Integration with existing Listivo styles */
.listivo-input-v2 + .or-divider {
  margin-top: 20px;
}

/* Basic mobile responsiveness */
@media (max-width: 768px) {
  .or-divider {
    margin: 15px 0;
  }
  
  .video-help-container {
    padding: 10px;
  }
}

/* =================================================================== */
/* CLOUDFLARE STREAM SPACING FIX - Add to style.css or upload-video.css */
/* =================================================================== */

/* ========================================
   GLOBAL CLOUDFLARE STREAM FIXES
   ======================================== */

/* Reset all Cloudflare-related containers */
*[class*="cloudflare"],
*[src*="cloudflarestream.com"],
*[src*="iframe.cloudflarestream.com"] {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-sizing: border-box !important;
}

/* Specific fixes for listing display */
.listivo-listing-section__embed--cloudflare {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    line-height: 1 !important;
    overflow: hidden !important;
}

.listivo-listing-section__embed-wrapper--cloudflare {
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    overflow: hidden !important;
    background: transparent !important;
    border-radius: 8px !important;
}

/* ========================================
   RESPONSIVE VIDEO WRAPPER - CLOUDFLARE
   ======================================== */

.cloudflare-stream-container {
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
    margin: 0 !important;
    overflow: hidden !important;
    border-radius: 8px !important;
    background: #000 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.cloudflare-stream-inner {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

/* ========================================
   IFRAME SPECIFIC FIXES
   ======================================== */

/* Target all Cloudflare Stream iframes */
iframe[src*="cloudflarestream.com"],
iframe[src*="iframe.cloudflarestream.com"],
.cloudflare-stream-container iframe,
.cloudflare-stream-inner iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    background: #000 !important;
    border-radius: 8px !important;
}

/* ========================================
   LISTIVO THEME OVERRIDES
   ======================================== */

/* Override any theme-imposed spacing */
.listivo-listing-section__content .listivo-listing-section__embed--cloudflare {
    margin: 0 !important;
    padding: 0 !important;
}

.listivo-listing-section__content .listivo-listing-section__embed-wrapper--cloudflare {
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure consistent spacing in listing grid */
.listivo-listing-card .listivo-listing-section__embed--cloudflare {
    margin-bottom: 0 !important;
    margin-top: 0 !important;
}

/* ========================================
   ENHANCED EMBED WRAPPER FIXES
   ======================================== */

/* For form/upload pages */
.enhanced-embed-wrapper.cloudflare-video-container {
    border: 2px solid #0ea5e9 !important;
    border-radius: 12px !important;
    padding: 0 !important;
    margin: 15px 0 !important;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
    overflow: hidden !important;
}

.enhanced-embed-wrapper.cloudflare-video-container .cloudflare-stream-container {
    margin: 0 !important;
    border-radius: 8px !important;
    background: #000 !important;
}

/* ========================================
   PANEL FORM SPECIFIC FIXES
   ======================================== */

/* For ad creation/edit forms */
.listivo-panel-form__embed-wrapper {
    margin: 0 !important;
    padding: 0 !important;
}

.listivo-panel-form__embed-wrapper .cloudflare-stream-container {
    margin: 0 !important;
    border-radius: 8px !important;
}

.listivo-panel-form__embed--cloudflare {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
}

/* ========================================
   MOBILE RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    .cloudflare-stream-container {
        border-radius: 6px !important;
        margin: 0 !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1) !important;
    }
    
    .cloudflare-stream-inner {
        border-radius: 6px !important;
    }
    
    iframe[src*="cloudflarestream.com"],
    iframe[src*="iframe.cloudflarestream.com"] {
        border-radius: 6px !important;
    }
}

@media (max-width: 480px) {
    .cloudflare-stream-container {
        border-radius: 4px !important;
    }
    
    .cloudflare-stream-inner {
        border-radius: 4px !important;
    }
    
    iframe[src*="cloudflarestream.com"],
    iframe[src*="iframe.cloudflarestream.com"] {
        border-radius: 4px !important;
    }
}

/* ========================================
   LOADING AND ERROR STATES
   ======================================== */

/* Loading spinner for Cloudflare videos */
.cloudflare-stream-container:not(.loaded)::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0ea5e9;
    border-radius: 50%;
    animation: cloudflareSpinner 1s linear infinite;
    z-index: 2;
}

@keyframes cloudflareSpinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error state styling */
.cloudflare-stream-container.error {
    background: #f8f9fa !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #6c757d !important;
    font-size: 14px !important;
    text-align: center !important;
}

.cloudflare-stream-container.error::before {
    display: none !important;
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* High contrast mode */
@media (prefers-contrast: high) {
    .cloudflare-stream-container {
        border: 2px solid #000 !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cloudflare-stream-container:not(.loaded)::before {
        animation: none !important;
    }
    
    .cloudflare-stream-container,
    .cloudflare-stream-inner {
        transition: none !important;
    }
}

/* Focus indicators for keyboard navigation */
.cloudflare-stream-container:focus-within {
    outline: 2px solid #0ea5e9 !important;
    outline-offset: 2px !important;
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */

@media (prefers-color-scheme: dark) {
    .cloudflare-stream-container {
        background: #1a1a1a !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }
    
    .cloudflare-stream-container.error {
        background: #2d3748 !important;
        color: #a0aec0 !important;
    }
    
    .enhanced-embed-wrapper.cloudflare-video-container {
        background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%) !important;
        border-color: #4a5568 !important;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .cloudflare-stream-container {
        background: #fff !important;
        border: 1px solid #000 !important;
        page-break-inside: avoid !important;
    }
    
    .cloudflare-stream-container::after {
        content: "Vidéo: " attr(data-video-url) !important;
        position: absolute !important;
        bottom: 10px !important;
        left: 10px !important;
        font-size: 12px !important;
        color: #000 !important;
    }
}

/* ========================================
   FINAL CLEANUP - NUCLEAR OPTION
   ======================================== */

/* Force remove any conflicting styles */
.listivo-listing-section__embed--cloudflare * {
    box-sizing: border-box !important;
}

/* Ensure video containers don't have unexpected dimensions */
.cloudflare-stream-container,
.cloudflare-stream-inner {
    max-width: 100% !important;
    min-height: 0 !important;
}

/* Remove any potential margin/padding inheritance */
.listivo-listing-section__content > .listivo-listing-section__embed--cloudflare {
    margin: 0 !important;
    padding: 0 !important;
}

/* Success - videos should now display without gaps! */

/*
 * Final Fix for Listivo/Elementor Duplicate Video Widget - v4
 *
 * This version avoids the :has() selector for better compatibility
 * with the WordPress Customizer's CSS validator. It works with a
 * helper class added via the PHP template.
 */

/* Hide the ghost widget completely */
.marketnoba-ghost-widget {
    display: none !important;
}

