@import url('reset.css');
@import url('utilities.css');
@import url('variables.css');
@import url('typography.css');
@import url('buttons.css');
@import url('forms.css');
@import url('forms-modal.css');

:root {
    /* Dynamic header heights for sticky positioning */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --header-padding-top: max(20px, var(--safe-area-top));
    --header-padding-bottom: 20px;
    --progress-bar-height: 20px;
    --fixed-button-height: 0px; /* Will be set dynamically by JavaScript */

    /* Desktop header height calculation */
    --header-height: calc(var(--header-padding-top) + 66px + var(--header-padding-bottom));
    --progress-top: var(--header-height);
    --total-sticky-height: calc(var(--header-height) + var(--progress-bar-height));
}

@media screen and (max-width: 767px) {
    :root {
        --header-padding-bottom: 12px;
        /* Recalculate for mobile */
        --header-height: calc(var(--header-padding-top) + 66px + var(--header-padding-bottom));
    }
}

html {
    scroll-behavior: smooth;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    flex: 0 0 100%;
    padding: 20px 35px 20px 42px;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 101;
    background-color: #ffffff;
}
.header__brand {
    display: flex;
    align-items: center;
    gap: 36px;
}
.header__logo {
    width: 137px;
    height: auto;
}
.header__title {
    font-size: 20px;
    letter-spacing: 0.16em;
    font-weight: 900;
    color: var(--color-blue-500);
}


.progress-container {
    position: sticky;
    top: var(--progress-top);
    z-index: 105;
    width: 100%;
    height: var(--progress-bar-height);
    background-color: var(--color-blue-700);
    display: flex;
    align-items: center;
}

progress {
    position: absolute;
    width: 100%;
    height: 20px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: var(--color-blue-700);
}

.progress-percentage {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    color: white;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1;
    text-transform: uppercase;
}

@media screen and (max-width: 767px) {
    .progress-percentage {
        font-size: 12px;
        right: 8px;
    }
}
/* Webkit (Chrome/Safari) */
progress::-webkit-progress-bar {
    background-color: var(--color-blue-700);
    border-radius: 0;
}
progress::-webkit-progress-value {
    background-color: var(--color-orange);
    border-radius: 0 5px 5px 0;
    transition: width 0.3s ease;
    min-width: 120px;
}

@media screen and (max-width: 767px) {
    progress::-webkit-progress-value {
        min-width: 100px;
    }
}
/* Firefox */
progress::-moz-progress-bar {
    background-color: var(--color-orange);
    border-radius: 0 5px 5px 0;
    min-width: 120px;
}

@media screen and (max-width: 767px) {
    progress::-moz-progress-bar {
        min-width: 100px;
    }
}

form.main {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
}

section.view {
    flex: 1 0 auto;
    display: flex;
}

.section__content {
    display: flex;
    flex-direction: column;
    flex: 0 0 705px;
    margin: 0 auto;
    padding: 30px 90px;
    max-width: 100%;
    min-height: calc(100vh - var(--total-sticky-height));
}
.section__content--home {
    padding-top: 60px;
    h1, h2, p {
        max-width: 470px;
    }
    h1 {
        margin-bottom: 10px;
    }
}

.section__content h3 {
    display: flex;
    align-items: center;
}

.section__img {
    flex: 1 1 50%;
    background: #87CEEB no-repeat center center / cover;
    position: relative;
    min-height: calc(100vh - var(--total-sticky-height));
}

/* Hide progress bar on 3D viewer screen for all devices */
.view--3d-viewer ~ .progress-container {
    display: none !important;
}

@media screen and (max-width: 1024px) {
    .header__title {
        display: none;
    }
    .section__img {
        display: none;
    }

    /* Mobile 3D Viewer Fixes */
    .view--3d-viewer {
        min-height: auto !important;
    }

    .view--3d-viewer__content-wrapper {
        flex: 1;
        display: flex;
        flex-direction: column;
        position: relative;
        padding: 0;
        background: #dbeaf5;
    }

    /* Hide the entire sidebar (quote box and details) on mobile */
    .section__content--3d-viewer {
        display: none !important;
        height: 0;
        padding: 0;
        margin: 0;
    }

    .pool-viewer-container {
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        height: calc(100vh - var(--header-height, 100px) - 52px);
        max-height: calc(100vh - var(--header-height, 100px) - 52px);
        position: relative;
    }

    .header--3d-viewer {
        padding: 16px 20px;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        gap: 12px;
        /* On mobile, stick directly under primary header since progress is hidden */
        top: var(--header-height);
    }

    .header--3d-viewer__left-block {
        flex: 0 0 auto;
    }

    .header--3d-viewer .btn--back {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 0.875rem;
    }

    /* Hide control instructions on mobile - only show back button */
    .header--3d-viewer__right-block {
        display: none !important;
    }
}


/* 3D Pool Viewer Layout */
.view--3d-viewer {
    flex-direction: column;
    min-height: 100vh;
}

.header--3d-viewer {
    flex: 0 0 auto;
    justify-content: start;
    padding: 18px 20px;
    background: var(--color-blue-850);
    color: var(--color-white);
    position: sticky;
    top: var(--header-height);
    z-index: 99;
}

.view--3d-viewer__content-wrapper {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: row;
}
.header--3d-viewer__left-block {
    align-self: flex-start;
    flex: 0 1 415px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header--3d-viewer__right-block {
    align-self: flex-start;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    white-space: nowrap;
}
.header--3d-viewer__control-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--color-white);
}
.header--3d-viewer .btn--back {
    background: transparent;
    color: var(--color-white);
    border: none;
    font-size: 1rem;
    font-weight: 900;
    padding: 0;
    letter-spacing: 0.08em;
    &::before {
        content: url('../img/icon_left-caret-circle.svg');
    }
}

.section__content--3d-viewer {
    padding: 0 !important;
    flex: 0 1 415px;
    margin: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-blue-750);
    p, a, li {
        font-family: 'Figtree', sans-serif;
        color: var(--color-white);
        text-decoration: none;
    }
}

.dashboard__quote-box {
    margin: 26px 20px 60px;
    max-width: 24rem;
    padding: 25px;
    background: var(--color-blue-850);
    border-radius: 8px;
}
.dashboard__quote-btn {
    display: inline-block;
    padding: 14px 28px;
    background-color: var(--color-orange);
    color: var(--color-white) !important;
    font-family: 'Figtree', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 30px;
    transition: background-color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}
.dashboard__quote-btn:hover {
    background-color: var(--color-orange-dark, #e55a2b);
    transform: translateY(-2px);
}
.dashboard__details {
    margin: 0 28px 48px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 24px 48px;
    padding: 0;
    list-style: none;
}
.dashboard__btn {
    padding-top: 24px;
    padding-bottom: 24px;
    background: var(--color-blue-850);
    border-radius: 0;
}

.pool-viewer-container {
    flex: 1 1 500px;
    position: relative;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pool-viewer-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================
   Pool Reveal Overlay - Celebratory Animation
   ============================================ */

.pool-reveal-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(165deg, var(--color-blue-850, #1a4d7c) 0%, var(--color-blue-700, #2d6da8) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    z-index: 100;
    opacity: 1;
    transition: opacity 1s ease-out;
    overflow: hidden;
}

.pool-reveal-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Orange accent burst effect */
.pool-reveal-sunburst {
    position: absolute;
    top: -30%;
    left: 50%;
    transform: translateX(-50%);
    width: 150%;
    height: 150%;
    background: radial-gradient(
        ellipse at center top,
        rgba(242, 101, 34, 0.3) 0%,
        rgba(242, 101, 34, 0.15) 25%,
        transparent 50%
    );
    animation: sunPulse 2s ease-in-out infinite;
}

@keyframes sunPulse {
    0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

/* Floating bubbles */
.pool-reveal-bubbles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.pool-reveal-bubbles span {
    position: absolute;
    bottom: -20px;
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 0.4) 40%,
        rgba(255, 255, 255, 0.1) 100%
    );
    border-radius: 50%;
    animation: bubbleFloat 3s ease-in-out infinite;
}

.pool-reveal-bubbles span:nth-child(1) { left: 10%; width: 20px; height: 20px; animation-delay: 0s; animation-duration: 2.5s; }
.pool-reveal-bubbles span:nth-child(2) { left: 25%; width: 14px; height: 14px; animation-delay: 0.3s; animation-duration: 3s; }
.pool-reveal-bubbles span:nth-child(3) { left: 40%; width: 24px; height: 24px; animation-delay: 0.6s; animation-duration: 2.8s; }
.pool-reveal-bubbles span:nth-child(4) { left: 55%; width: 12px; height: 12px; animation-delay: 0.2s; animation-duration: 3.2s; }
.pool-reveal-bubbles span:nth-child(5) { left: 70%; width: 18px; height: 18px; animation-delay: 0.5s; animation-duration: 2.6s; }
.pool-reveal-bubbles span:nth-child(6) { left: 85%; width: 16px; height: 16px; animation-delay: 0.8s; animation-duration: 2.9s; }
.pool-reveal-bubbles span:nth-child(7) { left: 15%; width: 10px; height: 10px; animation-delay: 1s; animation-duration: 3.1s; }
.pool-reveal-bubbles span:nth-child(8) { left: 60%; width: 22px; height: 22px; animation-delay: 0.4s; animation-duration: 2.7s; }
.pool-reveal-bubbles span:nth-child(9) { left: 35%; width: 8px; height: 8px; animation-delay: 0.7s; animation-duration: 3.3s; }
.pool-reveal-bubbles span:nth-child(10) { left: 80%; width: 14px; height: 14px; animation-delay: 0.1s; animation-duration: 2.4s; }

@keyframes bubbleFloat {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
        transform: translateY(-20px) scale(1);
    }
    90% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-400px) scale(0.8);
        opacity: 0;
    }
}

/* Wave at bottom */
.pool-reveal-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,60 C150,120 350,0 600,60 C850,120 1050,0 1200,60 L1200,120 L0,120 Z' fill='rgba(255,255,255,0.12)'/%3E%3C/svg%3E") repeat-x;
    background-size: 600px 50px;
    animation: waveMove 3s linear infinite;
}

.pool-reveal-wave::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,60 C150,120 350,0 600,60 C850,120 1050,0 1200,60 L1200,120 L0,120 Z' fill='rgba(255,255,255,0.08)'/%3E%3C/svg%3E") repeat-x;
    background-size: 600px 50px;
    animation: waveMove 4s linear infinite reverse;
    transform: translateY(8px);
}

@keyframes waveMove {
    0% { background-position-x: 0; }
    100% { background-position-x: 600px; }
}

/* Content container */
.pool-reveal-content {
    position: relative;
    z-index: 10;
    padding: 20px;
    animation: contentReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes contentReveal {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Headline */
.pool-reveal-overlay h2 {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 1rem 0;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: headlinePop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

@keyframes headlinePop {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Subtitle - orange pill button style */
.pool-reveal-overlay p {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: white;
    opacity: 0;
    animation: subtitleSlide 0.6s ease-out 0.4s forwards;
    background: var(--color-orange, #f26522);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(242, 101, 34, 0.4);
}

@keyframes subtitleSlide {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Only show overlay on mobile */
@media screen and (min-width: 1025px) {
    .pool-reveal-overlay {
        display: none;
    }
}

.pool-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 30px;
}

.pool-summary h3 {
    margin-bottom: 15px;
    color: var(--color-blue-700);
}

.pool-details {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pool-details li {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.pool-details li:last-child {
    border-bottom: none;
}

@media screen and (max-width: 1024px) {
    .view--3d-viewer__content-wrapper {
        flex-direction: column;
    }

    /* Hide the entire sidebar on mobile/tablet */
    .section__content--3d-viewer {
        display: none !important;
    }
}

@media screen and (max-width: 767px) {

    .progress-percentage {
        font-size: 12px;
    }

    .header--primary {
        padding-left: 28px;
        padding-right: 28px;
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: 12px;
    }
    .header__btn {
        font-size: 0.875rem;
        padding: 10px 20px;
    }
    .header--3d-viewer {
        padding: 12px 16px;
    }

    .header--3d-viewer .btn--back {
        font-size: 0.75rem;
    }
    .section__content {
        padding: 30px 28px;
    }
    .section__content--home {
        padding-top: 20px;
        padding-bottom: 20px;
    }
    /* Reduce font sizes on home screen to fit without scrolling */
    .section__content--home h2 {
        font-size: 1.5rem;
        margin-bottom: 12px;
    }
    .section__content--home p.p--large {
        font-size: 1.15rem;
        line-height: 1.5;
    }
    .section__content--home .form-group {
        margin-top: 12px;
    }
}

/* Animation for auto-selected features */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.4);
    }
    100% {
        transform: scale(1);
    }
}

/* Animation for auto-deselected features */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Fixed Next Button Container */
.fixed-next-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 50%; /* Take up left half of screen (content side) */
    max-width: 705px; /* Match section__content max-width to prevent overlap */
    background-color: #ffffff;
    z-index: 100;
    display: none; /* Hidden by default, shown by JavaScript when needed */
    padding: 20px 90px; /* 20px top/bottom, 90px left/right to match content area */
}

.fixed-next-container .btn {
    border-radius: 30px; /* Restore rounded corners */
    margin: 0;
    padding: 14px 24px; /* Reduced from 18px 28px */
    font-size: 1rem; /* Reduced from 1.25rem */
    width: 100% !important; /* Ensure button takes full width */
    display: block;
}

/* Responsive for mobile and tablet - full width since no aside image */
@media screen and (max-width: 1024px) {
    .fixed-next-container {
        width: 100%; /* Full width on mobile/tablet */
        padding: 20px 28px; /* Match mobile content padding */
    }
}