/* Modal Components */

/* Modal z-index hierarchy */
.modal-overlay {
    z-index: var(--z-modal-overlay);
}

.glofox-modal {
    z-index: var(--z-glofox-modal);
}

/* Enhanced Glofox modal styling to match site palette */
.glofox-modal {
    font-family: 'BebasNeue', 'Inter', sans-serif;
}

.glofox-modal .bg-steel-gray {
    background: linear-gradient(135deg, var(--color-charcoal) 0%, var(--color-steel-gray) 100%) !important;
    border: 1px solid rgba(0, 176, 240, 0.2) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 176, 240, 0.15) !important;
}

/* Enhanced modal header with centred title */
.glofox-modal .flex.justify-center {
    position: relative;
    width: 100%;
    text-align: center;
}

.glofox-modal h3 {
    color: white !important;
    font-family: 'BebasNeue', sans-serif !important;
    font-size: 1.5rem !important;
    font-weight: normal !important;
    letter-spacing: 0.05em !important;
    background: linear-gradient(135deg, var(--color-electric-blue), var(--color-cyan-tint));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 auto;
    text-align: center;
    max-width: calc(100% - 80px); /* Account for close button */
}

.glofox-modal button {
    color: var(--color-cool-gray) !important;
    transition: all 0.3s ease !important;
}

.glofox-modal button:hover {
    color: var(--color-electric-blue) !important;
    transform: scale(1.1) !important;
}

/* Close button positioning for centred header */
.glofox-modal #close-modal {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.glofox-modal .border-b {
    border-color: rgba(0, 176, 240, 0.2) !important;
}

/* ENHANCED MOBILE GLOFOX MODAL */
/* Mobile-optimized Glofox iframe styling */
.glofox_iframe {
    width: 100%;
    min-height: 400px;
    border: 2px solid rgba(0, 176, 240, 0.3) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 176, 240, 0.1) !important;
    overflow: auto !important;
}

.glofox-iframe-rounded {
    border-radius: 12px !important;
    overflow: hidden;
}

/* Mobile-specific iframe enhancements */
@media (max-width: 768px) {
    .glofox-modal {
        /* Ensure modal is scrollable */
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        z-index: 2000 !important;
        
        /* Center content vertically and horizontally */
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
        padding: 0.5rem !important;
    }
    
    .glofox-modal > div {
        /* Modal content container */
        width: 100% !important;
        max-width: 95vw !important;
        margin: 1rem auto !important;
        border-radius: 16px !important;
        max-height: none !important;
        overflow: visible !important;
        position: relative !important;
    }
    
    /* Modal header */
    .glofox-modal .flex.justify-center {
        padding: 1rem !important;
        border-bottom: 1px solid rgba(0, 176, 240, 0.2) !important;
    }
    
    .glofox-modal h3 {
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
    }
    
    /* Modal body - critical for scrolling */
    .glofox-modal .p-6 {
        padding: 1rem !important;
        overflow: visible !important;
        max-height: none !important;
    }
    
    /* iframe container */
    .glofox-modal #hero-form {
        overflow: visible !important;
        max-height: none !important;
        position: relative !important;
    }
    
    .glofox-modal .glofox_iframe {
        min-height: 500px !important;
        height: auto !important;
        max-height: none !important;
        width: 100% !important;
        border-radius: 12px !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
        
        /* Ensure iframe can scroll on mobile */
        touch-action: pan-y !important;
        -webkit-transform: translate3d(0,0,0) !important;
        transform: translate3d(0,0,0) !important;
    }
    
    /* Critical iframe styles for mobile scrolling */
    .glofox-modal iframe {
        width: 100% !important;
        min-height: 500px !important;
        height: auto !important;
        border: none !important;
        border-radius: 12px !important;
        background: #2C2C2C !important;
        
        /* Enable scrolling on mobile */
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y pinch-zoom !important;
        
        /* Hardware acceleration */
        -webkit-transform: translate3d(0,0,0) !important;
        transform: translate3d(0,0,0) !important;
        backface-visibility: hidden !important;
        -webkit-backface-visibility: hidden !important;
    }
    
    /* Powered by Glofox text */
    #poweredbyGlofox {
        font-size: 0.875rem !important;
        margin-top: 1rem !important;
        text-align: center !important;
    }
}

/* Custom styling for Glofox iframe content */
.glofox-modal iframe {
    background: var(--color-steel-gray) !important;
}

/* Powered by Glofox text styling */
#poweredbyGlofox {
    font-family: 'BebasNeue', sans-serif !important;
    letter-spacing: 0.025em !important;
    text-align: center !important;
}

#poweredbyGlofox a {
    color: var(--color-electric-blue) !important;
    transition: color 0.3s ease !important;
}

#poweredbyGlofox a:hover {
    color: var(--color-cyan-tint) !important;
}

/* iOS Glofox modal compatibility with enhanced styling */
@supports (-webkit-touch-callout: none) {
    .glofox-modal {
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }
    
    @media (max-width: 768px) {
        .glofox-modal .glofox_iframe {
            -webkit-overflow-scrolling: touch !important;
            transform: translate3d(0,0,0) !important;
            border: 2px solid rgba(0, 176, 240, 0.4) !important;
        }
        
        .glofox-modal iframe {
            -webkit-overflow-scrolling: touch !important;
            overflow: auto !important;
            border-radius: 12px !important;
            background: var(--color-steel-gray) !important;
            box-shadow: inset 0 0 0 1px rgba(0, 176, 240, 0.2) !important;
            
            /* iOS-specific touch handling */
            -webkit-touch-callout: none !important;
            -webkit-user-select: none !important;
            touch-action: pan-y pinch-zoom !important;
        }
        
        /* iOS safe area support */
        .glofox-modal > div {
            margin-top: max(1rem, env(safe-area-inset-top)) !important;
            margin-bottom: max(1rem, env(safe-area-inset-bottom)) !important;
            margin-left: max(0.5rem, env(safe-area-inset-left)) !important;
            margin-right: max(0.5rem, env(safe-area-inset-right)) !important;
        }
    }
}

/* Android-specific optimizations */
@media (max-width: 768px) {
    .device-android .glofox-modal iframe {
        transform: translateZ(0) !important;
        will-change: scroll-position !important;
        -webkit-transform: translateZ(0) !important;
    }
}

/* Class details modal */
.class-modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

/* Modal backdrop enhancement */
.glofox-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(0, 176, 240, 0.1) 0%, rgba(0, 0, 0, 0.8) 70%);
    pointer-events: none;
    z-index: -1;
}

/* Modal states */
.modal-hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-normal) ease;
}

.modal-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Hero content states */
.hero-content-hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-slow) ease-in-out;
}

.hero-content-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Loading states */
.loading-hidden {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.loading-visible {
    opacity: 1;
}

.loading-none {
    display: none;
} 