/* ==========================================================================
   1. FIGMA-STYLE NAVIGATION HEADER (Overrides Elementor Button styles)
   ========================================================================== */

/* Supporting both CLASS (.custom-nav-container) and ID (#custom-nav-container) for the horizontal container */
#custom-nav-container,
.custom-nav-container {
    border-bottom: 1px solid #000000 !important; /* Thin gray progress line matching Figma */
    padding-bottom: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end !important; /* Align everything perfectly to the bottom */
    justify-content: flex-start !important;
    gap: 40px !important;
}

/* Reset all Elementor inner wrappers to prevent them from pushing buttons away from the bottom line */
.custom-nav-item,
.custom-nav-item .elementor-widget-container,
.custom-nav-item .elementor-button-wrapper {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    display: inline-flex !important; /* Keeps container flex properties working */
    align-items: flex-end !important;
}

/* Force Elementor Buttons inside the container to look like sleek tab links */
.custom-nav-item .elementor-button {
    background-color: transparent !important;
    display: inline-block !important;
    border-bottom: 4px solid transparent !important;
}

.custom-nav-item .elementor-button,
.custom-nav-item .elementor-button:focus,
.custom-nav-item .elementor-button:hover, 
.custom-nav-item .elementor-button:visited {
    color: #253E5C;
}

/* Hover style for unlocked inactive buttons */
.custom-nav-item:not(.locked-nav-item) .elementor-button:hover {
    color: #253E5C !important;
}

/* ==========================================================================
   2. ACTIVE AND LOCKED STATES
   ========================================================================== */

/* Active tab style: dark slate bold text with vibrant blue underline matching Figma */
.active-nav .elementor-button, #custom-nav-container .active-nav .elementor-button, .custom-nav-container .active-nav .elementor-button {
    color: #253E5C !important;
    border-bottom: 4px solid #16ACE7 !important;
}

/* Locked tab style: greyed out, blurred, cursor indicating it is disabled */
.locked-nav-item .elementor-button,
#custom-nav-container .locked-nav-item .elementor-button,
.custom-nav-container .locked-nav-item .elementor-button {
    color: #253E5C50 !important;
    filter: blur(1.5px);
    cursor: not-allowed !important;
}

/* Override cursor on wrapper so entire widget displays "not-allowed" */
.locked-nav-item,
#custom-nav-container .locked-nav-item,
.custom-nav-container .locked-nav-item {
    cursor: not-allowed !important;
}

/* ==========================================================================
   3. CONTENT SECTIONS DEFAULT & REVEAL STATES
   ========================================================================== */

/* Hide subsequent content sections by default */
.locked-page-section {
    display: none !important;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Staggered reveal animations with a high-end upward glide */
.locked-page-section.reveal-section {
    display: block !important; /* Change to "flex" if you use modern Flexbox Containers */
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   4. FORM & SUCCESS CARD STYLING
   ========================================================================== */

/* Default state of the success message */
.custom-success-card {
    display: none !important;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hide form and show success message smoothly on submit */
.form-container-col.form-submitted .elementor-form {
    display: none !important;
}

.form-container-col.form-submitted .custom-success-card {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 1;
    transform: translateY(0);
}

.form-container-col.form-submitted .form-container-heading{
    display: none;
}

.custom-success-card .e-heading-base,
.custom-success-card .elementor-widget-text-editor {
   color: #FFFFFF;
}

/* ==========================================================================
   5. TOAST NOTIFICATION STYLING
   ========================================================================== */
.dilytics-toast-notice {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 999999;
    font-family: inherit;
    font-weight: 500;
    font-size: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: top 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
    opacity: 0;
}

.dilytics-toast-notice.show {
    top: 30px;
    opacity: 1;
}

.toast-icon {
    font-size: 18px;
    animation: toastBounce 1s infinite alternate;
}

@keyframes toastBounce {
    from { transform: translateY(0); }
    to { transform: translateY(-3px); }
}


/* ==========================================================================
   6. PREMIUM MOBILE DROPDOWN STYLING
   ========================================================================== */

/* Dropdown Container */
.custom-mobile-nav-wrapper {
    display: none; /* Hidden on desktop */
    position: relative;
    width: 100%;
    margin: 15px 0px 0px 0px;
    background: #F9F9F9;
    border: 1.5px solid #16ACE7;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

/* Dropdown Select Element */
.custom-mobile-nav-select {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    padding: 12px 15px;
    box-sizing: border-box;
}

/* Option Tag Custom Styling */
.custom-mobile-nav-select option {
    font-weight: 500;
    color: #334155;
    padding: 10px;
}

/* Custom Downward Chevron */
.custom-mobile-nav-arrow {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-mobile-nav-arrow svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: #16ace7;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Locked Option Tag (Indicate Lock visually) */
.custom-mobile-nav-select option.locked-option {
    color: #94a3b8;
}

/* Responsive CSS to hide Buttons and display Dropdown on Mobile */
@media (max-width: 767px) {
    .custom-mobile-nav-wrapper,
    .custom-nav-container  {
        display: block !important; 
    }


    /* Hide desktop button items but keep them in DOM for JS syncing */
    .custom-nav-container .custom-nav-item,
    #custom-nav-container .custom-nav-item {
        display: none !important;
    }

    .dilytics-toast-notice {
        width: calc(100% - 30px);
        padding: 10px 15px;
    }
}

/* ==========================================================================
   7. PREMIUM FORM SUBMIT OVERLAY LOADER
   ========================================================================== */

/* Outer form column/container becomes relative */
.form-container-col {
    position: relative;
}

/* Native smooth transition for form blur/fade during submit */
.form-container-col .elementor-form {
    transition: filter 0.4s ease, opacity 0.4s ease !important;
}

/* When submitting, blur and fade the form fields natively without covering it with a white block */
.form-container-col.form-submitting .elementor-form {
    filter: blur(3px) !important;
    opacity: 0.45 !important;
    pointer-events: none !important;
}

/* Loader overlay sits perfectly over the entire blue card container */
.dilytics-form-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent !important; /* No white box block! */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.dilytics-form-loader.show {
    opacity: 1;
    pointer-events: auto;
}

/* Circular spinning loader in white color to stand out beautifully on the blue background */
.dilytics-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #ffffff; /* Premium white spinner for maximum contrast on blue card */
    border-radius: 50%;
    animation: dilyticsSpin 1s linear infinite;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.dilytics-loader-text {
    margin-top: 15px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff; /* White text for premium contrast */
    letter-spacing: 0.5px;
    animation: dilyticsPulse 1.5s ease-in-out infinite alternate;
}

@keyframes dilyticsSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes dilyticsPulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* ==========================================================================
   8. PREMIUM ELEMENTOR FORM VALIDATION STYLING (For Blue Card container)
   ========================================================================== */

/* High-contrast, highly legible light rose/pink error text optimized for blue background */
.form-container-col .elementor-error-message {
    color: #ffccd3 !important; /* Premium light rose/pink text for legibility and standard error indication */
    font-size: 13px !important;
    font-weight: 600 !important;
    margin-top: 8px !important;
    display: block !important;
    text-align: left !important;
    letter-spacing: 0.2px !important;
}

/* Standout error field border to instantly guide the user's attention */
.form-container-col .elementor-field-group .elementor-error,
.form-container-col .elementor-field-group.has-error input {
    border: 2px solid #ff4d6a !important; /* Vibrant pinkish-red error border */
    background-color: rgba(255, 77, 106, 0.05) !important; /* Extremely subtle rose background tint */
    box-shadow: 0 0 10px rgba(255, 77, 106, 0.2) !important;
}

/* ==========================================================================
   9. COOKIE PERSISTED UNLOCKED STATES (For body.dilytics-unlocked)
   ========================================================================== */

/* Immediately reveal all sections on load */
body.dilytics-unlocked .locked-page-section {
    display: block !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Immediately restore locked navigation buttons style and pointer clicks */
body.dilytics-unlocked .locked-nav-item .elementor-button,
body.dilytics-unlocked #custom-nav-container .locked-nav-item .elementor-button,
body.dilytics-unlocked .custom-nav-container .locked-nav-item .elementor-button {
    color: #253E5C !important;
    filter: none !important;
    cursor: pointer !important;
}

body.dilytics-unlocked .locked-nav-item,
body.dilytics-unlocked #custom-nav-container .locked-nav-item,
body.dilytics-unlocked .custom-nav-container .locked-nav-item {
    cursor: pointer !important;
}

/* Immediately hide form and show success message card */
body.dilytics-unlocked .form-container-col .elementor-form {
    display: none !important;
}

body.dilytics-unlocked .form-container-col .custom-success-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    min-height: 380px !important;
}

body.dilytics-unlocked .form-container-col .form-container-heading {
    display: none !important;
}

/* ==========================================================================
   10. MOBILE FORM AUTO-HIDE SYSTEM
   ========================================================================== */
@media (max-width: 767px) {
    /* Setup transitions for the form container and its parent section for fluid collapse */
    .form-container-col,
    .elementor-section:has(.form-container-col),
    .e-con:has(.form-container-col) {
        transition: max-height 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
                    opacity 0.5s ease, 
                    padding 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
                    margin 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
        max-height: 2500px;
        overflow: hidden;
    }

    /* Phase 1: Just fade out the form container during submission (keep height to stabilize scroll) */
    .form-container-col.form-faded,
    .elementor-section:has(.form-container-col.form-faded),
    .e-con:has(.form-container-col.form-faded) {
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Phase 2: Completely collapse and hide once submitted (and not animating) or if already unlocked on load */
    .form-container-col.form-submitted,
    .elementor-section:has(.form-container-col.form-submitted),
    .e-con:has(.form-container-col.form-submitted),
    body.dilytics-unlocked:not(.dilytics-animating) .form-container-col,
    body.dilytics-unlocked:not(.dilytics-animating) .elementor-section:has(.form-container-col),
    body.dilytics-unlocked:not(.dilytics-animating) .e-con:has(.form-container-col) {
        max-height: 0 !important;
        opacity: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        border: none !important;
        pointer-events: none !important;
    }
}
