/**
 * Champro Custom Builder - Frontend Styles
 * Optimized for Elementor Full Width layouts
 */

/* Container for the Champro Builder */
.champro-builder-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #ffffff;
    overflow: hidden;
    z-index: 999;
}

/* Main iframe styling */
.champro-builder-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    background: #ffffff;
    display: block;
}

/* Loading state */
.champro-builder-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.champro-builder-loading::before {
    content: '';
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #e3e3e3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: champro-spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes champro-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Warning messages for admins */
.champro-builder-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #f39c12;
    color: #856404;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem auto;
    max-width: 600px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 2px 10px rgba(243, 156, 18, 0.1);
}

.champro-builder-warning strong {
    display: block;
    font-size: 1.1em;
    margin-bottom: 0.5rem;
    color: #d68910;
}

/* Elementor and theme overrides */
.elementor-section .champro-builder-container,
.elementor-container .champro-builder-container,
.elementor .champro-builder-container,
.elementor-widget-container .champro-builder-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    z-index: 999 !important;
}

/* Override any theme containers */
.site-content .champro-builder-container,
.entry-content .champro-builder-container,
.page-content .champro-builder-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .champro-builder-container {
        /* Account for mobile browser UI bars */
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for modern browsers */
    }
    
    .champro-builder-iframe {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for modern browsers */
    }
    
    .champro-builder-warning {
        margin: 1rem;
        padding: 1rem;
        font-size: 0.9em;
        max-width: calc(100vw - 2rem);
    }
    
    .champro-builder-loading {
        padding: 1rem;
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .champro-builder-container {
        height: -webkit-fill-available;
    }
    
    .champro-builder-iframe {
        height: -webkit-fill-available;
    }
}

/* High DPI / Retina Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .champro-builder-iframe {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Dark mode support (if theme supports it) */
@media (prefers-color-scheme: dark) {
    .champro-builder-container {
        background: #1a1a1a;
    }
    
    .champro-builder-loading {
        background: rgba(26, 26, 26, 0.95);
        color: #ffffff;
    }
}

/* Print styles */
@media print {
    .champro-builder-container {
        display: none;
    }
}

/* Accessibility improvements */
.champro-builder-iframe:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Smooth scrolling for better UX */
html {
    scroll-behavior: smooth;
}

/* Body modifications when builder is active */
body.champro-builder-page {
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 100vh;
    width: 100vw;
}

/* Hide WordPress admin bar when builder is active */
body.champro-builder-page #wpadminbar {
    display: none !important;
}

/* Hide any page headers/footers */
body.champro-builder-page .site-header,
body.champro-builder-page .site-footer,
body.champro-builder-page .elementor-location-header,
body.champro-builder-page .elementor-location-footer {
    display: none !important;
}

/* Close button for mobile users */
.champro-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
}

.champro-close-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.champro-close-btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Error state styling */
.champro-builder-error {
    background: linear-gradient(135deg, #fef7f7 0%, #ffe6e6 100%);
    border: 1px solid #dc3232;
    color: #8b0000;
    padding: 2rem;
    border-radius: 8px;
    margin: 2rem auto;
    max-width: 600px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 2px 10px rgba(220, 50, 50, 0.1);
}

.champro-builder-error h3 {
    margin: 0 0 1rem 0;
    color: #dc3232;
    font-size: 1.2em;
}

.champro-retry-btn {
    background: #dc3232;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 1rem;
    transition: background 0.2s ease;
}

.champro-retry-btn:hover {
    background: #a02622;
}

/* Custom scrollbar for webkit browsers */
.champro-builder-container::-webkit-scrollbar {
    width: 8px;
}

.champro-builder-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.champro-builder-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.champro-builder-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
} 