/* =========================================
   Ebook Lead Capture Modal (Glassmorphism)
   ========================================= */

.ebook-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 15, 30, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.ebook-modal.active {
    opacity: 1;
    visibility: visible;
}

.ebook-modal-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    width: 90%;
    max-width: 850px;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    position: relative;
    /* Anchor close button */
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ebook-modal.active .ebook-modal-content {
    transform: translateY(0) scale(1);
}

/* Close Button */
.ebook-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 32px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: color 0.3s;
    z-index: 10;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.ebook-close:hover {
    color: #ffffff;
}

/* Modal Left Side (Visual Hook) */
.ebook-visual {
    flex: 1;
    background: var(--gradient-brand);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.ebook-visual::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.1), transparent 60%);
    opacity: 0.5;
}

.ebook-visual h3 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.2;
    z-index: 1;
    color: #ffffff;
    /* High contrast against gradient */
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.ebook-visual p {
    font-size: 1.15rem;
    opacity: 1;
    /* Increased opacity for better contrast */
    color: #f8f9fa;
    /* Slightly off-white to remain soft but high contrast */
    line-height: 1.6;
    z-index: 1;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.ebook-visual .icon-wrapper {
    margin-bottom: 24px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Modal Right Side (Form) */
.ebook-form-wrapper {
    flex: 1.2;
    padding: 40px;
    background: rgba(25, 47, 93, 0.95);
    /* Ensure strong dark background */
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    /* For absolute positioning of the logo */
}

/* Modal Right Side Logo */
.modal-form-logo {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    /* Keep it subtle so it doesn't distract from the form */
    pointer-events: none;
    /* Prevent it from blocking clicks */
}

.modal-form-logo img {
    height: 40px;
    width: auto;
}

/* Adapting form inputs for dark context inside glass modal */
.ebook-form-wrapper .form-group input,
.ebook-form-wrapper .form-group textarea {
    background: rgba(255, 255, 255, 0.08);
    /* Slightly lighter background */
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* Stronger border */
    color: #ffffff;
    font-size: 1rem;
}

.ebook-form-wrapper .form-group input::placeholder,
.ebook-form-wrapper .form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.75);
    /* Better placeholder contrast */
}

.ebook-form-wrapper .form-group input:focus,
.ebook-form-wrapper .form-group textarea:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.ebook-form-wrapper .form-checkbox-group,
.ebook-form-wrapper .form-checkbox-group label {
    color: #ffffff;
    font-size: 0.95rem;
}

.ebook-form-wrapper .form-checkbox-group a {
    color: #fff;
    text-decoration: underline;
}

.ebook-form-wrapper .btn-primary {
    width: 100%;
    margin-top: 15px;
    font-weight: 600;
}

#ebook-status {
    margin-top: 15px;
    text-align: center;
    font-weight: 500;
}

/* Floating Action Button */
.floating-contact-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    background: var(--gradient-brand);
    background-size: 200% 200%;
    animation: gradientWave 5s ease infinite;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

@keyframes gradientWave {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Hide until intro animation is complete */
body:not(.intro-complete) .floating-contact-btn {
    opacity: 0;
    pointer-events: none;
    transform: translateY(50px);
}

/* Visibility controlled by JS based on scroll position */
.floating-contact-btn:not(.visible) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(50px);
}

.floating-contact-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.floating-contact-btn:hover {
    background: #ffffff;
    color: #000000;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 210, 190, 0.4);
}

.floating-contact-btn svg {
    width: 20px;
    height: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ebook-modal-content {
        flex-direction: column;
        max-height: 90vh;
        overflow-y: auto;
    }

    .ebook-visual {
        flex: none;
        padding: 24px 20px 16px 20px;
        text-align: center;
    }

    .ebook-visual h3 {
        font-size: 1.8rem;
        margin-bottom: 0px;
    }

    /* Hide supplementary text/icon on mobile to prioritize the form above the fold */
    .ebook-visual p,
    .ebook-visual .icon-wrapper {
        display: none;
    }

    .ebook-form-wrapper {
        flex: none;
        padding: 24px 20px 60px 20px;
        /* Reduced bottom padding slightly */
    }

    .ebook-form-wrapper .form-group {
        margin-bottom: 12px;
    }

    .modal-form-logo {
        bottom: 15px;
    }

    .modal-form-logo img {
        height: 30px;
        /* Make the watermark slightly smaller to save space */
    }

    .ebook-close {
        top: 10px;
        right: 15px;
        color: #fff;
    }

    .floating-contact-btn {
        bottom: 20px;
        right: 20px;
        padding: 10px 20px;
    }
}

/* =========================================
   Ebook Promo Section
   ========================================= */

.ebook-wrapper {
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(25, 47, 93, 0.05);
}

.ebook-content {
    flex: 1;
    padding: 60px;
}

.ebook-content h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 2.5rem;
}

.ebook-content .subtitle {
    margin-bottom: 24px;
    color: var(--text-secondary);
}

.ebook-content p {
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.ebook-visual-box {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.05), rgba(59, 130, 246, 0.05));
}

.ebook-mockup {
    width: 250px;
    height: 350px;
    background: var(--gradient-brand);
    background-size: 200% 200%;
    animation: gradientWave 5s ease infinite;
    border-radius: 8px 16px 16px 8px;
    /* Book shape */
    box-shadow: -5px 0 0 rgba(255, 255, 255, 0.2) inset, 20px 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    padding: 30px;
    position: relative;
    transform: perspective(800px) rotateY(-15deg);
    transition: transform 0.5s ease;
}

.ebook-wrapper:hover .ebook-mockup {
    transform: perspective(800px) rotateY(0deg) translateY(-10px);
}

.mockup-logo-container {
    width: 100%;
    text-align: center;
    margin-bottom: auto;
    /* Push content down */
    padding-top: 10px;
}

.mockup-logo {
    max-width: 80px;
    height: auto;
    filter: brightness(0) invert(1);
    /* Ensure the logo is pure white against the dark cover */
    opacity: 0.9;
}

.mockup-text-container {
    padding: 20px 0;
}

.mockup-title {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    color: #FFFFFF;
}

.mockup-subtitle {
    font-size: 0.85rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mockup-author {
    margin-top: auto;
    /* Push to bottom */
    width: 100%;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.mockup-author p {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.05em;
    margin: 0;
}

@media (max-width: 992px) {
    .ebook-wrapper {
        flex-direction: column;
    }

    .ebook-visual-box {
        width: 100%;
        padding: 40px;
    }
}