@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&display=swap');

:root {
    --primary-bg: #0A192F;
    --primary-accent: #00F5FF;
    --secondary-accent: #00A0B0;
    --text-color: #E6F1FF;
    --subtle-contrast: #D1C7B8;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
}

html.chat-fullscreen-active,
body.chat-fullscreen-active {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background-color: var(--primary-bg);
    color: var(--text-color);
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Account for fixed header height */
}

.page-wrapper {
    overflow-x: hidden;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    background: rgba(10, 25, 47, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 245, 255, 0.1);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-accent);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

nav ul li a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: var(--primary-accent);
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
    display: none;
    position: relative;
    z-index: 9999;
    background: transparent;
    border: 0;
    width: 2rem;
    height: 2rem;
    aspect-ratio: 1;
    padding: 0;
}

.mobile-nav-toggle .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.mobile-nav-toggle::before,
.mobile-nav-toggle::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text-color);
    transition: transform 0.3s ease, top 0.3s ease, bottom 0.3s ease;
}

.mobile-nav-toggle::before {
    top: 25%;
}

.mobile-nav-toggle::after {
    bottom: 25%;
}

.mobile-nav-toggle[aria-expanded="true"]::before {
    top: 50%;
    transform: rotate(45deg);
}

.mobile-nav-toggle[aria-expanded="true"]::after {
    bottom: 50%;
    transform: rotate(-45deg);
}

.scroll-section {
    height: 100vh;
}

/* Hero Section with Video */
.hero-section {
    position: relative;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    overflow: hidden;
    background-color: var(--primary-bg); /* Fallback for when video fails */
    background-image: url('images/Hero photo.jpeg');
    background-size: cover;
    background-position: center;
    z-index: 6; /* Ensure hero section stays on top of content below */
    height: 110vh; /* Make hero section full screen height on mobile */
}

.hero-video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translate(-50%, -50%);
    z-index: 1;
    object-position: 10% 50%;
    will-change: transform;
}

.radial-blur-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(2px);
    -webkit-mask-image: radial-gradient(circle, transparent 40%, black 70%);
    mask-image: radial-gradient(circle, transparent 40%, black 70%);
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 300px;
    background: linear-gradient(to top, var(--primary-bg) 8%, transparent);
    z-index: 3;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(10, 25, 47, 0.7) 30%, transparent 70%), rgba(10, 25, 47, 0.5);
    z-index: 4;
}

.hero-content {
    position: relative;
    z-index: 5;
    padding: 2rem;
    text-align: left;
    margin-left: 10%;
    max-width: 60%;
    will-change: transform, opacity;
}

.hero-content h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    margin: 0 0 1rem 0;
    color: var(--text-color);
    min-height: 7.5rem; /* Prevents layout shift during typewriter animation */
}

.hero-content p {
    font-size: 1.2rem;
    max-width: 1000px;
    margin: 0 0 2rem 0;
    color: var(--subtle-contrast);
    min-height: 2rem;
}

/* Buttons */
.cta-button {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    padding: 0.8rem 2.5rem;
    border-radius: 5px;
    transition: all 0.4s ease;
    opacity: 1;
}

.cta-button.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.cta-button:not(.secondary) {
    background-color: var(--primary-accent);
    color: var(--primary-bg);
}

.cta-button:not(.secondary):hover {
    box-shadow: 0 0 20px var(--primary-accent);
    transform: translateY(-3px);
}

.cta-button.secondary {
    background: transparent;
    border: 2px solid var(--secondary-accent);
    color: var(--secondary-accent);
}

.cta-button.secondary:hover {
    background-color: var(--secondary-accent);
    color: var(--primary-bg);
    box-shadow: 0 0 15px var(--secondary-accent);
}

/* General Content Section */
.content-section {
    position: relative;
    padding: 5rem 0;
    max-width: 1200px;
    margin: 0 auto;
    z-index: 5;
    background-color: var(--primary-bg);
}

.content-section h2 {
    font-family: var(--font-heading);
    font-size: 3rem;
    margin-bottom: 3rem;
    color: var(--primary-accent);
}

/* "How It Works" Section Specifics */
#how-it-works {
    max-width: none; /* Allow this section to be full-width */
    padding: 0;
}

#how-it-works > .section-content {
    padding: 4rem 2rem; /* Add vertical padding for spacing */
}

/* === New "Upgrade Your Business" Section Styles === */

.upgrade-business-layout {
    position: relative;
    width: 100%;
    height: 90vh; /* Re-adjusted height */
    overflow: hidden; /* To contain the absolute elements */
    display: flex;
    justify-content: center;
    align-items: center;
}

.upgrade-video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translate(-50%, -50%);
    z-index: 3;
    mix-blend-mode: lighten;
    opacity: 0.3; /* Control video brightness */
    will-change: transform;
}

.upgrade-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-bg) 0%, rgba(10, 25, 47, 0) 35%, rgba(10, 25, 47, 0) 80%, var(--primary-bg) 100%);
    z-index: 4;
}

.background-text {
    position: absolute;
    top: 44%; /* Re-centered vertically */
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5; /* Above the video overlay */
    text-align: center;
    width: 100%;
    pointer-events: none; /* Make it non-interactive */
    margin-top: 0; /* Removed margin */
    color: #FFFFFF;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 0 0 20px rgba(255, 255, 255, 0.3);
    will-change: transform;
}

.bg-text-line1 {
    font-family: var(--font-heading);
    font-size: clamp(10rem, 15vw, 10rem); /* Resized text */
    font-weight: 700;
    line-height: 1;
    margin-top: 1rem; /* Adjusted margin */
    color: #FFFFFF;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 0 0 20px rgba(255, 255, 255, 0.3);
}

.bg-text-line2 {
    font-family: 'Playfair Display', serif; /* Or another elegant serif */
    font-style: italic;
    font-size: clamp(4rem, 13vw, 9rem); /* Resized text */
    line-height: 1.2;
    margin-top: -1.5rem; /* Adjusted margin */
    color: #FFFFFF;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 0 0 20px rgba(255, 255, 255, 0.3);
}

.upgrade-card {
    position: absolute;
    z-index: 6; /* Above background text */
    background: rgba(20, 30, 48, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 2rem; /* Adjusted padding */
    width: 330px; /* Standardized width */
    color: var(--text-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    will-change: transform;
}

.upgrade-card h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    line-height: 1.5;
}

.upgrade-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--subtle-contrast);
}

.upgrade-card.card-1 {
    top: 0%;
    left: 4%;
}

.upgrade-card.card-2 {
    top: 44%;
    left: 7%;
}

.upgrade-card.card-3 {
    top: 30%;
    right: 5%;
}

@media (max-width: 1200px) {
    .upgrade-card {
        width: 300px;
    }
    .upgrade-card.card-1 { left: 5%; }
    .upgrade-card.card-2 { left: 15%; }
    .upgrade-card.card-3 { right: 5%; }
}

@media (max-width: 992px) {
    #how-it-works {
        margin-top: 50px; /* This creates space to prevent overlap with the hero section. Adjust as needed. */
    }

    .upgrade-business-layout {
        height: auto;
        padding: 4rem 2rem 4rem 2rem; /* Reduced top padding to move text up */
        flex-direction: column;
        align-items: center;
        gap: 2rem; /* Reduced gap between cards */
        position: relative;
        overflow: visible; /* Allow glowing text to be fully visible */
        margin-bottom: -290px; /* Pulls the following content up to close the gap. Adjust as needed. */
    }

    .upgrade-video,
    .upgrade-video-overlay {
        display: block;
    }

    .background-text {
        display: block;
        position: relative;
        z-index: 5;
        opacity: 1;
        pointer-events: auto;
        width: 100%; /* Use full width for proper centering */
        color: #FFFFFF;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 0 0 20px rgba(255, 255, 255, 0.3);
        margin-bottom: 0;
        text-align: center;
    }
    .bg-text-line1 {
        font-size: clamp(4.2rem, 13vw, 4.5rem); /* Increased font size */
        line-height: 1.2;
    }
    .bg-text-line2 {
        font-size: clamp(3.8rem, 11vw, 3.5rem); /* Increased font size */
        line-height: 1.1;
        margin-top: 0;
    }
    .upgrade-card {
        position: relative;
        z-index: 5;
        top: auto;
        left: auto;
        right: auto;
        width: 90%;
        max-width: 450px;
    }

    /* --- You can manually adjust individual card positions here for mobile --- */
    /* VERTICAL: Use top (e.g., top: -20px) to move UP. */
    /* HORIZONTAL: Use left (e.g., left: 10px) to move RIGHT. */
    /* SIZE: Use width (e.g., width: 95%) to change the size. */
    .upgrade-card.card-1 {
        top: -130px;
        width: 80%; 
        left: -25px;
    }
    .upgrade-card.card-2 {
        top: -175px;
        width: 80%;
        left: 25px;
    }
    .upgrade-card.card-3 {
        top: -230px;
        width: 80%;
        left: -20px;
    }

    .hero-content {
        margin-left: 5%;
        max-width: 80%;
    }

    .hero-content h1 {
        font-size: 2.5rem;
        min-height: 5rem;
    }

    .hero-content p {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .hide-on-mobile {
        display: none;
    }

    /* Hide video controls on mobile */
    video::-webkit-media-controls {
        display: none !important;
    }
    
    video::-webkit-media-controls-start-playback-button {
        display: none !important;
    }
    
    video::-webkit-media-controls-play-button {
        display: none !important;
    }
    
    video::-webkit-media-controls-panel {
        display: none !important;
    }
    
    video::-webkit-media-controls-enclosure {
        display: none !important;
    }
    
    /* Hide video controls for other browsers */
    video::-moz-media-controls {
        display: none !important;
    }
    
    video {
        pointer-events: none; /* Prevent clicking on video */
    }

    .hero-section::after {
        height: 100px; /* Make the bottom fade smaller on mobile */
    }

    body, html {
        scroll-padding-top: 70px; /* Adjust for smaller header */
    }

    header {
        backdrop-filter: blur(8px);
    }

    nav {
        padding: 1rem 1.5rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    nav ul {
        /* display: none; */ /* We now control this with a class */
        position: fixed;
        inset: 0; /* Make the menu panel fullscreen */
        flex-direction: column;
        justify-content: center; /* Center link vertically */
        align-items: center; /* Center link horizontally */
        padding: 0;
        margin: 0;
        background: var(--primary-bg);
        transform: translateY(-100%); /* Start hidden above the screen */
        transition: transform 350ms ease-out;
        z-index: 1000; /* Ensure menu is above header, but below menu button */
    }
    
    nav ul[data-visible="true"] {
        transform: translateY(0); /* Slide into view */
    }

    nav ul li {
        width: auto;
        border-bottom: none; /* Remove bottom border */
        opacity: 1; /* Make sure links are always visible */
        transform: none;
    }

    nav ul[data-visible="true"] li {
        opacity: 1;
        transform: none;
    }

    nav ul li a {
        font-size: 1.8rem; /* Larger font size for links */
        display: block;
        padding: 1rem;
    }
    
    .mobile-nav-toggle {
        display: block;
    }

    .hero-section {
        height: 100vh; /* Make hero section full screen height on mobile */
        justify-content: center; /* Re-center content block */
    }

    .hero-content {
        margin-left: 0;
        max-width: 90%;
        padding: 1.5rem;
        text-align: center; /* Re-center text */
        display: flex;
        flex-direction: column;
        align-items: center; /* Re-center items */
    }
    
    .hero-overlay {
        background: rgba(10, 25, 47, 0.75); /* Darker overlay for better text contrast on mobile */
    }

    .hero-content h1 {
        font-size: 2.2rem;
        min-height: 4rem;
        width: 100%; /* Force full width to prevent alignment jump */
    }

    .hero-content p {
        font-size: 1rem;
        width: 100%; /* Force full width to prevent alignment jump */
    }

    .content-section {
        padding: 4rem 1rem; /* Reduce horizontal padding slightly */
    }

    .upgrade-card {
        padding: 1.5rem; /* Reduced padding to make cards smaller */
    }

    .upgrade-card h3 {
        font-size: 1.15rem;
        margin-bottom: 0.8rem;
    }

    .upgrade-card p {
        font-size: 0.95rem; /* Increase paragraph size */
        line-height: 1.65; /* Adjust line height for readability */
    }

    .footer-main {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    .footer-cta {
        text-align: left;
    }
    .footer-bottom {
        flex-direction: column-reverse;
        align-items: flex-start;
    }
    .footer-legal-links a {
        margin-left: 0;
        margin-right: 1.5rem;
    }

    .footer-social {
        justify-content: flex-start;
    }
    
    .modal-form-content {
        padding: 2rem;
    }

    .chat-widget-container.is-fullscreen {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10000; /* Ensure it's on top of everything */
        background-color: var(--primary-bg); /* Explicitly set background */
    }

    body.chat-fullscreen-active header {
        z-index: 10001; /* Bring header above fullscreen chat */
    }
    
    .chat-widget-container.is-fullscreen .chat-box {
        height: 100%; /* Fill parent */
        box-sizing: border-box; /* Crucial for padding calculation */
        border-radius: 0;
        border: none;
        padding: 0 1rem 1rem 1rem; /* Left, Bottom, Right padding */
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .chat-widget-container.is-fullscreen .chat-messages {
        flex: 1; /* Take up all available space */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0; /* Padding is now on the parent .chat-box */
    }

    .chat-widget-container.is-fullscreen .chat-input-container {
        position: relative; /* Change from absolute */
        bottom: auto;
        left: auto;
        right: auto;
        padding: 1rem 0 0 0; /* Add space above the input */
        background: transparent;
    }

    /* Fix white bar issue in fullscreen mode */
    .chat-widget-container.is-fullscreen .chat-input-wrapper {
        background: rgba(230,241,255,0.08) !important;
        border: 1px solid rgba(0,245,255,0.25) !important;
    }

    .chat-widget-container.is-fullscreen #chat-input {
        background: transparent !important;
        color: var(--text-color) !important;
    }

    /* Ensure all elements in fullscreen have proper dark backgrounds */
    .chat-widget-container.is-fullscreen .chat-messages {
        background: transparent !important;
    }

    .chat-widget-container.is-fullscreen .message-content {
        background: rgba(230,241,255,0.08) !important;
        border: 1px solid rgba(0,245,255,0.2) !important;
    }

    .chat-widget-container.is-fullscreen .user-message .message-content {
        background: linear-gradient(135deg,var(--primary-accent) 0%, var(--secondary-accent) 100%) !important;
        border: none !important;
    }

    /* --- Mobile Chat Button Visibility --- */

    /* Hide both buttons by default on mobile */
    .chat-close-btn,
    .chat-fullscreen-btn {
        display: none;
    }

    /* Close button styling for fullscreen mode is handled below */

    /* Ensure no white backgrounds appear in fullscreen */
    .chat-widget-container.is-fullscreen * {
        background-color: transparent !important;
    }

    /* Then specifically set the backgrounds we want */
    .chat-widget-container.is-fullscreen .ai-message .message-content {
        background: rgba(230,241,255,0.08) !important;
    }

    .chat-widget-container.is-fullscreen .user-message .message-content {
        background: linear-gradient(135deg,var(--primary-accent) 0%, var(--secondary-accent) 100%) !important;
    }

    .chat-widget-container.is-fullscreen .chat-input-wrapper {
        background: rgba(230,241,255,0.05) !important;
    }

    /* Fix send button in fullscreen to maintain proper styling */
    .chat-widget-container.is-fullscreen .send-button {
        background: var(--primary-accent) !important;
        color: var(--primary-bg) !important;
    }

    .chat-widget-container.is-fullscreen .send-button:disabled {
        background: rgba(0,245,255,0.3) !important;
    }

    .chat-widget-container.is-fullscreen .send-button:hover:not(:disabled) {
        transform: scale(1.08) !important;
        box-shadow: 0 4px 12px rgba(0,245,255,0.3) !important;
    }
    
    /* Show the fullscreen button ONLY when chat is active but NOT fullscreen */
    .chat-widget-container.chat-active:not(.is-fullscreen) .chat-fullscreen-btn {
        display: block;
    }

    .chat-start-form input {
        font-size: 16px !important; /* Prevent iOS auto-zoom */
    }
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 2rem;
        min-height: 0; /* Allow it to wrap */
    }

    .hero-content p {
        font-size: 0.9rem;
    }

    .upgrade-business-layout {
        padding: 4rem 1rem;
    }

    .upgrade-card {
        width: 95%;
    }
    
    .chat-widget-container {
        min-height: 400px;
    }

    .chat-start-form, .chat-box {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .chat-messages {
        padding: 0 1rem 1rem 1rem;
    }

    .chat-input-container {
        padding: 1rem;
    }

    #chat-input {
        font-size: 0.9rem;
    }
    
    .footer-email {
        font-size: 1.5rem;
    }
}

/* Contact Section */
#contact {
    text-align: center;
}

#contact p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

/* Typewriter Cursor */
.typed-cursor {
    color: var(--primary-accent);
    font-weight: 700;
}

/* Footer */
footer {
    position: relative;
    padding: 5rem 2rem 2rem 2rem;
    color: var(--subtle-contrast);
    overflow: hidden;
}

.footer-video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translate(-50%, -50%);
    z-index: 1;
    mix-blend-mode: screen;
}

.footer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-bg);
    opacity: 0.9;
    z-index: 2;
}

.giant-text {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-heading);
    font-size: clamp(6rem, 22vw, 20rem);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.05);
    z-index: 3;
    pointer-events: none;
    line-height: 1;
}

.footer-content {
    position: relative;
    z-index: 4;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 4rem;
    flex-wrap: wrap;
}

.footer-tagline {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.footer-email {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
    word-break: break-all;
}

.footer-email:hover {
    color: var(--primary-accent);
}

.footer-cta {
    text-align: right;
    max-width: 300px;
}

.footer-cta-heading {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0 0.5rem 0;
}

.footer-cta p {
    margin: 0 0 1.5rem 0;
}

.footer-social {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    padding: 2rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.footer-social a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.footer-social a:hover {
    color: var(--primary-accent);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-legal-links a {
    color: var(--subtle-contrast);
    text-decoration: none;
    margin-left: 1.5rem;
    transition: color 0.3s ease;
}

.footer-legal-links a:hover {
    color: var(--text-color);
}

@media (max-width: 768px) {
    .footer-main {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    .footer-cta {
        text-align: left;
    }
    .footer-bottom {
        flex-direction: column-reverse;
        align-items: flex-start;
    }
    .footer-legal-links a {
        margin-left: 0;
        margin-right: 1.5rem;
    }
}

.section-bg-video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%; /* Set a width larger than the screen */
    height: 100%;
    object-fit: cover;
    transform: translate(-50%, -50%); /* Removed scale for better width control */
    z-index: 1;
    mix-blend-mode: screen;
}

.section-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-bg);
    opacity: 0.9;
    z-index: 2;
}

.section-content {
    position: relative;
    z-index: 3;
}

/* Contact Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 25, 47, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--primary-bg);
    padding: 0; /* Remove padding to allow video to fill corners */
    border-radius: 10px;
    border: 1px solid rgba(0, 245, 255, 0.2);
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden; /* Important to contain video within rounded corners */
}

.modal-video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.modal-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-bg);
    opacity: 0.95;
    z-index: 2;
}

.modal-form-content {
    position: relative;
    z-index: 3;
    padding: 2rem;
}

.modal-overlay.is-visible .modal-content {
    transform: translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    z-index: 4; /* Keep close button on top */
}

#contact-form .form-group {
    margin-bottom: 1.5rem;
}

#contact-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--subtle-contrast);
}

#contact-form input,
#contact-form textarea {
    width: 100%;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--secondary-accent);
    border-radius: 5px;
    color: var(--text-color);
    font-family: var(--font-body);
}

#contact-form input:focus,
#contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 10px var(--primary-accent);
}

#contact-form button {
    width: 100%;
    border: none;
}

/* === AI Chat Section Header === */
#ai-chat.section-content {
    /* This ensures the chat section lays on top of the section above it, preventing overlap issues on mobile */
    z-index: 10;
}

.chat-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative; /* Add position for z-index to work */
    z-index: 10; /* Make sure it's on top */
}

.chat-header p {
    font-size: 1.2rem;
    color: var(--subtle-contrast);
    max-width: 600px;
    margin: 0.25rem auto 0 auto;
}

/* === AI Chat Widget Container === */
.chat-widget-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    height: 480px; /* Use height instead of min-height for consistency */
    display: flex; /* Use flexbox to better control children */
    align-items: center;
    justify-content: center;
    z-index: 10; /* Make sure it's on top */
}

.chat-widget-container > div {
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
    width: 100%;
    height: 100%;
}

.chat-start-form {
    /* position: absolute; */ /* Remove absolute positioning */
    /* top: 50%; */
    /* left: 50%; */
    /* transform: translate(-50%, -50%); */
    width: 100%;
    transform: scale(1);
    opacity: 1;
}

.chat-box {
    position: absolute; /* Keep this absolute to layer it on top */
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

.chat-box h2,
.chat-start-form h2 {
    text-align: center;
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--primary-accent);
    margin: 0 0 1rem 0;
}

.chat-widget-container.chat-active .chat-start-form {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

.chat-widget-container.chat-active .chat-box {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* === OctaFlowAI Custom Chat Styles === */
.chat-bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    opacity: 0.1;
    mix-blend-mode: screen;
}

.chat-start-form {
    background: rgba(10,25,47,0.8);
    border: 1px solid rgba(0,245,255,0.25);
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center form content vertically */
    gap: 1.75rem; /* Increased gap for better spacing */
    box-shadow: 0 0 20px rgba(0,245,255,0.1);
    height: 100%; /* Make form and chat box same height */
}
.chat-start-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Add gap between label and input */
}
.chat-start-form label{
    font-family: var(--font-heading);
    color: var(--subtle-contrast);
    font-size:0.85rem;
    text-transform:uppercase;
}
.chat-start-form input{
    width:100%;
    padding:0.75rem 1rem;
    border-radius:6px;
    border:1px solid var(--secondary-accent);
    background:rgba(255,255,255,0.05);
    color:var(--text-color);
    font-family:var(--font-body);
}
.chat-start-form button {
    margin-top: 1rem; /* Add space above the button */
}
.chat-start-form input:focus{
    outline:none;
    border-color:var(--primary-accent);
    box-shadow:0 0 10px var(--primary-accent);
}

.chat-box{
    background:rgba(10,25,47,0.85);
    border:1px solid rgba(0,245,255,0.35);
    border-radius:16px;
    box-shadow:0 0 25px rgba(0,245,255,0.15);
    overflow:hidden;
    backdrop-filter:blur(8px);
    -webkit-backdrop-filter:blur(8px);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: 1.5rem; /* Add padding for the title */
}
.chat-box h2 {
    flex-shrink: 0;
    color: var(--primary-accent);
    margin: 0 0 1rem 0;
    padding: 0 1.5rem; /* Match messages padding */
}
.chat-messages{
    position: relative;
    z-index: 2;
    flex: 1;
    height: auto;
    overflow-y:auto;
    padding: 0 1.5rem 1.5rem 1.5rem; /* Adjust padding */
    display:flex;
    flex-direction:column;
    gap:1rem;
    scrollbar-width:thin;
    scrollbar-color:var(--primary-accent) transparent;
}
.chat-messages::-webkit-scrollbar{width:6px;}
.chat-messages::-webkit-scrollbar-thumb{background:var(--primary-accent);border-radius:3px;}
.message{display:flex;animation:fadeInUp 0.3s ease-out;}
.message.user-message{justify-content:flex-end;}
.message.ai-message{justify-content:flex-start;}
.message-content{max-width:70%;padding:0.4rem 1.2rem;border-radius:14px;font-size:0.95rem;line-height:1.4;}
.user-message .message-content{background:linear-gradient(135deg,var(--primary-accent) 0%, var(--secondary-accent) 100%);color:var(--primary-bg);border-bottom-right-radius:6px;}
.ai-message .message-content{background:rgba(230,241,255,0.08);color:var(--text-color);border:1px solid rgba(0,245,255,0.2);border-bottom-left-radius:6px;}

/* AI message formatting */
.ai-message .message-content p {
    margin: 0.5em 0;
}

.ai-message .message-content p:first-child {
    margin-top: 0;
}

.ai-message .message-content p:last-child {
    margin-bottom: 0;
}

.ai-message .message-content ul.bullet-list {
    list-style: none;
    padding: 0;
    margin: 0.5em 0;
}

.ai-message .message-content ul.bullet-list li {
    padding-left: 1.2em;
    position: relative;
    margin-bottom: 0.3em;
    line-height: 1.4;
}

.ai-message .message-content ul.bullet-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-accent);
}

.ai-message .message-content ul.bullet-list:first-child {
    margin-top: 0;
}

.ai-message .message-content ul.bullet-list:last-child {
    margin-bottom: 0;
}

.message.typing-indicator .message-content {
    background: transparent;
    border: none;
}

.chat-input-container{
    position: relative;
    z-index: 2;
    padding:1.25rem;
    border-top:1px solid rgba(0,245,255,0.15);
    background:rgba(10,25,47,0.6);
    flex-shrink: 0;
} 
.chat-input-wrapper{display:flex;gap:0.5rem;align-items:center;background:rgba(230,241,255,0.05);border:1px solid rgba(0,245,255,0.25);border-radius:25px;padding:0.5rem 1rem;transition:border-color 0.3s ease;} 
.chat-input-wrapper:focus-within{border-color:var(--primary-accent);box-shadow:0 0 12px rgba(0,245,255,0.25);} 
#chat-input{flex:1;background:transparent;border:none;outline:none;color:var(--text-color);font-size:1rem;font-family:var(--font-body);} 
#chat-input::placeholder{color:var(--subtle-contrast);opacity:0.7;} 
.send-button{background:var(--primary-accent);border:none;border-radius:50%;width:42px;height:42px;display:flex;align-items:center;justify-content:center;color:var(--primary-bg);cursor:pointer;transition:all 0.3s ease;} 
.send-button:disabled{background:rgba(0,245,255,0.3);cursor:not-allowed;} 
.send-button:hover:not(:disabled){transform:scale(1.08);box-shadow:0 4px 12px rgba(0,245,255,0.3);} 

.typing-indicator{display:none;justify-content:center;padding-top:0.75rem;} 
.typing-indicator.show{display:flex;} 
.typing-dots{display:flex;gap:4px;} 
.typing-dots span{width:8px;height:8px;border-radius:50%;background:var(--primary-accent);animation:typing 1.4s infinite ease-in-out;} 
.typing-dots span:nth-child(1){animation-delay:-0.32s;} 
.typing-dots span:nth-child(2){animation-delay:-0.16s;} 

@keyframes typing{0%,80%,100%{transform:scale(0.8);opacity:0.5;}40%{transform:scale(1);opacity:1;}} 
@keyframes fadeInUp{from{opacity:0;transform:translateY(20px);}to{opacity:1;transform:translateY(0);} }

/* Loading dots animation for start chat button */
.loading-dots {
    display: inline-block;
}

.loading-dots span {
    animation: loadingDots 1.4s infinite ease-in-out;
    opacity: 0.4;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes loadingDots {
    0%, 80%, 100% {
        opacity: 0.4;
    }
    40% {
        opacity: 1;
    }
}

/* --- FIX: make typing dots visible --- */
.message.typing-indicator{
    display:flex;          /* override the old display:none */
}

/* This rule specifically targets desktop screens to fix the hero alignment */
@media (min-width: 993px) {
    .hero-section {
        justify-content: flex-start;
    }
}

.chat-fullscreen-btn {
    display: none; /* Hide by default on desktop */
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    z-index: 5;
    padding: 0;
}

.chat-fullscreen-btn svg {
    width: 24px;
    height: 24px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.chat-fullscreen-btn:hover svg {
    opacity: 1;
}

@media (max-width: 768px) {
    /* When chat is active but NOT fullscreen on mobile, show the fullscreen button */
    .chat-widget-container.chat-active:not(.is-fullscreen) .chat-fullscreen-btn {
        display: block;
    }
    
    /* Close button is handled by the general fullscreen rule above */
}

.chat-close-btn {
    display: none; /* Hide on desktop by default */
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 6;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* When the close button is shown, make it flex */
.chat-widget-container.is-fullscreen .chat-close-btn {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    background: transparent !important;
    position: absolute !important;
    top: 1rem !important;
    right: 1rem !important;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-accent);
}
