

.popup-outer {
    position: fixed;
    bottom: 0;
    right: 0;
    max-height: calc(100dvh - 8rem);
    height: auto;
    width: 27.5dvw;
    max-width: 600px;
    border-radius: 24px 0 0 24px;
    z-index: 1000;
    background: #082944;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: visible;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.25);
    animation: popupSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                padding 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popupSlideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.popup-outer.closing {
    animation: popupSlideOut 0.4s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes popupSlideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

.popup-inner {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    flex: 1 1 auto;
    flex-direction: column;
    background: #082944;
    max-height: calc(90dvh - 7.5rem);
    min-height: 0;
    opacity: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 228, 238, 0.4) rgba(255, 255, 255, 0.05);
    box-sizing: border-box;
    padding: 0.5rem;
    transform-origin: bottom center;
    transition: max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s ease,
                transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.popup-inner::-webkit-scrollbar {
    width: 6px;
}

.popup-inner::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.popup-inner::-webkit-scrollbar-thumb {
    background: rgba(102, 228, 238, 0.4);
    border-radius: 3px;
}

.popup-inner::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 228, 238, 0.7);
}

.popup-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    transition: margin-bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.popup-header h2,
.popup-outer h2 {
    margin: 0;
    color: #66E4EE;
    font-weight: 700;
    font-size: 2rem !important;
}

.popup-minimise {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.popup-minimise svg {
    display: block;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.popup-outer.minimised .popup-minimise svg {
    transform: rotate(180deg);
}

.popup-outer.minimised .popup-inner,
.popup-inner.minimised {
    max-height: 0;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    margin: 0;
    overflow: hidden;
}

.popup-outer.minimised {
    height: auto;
    overflow-y: hidden;
}

.popup-outer.minimised .popup-header {
    margin-bottom: 0;
}

.popup-outer button.popup-close {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.popup-outer.minimised button.popup-close {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.6);
}

.popup-inner p {
    color: #fff;
    margin: 0 0 1rem 0;
    font-size: 1rem;
    flex-shrink: 0;
}

.popup-inner iframe {
    width: 100%;
    min-width: 100%;
    border: none;
    display: block;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* Shared close button appearance */
.popup-outer button.popup-close,
.popup-outer button.popup-close-thanks {
    width: 40px;
    height: 40px;
    background-image: url('data:image/svg+xml;utf8,<svg width="52" height="52" viewBox="0 0 52 52" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="26" cy="26" r="26" fill="white"/><line x1="11.978" y1="38.6073" x2="38.6081" y2="11.9772" stroke="black" stroke-width="2" stroke-linecap="round"/><line x1="13.3921" y1="11.9775" x2="40.0222" y2="38.6076" stroke="black" stroke-width="2" stroke-linecap="round"/></svg>');
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 0;
    color: transparent;
}

/* Outer close button (unsubmitted / form state) */
.popup-outer button.popup-close {
    position: absolute;
    top: -2.5rem;
    left: -2.5rem;
    z-index: 20;
}

/* Inner / Thanks close button (submitted state only) */
.popup-outer button.popup-close-thanks {
    display: none;
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 20;
}

/* Submitted state */
.popup-outer.submitted .popup-header,
.popup-outer.submitted .popup-inner p {
    display: none !important;
}

.popup-outer.submitted {
    display: block !important;
    height: auto !important;
    padding-top: 4rem;
    padding-bottom: 0 !important;
    padding-right: 0 !important;
    overflow: hidden !important;
}

.popup-outer.submitted .popup-inner {
    display: block !important;
    flex: none !important;
    height: auto !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    line-height: 0;
    font-size: 0;
}

.popup-outer.submitted .popup-inner::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.popup-outer.submitted .popup-inner iframe,
.popup-outer.submitted .popup-inner img {
    display: block !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    width: 100% !important;
}

.popup-outer.submitted button.popup-close {
    display: none !important;
}

.popup-outer.submitted button.popup-close-thanks {
    display: block !important;
}

/* Thanks countdown timer (submitted state only) */
.popup-outer .popup-timer {
    display: none;
    position: absolute;
    top: calc(1.25rem + 8px);
    left: 2rem;
    width: 24px;
    height: 24px;
    z-index: 20;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    cursor: pointer;
    border-radius: 50%;
    background: transparent;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.popup-outer .popup-timer:hover {
    transform: scale(1.08);
}

.popup-outer.submitted .popup-timer {
    display: flex !important;
}

.popup-outer.minimised .popup-timer {
    display: none !important;
}

.popup-timer-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    overflow: visible;
    pointer-events: none;
}

.popup-timer-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 3;
}

.popup-timer-progress {
    fill: none;
    stroke: #66E4EE;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 106.814;
    stroke-dashoffset: 106.814;
    filter: drop-shadow(0 0 2px rgba(102, 228, 238, 0.8));
    will-change: stroke-dashoffset;
}

.popup-timer-count {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    font-family: 'VWAGTheSansBold', 'VWAGTheSansRegular', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}
/* tablet */
@media (max-width: 1200px) { 

    .popup-outer{
        width: 45dvw;
        max-width: unset;
    }
}
/* mobile */
@media (max-width: 640px) {
    .popup {
        position: fixed;
        top: 0;
        left: 0;
        width: 100dvw;
        height: 100dvh;
        background: rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 999;
        transition: opacity 0.3s ease, background 0.3s ease;
    }

    .popup.closing {
        opacity: 0;
        pointer-events: none;
    }

    .popup:has(.popup-outer.minimised),
    .popup.minimised {
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        pointer-events: none;
    }

    .popup:has(.popup-outer.minimised) .popup-outer,
    .popup.minimised .popup-outer {
        pointer-events: auto;
    }

    .popup-outer {
        width: calc(100dvw - 2rem);
        max-width: 400px;
        padding: 1.5rem;
        max-height: 92dvh;
        height: auto;
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
        transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                    height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                    padding 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                    clip-path 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                    border-radius 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    /* Outer close button is hidden on mobile */
    .popup-outer button.popup-close {
        display: none !important;
    }

    .popup-inner {
        max-height: calc(92dvh - 6rem);
        box-sizing: border-box;
        padding-right: 0.75rem;
    }

    .popup-outer.submitted .popup-inner {
        display: block !important;
        flex: none !important;
        height: auto !important;
        max-height: calc(92dvh - 4.5rem);
        padding-right: 0 !important;
        padding-bottom: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 0 !important;
        overflow: hidden !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        line-height: 0;
        font-size: 0;
    }

    .popup-outer.submitted {
        display: block !important;
        height: auto !important;
        padding-top: 3.5rem;
        padding-bottom: 0 !important;
        padding-right: 0 !important;
        overflow: hidden !important;
    }

    /* Thanks close button positioned for mobile submitted view */
    .popup-outer.submitted button.popup-close-thanks {
        display: block !important;
        top: 1rem;
        left: 1rem;
        right: auto;
    }

    /* Thanks timer positioned for mobile submitted view */
    .popup-outer.submitted .popup-timer {
        display: flex !important;
        top: calc(1rem + 8px);
        right: 1.5rem;
        left: auto;
    }

    .popup-outer.minimised {
        width: 75px;
        height: 75px;
        padding: 0;
        border-radius: 0;
        clip-path: polygon(100% 0, 0 100%, 100% 100%);
        filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.4));
        cursor: pointer;
    }

    .popup-outer.minimised .popup-header {
        width: 100%;
        height: 100%;
        margin: 0;
    }

    .popup-outer.minimised .popup-header h2 {
        opacity: 0;
        pointer-events: none;
        width: 0;
        height: 0;
        overflow: hidden;
        margin: 0;
    }

    .popup-outer.minimised .popup-minimise {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: flex-end;
        justify-content: flex-end;
        padding-right: 30px;
        padding-bottom: 14px;
        box-sizing: border-box;
    }

    .popup-outer.minimised .popup-minimise svg {
        width: 22px;
        height: auto;
    }
}
