/* ========== CTA SECTION ========== */

.cta-section {
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    padding: 100px 0;
    min-height: 400px;
    --content-color: #ffffff;
    display: flex;
  align-items: center;
    overflow: hidden; /* Important for video backgrounds */
}

/* Video Background Container */
.cta-video-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

/* Base Video Styles */
.cta-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

/* Show Desktop Video by default */
.cta-video-desktop {
    display: block;
}

/* Hide Mobile Video by default */
.cta-video-mobile {
    display: none;
}

/* Video Fallback Image */
.cta-video-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none; /* Hidden unless video fails to load */
}

.cta-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none; /* Allows clicking through overlay */
}

.cta-container {
    position: relative;
    z-index: 2;
}

/* Ensure content stays above video */
.cta-section.has-video-bg .cta-container {
    position: relative;
    z-index: 2;
}

/* ========== CTA BUTTONS GROUP ========== */

.cta-buttons-group {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

/* Split layout button group alignment */
.cta-left .cta-buttons-group,
.cta-right .cta-buttons-group {
    justify-content: flex-start;
}

/* Button styles remain the same */
.cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    cursor: pointer;
    white-space: nowrap;
}

/* Primary Button */
.cta-btn-primary {
    background-color: var(--main-color, #c4082e);
    color: #ffffff;
    padding: 16px 36px;
    font-size: 18px;
    letter-spacing: 0.3px;
    border: 2px solid var(--main-color, #c4082e);
    box-shadow: 0 4px 15px rgba(196, 8, 46, 0.3);
}

.cta-btn-primary:hover {
    background-color: var(--off-color, #8b0620);
    border-color: var(--off-color, #8b0620);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(196, 8, 46, 0.4);
}

/* Secondary Button */
.cta-btn-secondary {
    background-color: transparent;
    color: var(--content-color, #ffffff);
    padding: 14px 32px;
    font-size: 16px;
    border: 2px solid var(--content-color, #ffffff);
}

.cta-btn-secondary:hover {
    background-color: var(--content-color, #ffffff);
    color: #1a1a1a;
    transform: translateY(-2px);
}

/* Outline Button */
.cta-btn-outline {
    background-color: transparent;
    color: var(--content-color, #ffffff);
    padding: 14px 32px;
    font-size: 16px;
    border: 2px solid var(--content-color, #ffffff);
}

.cta-btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* ========== CENTER LAYOUT ========== */

.cta-center .cta-content-center {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

/* ========== SPLIT LAYOUT (Left/Right) ========== */

.cta-left .cta-content-split,
.cta-right .cta-content-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
}

.cta-left .cta-content-split {
    flex-direction: row;
}

.cta-right .cta-content-split {
    flex-direction: row-reverse;
}

.cta-left .cta-content-split .cta-editor,
.cta-right .cta-content-split .cta-editor {
    flex: 1;
}

.cta-left .cta-content-split .cta-btn,
.cta-right .cta-content-split .cta-btn {
    flex-shrink: 0;
}

/* ========== EDITOR STYLES ========== */

.cta-editor {
    color: var(--content-color);
}

.cta-editor h1,
.cta-editor h2,
.cta-editor h3,
.cta-editor h4,
.cta-editor h5,
.cta-editor h6 {
    font-weight: 700;
    margin: 0 0 20px 0;
    line-height: 1.2;
    color: var(--content-color);
}

.cta-editor h1 { font-size: 52px; letter-spacing: -1px; }
.cta-editor h2 { font-size: 42px; letter-spacing: -0.5px; }
.cta-editor h3 { font-size: 36px; }
.cta-editor h4 { font-size: 28px; }
.cta-editor h5 { font-size: 22px; }
.cta-editor h6 { font-size: 18px; }

.cta-editor p {
    font-size: 18px;
    font-weight: 400;
    line-height: 1.7;
    margin: 0 0 20px 0;
    opacity: 0.95;
}

.cta-editor p:last-child {
    margin-bottom: 0;
}

.cta-editor strong {
    font-weight: 600;
}

.cta-editor ul,
.cta-editor ol {
    margin: 0 0 20px 0;
    padding-left: 24px;
}

.cta-editor li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.cta-editor a {
    color: var(--content-color);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.3s ease;
}

.cta-editor a:hover {
    opacity: 0.8;
}

.cta-editor *:last-child {
    margin-bottom: 0;
}

/* ========== MOBILE VIDEO SWITCH ========== */

@media (max-width: 768px) {
    /* Hide desktop video on mobile */
    .cta-video-desktop {
        display: none !important;
    }
    
    /* Show mobile video on mobile */
    .cta-video-mobile {
        display: block !important;
    }
    
    /* Stronger overlay on mobile for better text readability */
    .cta-section.has-video-bg .cta-overlay {
        background-color: rgba(0, 0, 0, 0.6) !important;
    }
}

/* ========== RESPONSIVE ========== */

@media (max-width: 968px) {
    .cta-section {
        padding: 80px 0;
    }
    
    .cta-editor h1 { font-size: 42px; }
    .cta-editor h2 { font-size: 34px; }
    .cta-editor h3 { font-size: 30px; }
    .cta-editor p { font-size: 17px; }
    
    .cta-left .cta-content-split,
    .cta-right .cta-content-split {
        flex-direction: column !important;
        gap: 32px;
        text-align: center;
    }
    
    .cta-left .cta-content-split .cta-btn,
    .cta-right .cta-content-split .cta-btn {
        width: auto;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .cta-section {
        padding: 60px 0;
        background-attachment: scroll; /* Better mobile performance */
    }
    
    .cta-container {
        padding: 0 20px;
    }
    
    .cta-editor h1 { font-size: 32px; }
    .cta-editor h2 { font-size: 28px; }
    .cta-editor h3,
    .cta-editor h4,
    .cta-editor h5,
    .cta-editor h6 { font-size: 24px; }
    
    .cta-editor p {
        font-size: 16px;
        line-height: 1.6;
    }
    
    .cta-content-center,
    .cta-content-split {
        gap: 28px;
    }
    
    .cta-btn {
        width: 100%;
        text-align: center;
    }
    
    .cta-btn-primary {
        padding: 14px 24px;
        font-size: 16px;
    }
    
    .cta-btn-secondary {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .cta-buttons-group {
        flex-direction: column;
        width: 100%;
        gap: 15px;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .cta-section {
        padding: 40px 0;
    }
    
    .cta-editor h1 { font-size: 28px; }
    .cta-editor h2 { font-size: 24px; }
    .cta-editor h3,
    .cta-editor h4,
    .cta-editor h5,
    .cta-editor h6 { font-size: 22px; }
}

/* Performance: Reduce motion if user prefers */
@media (prefers-reduced-motion: reduce) {
    .cta-video {
        display: none !important;
    }
    
    .cta-video-fallback {
        display: block !important;
    }
}

/* CTA secondary button with transparency */
.cta-section .cta-secondary {
    background-color: transparent;
    border: 1px solid var(--main-color);
    backdrop-filter: blur(7px);
}

/* Typing Animation Styles */
.cta-editor h2 {
    position: relative;
    display: inline-block;
    min-height: 1.2em;
}

.typing-text {
    color: var(--content-color, #ffffff);
}

.typing-cursor {
    display: inline-block;
    color: var(--main-color, #c4082e);
    font-weight: 300;
    animation: blinkCursor 0.8s infinite;
    margin-left: 2px;
}

@keyframes blinkCursor {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* Optional: Add a subtle glow effect to the cursor */
.typing-cursor {
    text-shadow: 0 0 10px rgba(196, 8, 46, 0.5);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .cta-editor h2 {
        font-size: 28px;
    }
    
    .typing-cursor {
        font-size: 28px;
    }
}