/* ============================================================
   PROMO POPUP
   12 Layouts, 4 Animations, Brand Colors, Breakpoint 767px
============================================================ */

/* --- Variables & Base --- */

.wa-popup-promo {
    --pp-main: #495e77;
    --pp-secondary: #769DC1;
    --pp-bg: #e5eaee;
    --pp-text: #495e77;
    --pp-white: #fff;

    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    pointer-events: none;
}

.wa-popup-promo[aria-hidden="false"] {
    visibility: visible;
    pointer-events: auto;
}

/* --- Overlay --- */

.wa-popup-overlay {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.35s ease;
    cursor: default;
    pointer-events: auto;
}

.wa-popup-promo[aria-hidden="false"] .wa-popup-overlay {
    opacity: 1;
}

/* --- Container --- */

.wa-popup-container {
    position: relative;
    z-index: 1;
    width: 92%;
    background: var(--pp-white);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    transform-origin: center center;
}

/* --- Close Button --- */

.wa-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--pp-bg);
    color: var(--pp-main);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    backdrop-filter: blur(4px);
}

.wa-popup-close:hover {
    background: rgba(255, 255, 255, 0.85);
    color: var(--pp-main);
    transform: scale(1.08);
}

.wa-popup-close:focus-visible {
    outline: 2px solid var(--pp-secondary);
    outline-offset: 2px;
}

/* --- Inner layout --- */

.wa-popup-inner {
    display: flex;
    flex-direction: column;
}

/* --- Image --- */

.wa-popup-image {
    overflow: hidden;
    line-height: 0;
}

.wa-popup-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Content --- */

.wa-popup-content {
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.wa-popup-title {
    margin: 0 0 8px;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--pp-main);
}

.wa-popup-subtitle {
    margin: 0 0 16px;
    font-size: 1rem;
    color: var(--pp-secondary);
    font-weight: 500;
}

.wa-popup-description {
    margin: 0 0 24px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--pp-text);
}

.wa-popup-description p:last-child {
    margin-bottom: 0;
}

/* --- CTA Buttons --- */

.wa-popup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.wa-popup-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.25s, color 0.25s, box-shadow 0.25s, transform 0.15s;
    cursor: pointer;
    line-height: 1.4;
    border: 2px solid transparent;
}

.wa-popup-cta:hover {
    transform: translateY(-1px);
}

.wa-popup-cta:focus-visible {
    outline: 2px solid var(--pp-secondary);
    outline-offset: 2px;
}

.wa-popup-cta--primary {
    background: var(--pp-main);
    color: var(--pp-white);
    border-color: var(--pp-main);
}

.wa-popup-cta--primary:hover {
    background: var(--pp-secondary);
    border-color: var(--pp-secondary);
    color: var(--pp-white);
    box-shadow: 0 4px 16px rgba(73, 94, 119, 0.3);
}

.wa-popup-cta--secondary {
    background: var(--pp-bg);
    color: var(--pp-main);
    border-color: var(--pp-bg);
}

.wa-popup-cta--secondary:hover {
    background: var(--pp-secondary);
    border-color: var(--pp-secondary);
    color: var(--pp-white);
}

.wa-popup-cta--outline {
    background: transparent;
    color: var(--pp-main);
    border-color: var(--pp-secondary);
}

.wa-popup-cta--outline:hover {
    background: var(--pp-bg);
    border-color: var(--pp-main);
}

/* ============================================================
   CENTERED LAYOUTS
============================================================ */

/* --- Centered: Text Only --- */

.wa-popup-layout--centered-text-only {
    padding: 20px;
}

/* --- Centered: Image Top --- */

.wa-popup-layout--centered-image-top {
    padding: 20px;
}

.wa-popup-layout--centered-image-top .wa-popup-image {
    max-height: 260px;
}

/* --- Centered: Image Left --- */

.wa-popup-layout--centered-image-left {
    padding: 20px;
}

@media (min-width: 768px) {
    .wa-popup-layout--centered-image-left .wa-popup-inner {
        flex-direction: row;
    }

    .wa-popup-layout--centered-image-left .wa-popup-image {
        flex: 0 0 45%;
        max-width: 45%;
    }

    .wa-popup-layout--centered-image-left .wa-popup-content {
        flex: 1;
    }
}

/* --- Centered: Image Right --- */

.wa-popup-layout--centered-image-right {
    padding: 20px;
}

@media (min-width: 768px) {
    .wa-popup-layout--centered-image-right .wa-popup-inner {
        flex-direction: row-reverse;
    }

    .wa-popup-layout--centered-image-right .wa-popup-image {
        flex: 0 0 45%;
        max-width: 45%;
    }

    .wa-popup-layout--centered-image-right .wa-popup-content {
        flex: 1;
    }
}

/* --- Centered: Image Background --- */

.wa-popup-layout--centered-image-bg {
    padding: 20px;
}

.wa-popup-layout--centered-image-bg .wa-popup-container {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.wa-popup-layout--centered-image-bg .wa-popup-content {
    position: relative;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border-radius: 8px;
    margin: 24px;
}

/* ============================================================
   FULLSCREEN LAYOUTS
============================================================ */

/* --- Shared fullscreen base --- */

.wa-popup-layout--fullscreen-image-left,
.wa-popup-layout--fullscreen-image-right,
.wa-popup-layout--fullscreen-image-bg {
    padding: 0;
}

.wa-popup-layout--fullscreen-image-left .wa-popup-container,
.wa-popup-layout--fullscreen-image-right .wa-popup-container,
.wa-popup-layout--fullscreen-image-bg .wa-popup-container {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Fullscreen: Image Left --- */

@media (min-width: 768px) {
    .wa-popup-layout--fullscreen-image-left .wa-popup-inner {
        flex-direction: row;
        width: 100%;
        height: 100%;
    }

    .wa-popup-layout--fullscreen-image-left .wa-popup-image {
        flex: 0 0 50%;
        max-width: 50%;
        height: 100%;
    }

    .wa-popup-layout--fullscreen-image-left .wa-popup-content {
        flex: 1;
        padding: 48px;
    }
}

/* --- Fullscreen: Image Right --- */

@media (min-width: 768px) {
    .wa-popup-layout--fullscreen-image-right .wa-popup-inner {
        flex-direction: row-reverse;
        width: 100%;
        height: 100%;
    }

    .wa-popup-layout--fullscreen-image-right .wa-popup-image {
        flex: 0 0 50%;
        max-width: 50%;
        height: 100%;
    }

    .wa-popup-layout--fullscreen-image-right .wa-popup-content {
        flex: 1;
        padding: 48px;
    }
}

/* --- Fullscreen: Image Background --- */

.wa-popup-layout--fullscreen-image-bg .wa-popup-container {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.wa-popup-layout--fullscreen-image-bg .wa-popup-inner {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 20px;
}

.wa-popup-layout--fullscreen-image-bg .wa-popup-content {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    text-align: center;
    padding: 40px;
}

.wa-popup-layout--fullscreen-image-bg .wa-popup-actions {
    justify-content: center;
}

/* ============================================================
   SIDEBAR LAYOUTS
============================================================ */

.wa-popup-layout--sidebar-right {
    justify-content: flex-end;
    align-items: stretch;
    padding: 0;
}

.wa-popup-layout--sidebar-right .wa-popup-container {
    width: 420px;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0 !important;
    overflow-y: auto;
}

.wa-popup-layout--sidebar-left {
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
}

.wa-popup-layout--sidebar-left .wa-popup-container {
    width: 420px;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0 !important;
    overflow-y: auto;
}

.wa-popup-layout--sidebar-left .wa-popup-inner,
.wa-popup-layout--sidebar-right .wa-popup-inner {
    flex-direction: column;
}

.wa-popup-layout--sidebar-left .wa-popup-image,
.wa-popup-layout--sidebar-right .wa-popup-image {
    flex: none;
    max-width: 100%;
}

/* ============================================================
   BOTTOM BAR LAYOUTS
============================================================ */

/* --- Bottom Bar: Text Only --- */

.wa-popup-layout--bottom-bar {
    align-items: flex-end;
    padding: 0;
}

.wa-popup-layout--bottom-bar .wa-popup-container {
    width: 100%;
    max-width: none;
    border-radius: 0 !important;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.1);
    border-top: 3px solid var(--pp-secondary);
}

.wa-popup-layout--bottom-bar .wa-popup-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0;
}

.wa-popup-layout--bottom-bar .wa-popup-content {
    flex: 1;
    padding: 20px 24px 20px 32px;
}

.wa-popup-layout--bottom-bar .wa-popup-title {
    font-size: 1.15rem;
    margin-bottom: 4px;
}

.wa-popup-layout--bottom-bar .wa-popup-subtitle {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.wa-popup-layout--bottom-bar .wa-popup-description {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.wa-popup-layout--bottom-bar .wa-popup-actions {
    flex-shrink: 0;
    padding-right: 32px;
    flex-direction: row;
    gap: 10px;
}

.wa-popup-layout--bottom-bar .wa-popup-cta {
    padding: 10px 24px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.wa-popup-layout--bottom-bar .wa-popup-close {
    top: 50%;
    transform: translateY(-50%);
    right: 8px;
    width: 28px;
    height: 28px;
}

.wa-popup-layout--bottom-bar .wa-popup-close:hover {
    transform: translateY(-50%) scale(1.08);
}

/* --- Bottom Bar: With Image --- */

.wa-popup-layout--bottom-bar-image {
    align-items: flex-end;
    padding: 0;
}

.wa-popup-layout--bottom-bar-image .wa-popup-container {
    width: 100%;
    max-width: none;
    border-radius: 0 !important;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.1);
    border-top: 3px solid var(--pp-secondary);
}

.wa-popup-layout--bottom-bar-image .wa-popup-inner {
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 0;
}

.wa-popup-layout--bottom-bar-image .wa-popup-image {
    flex: 0 0 100px;
    max-width: 100px;
    height: 100px;
    margin-left: 24px;
    border-radius: 8px;
    overflow: hidden;
}

.wa-popup-layout--bottom-bar-image .wa-popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wa-popup-layout--bottom-bar-image .wa-popup-content {
    flex: 1;
    padding: 16px 0;
}

.wa-popup-layout--bottom-bar-image .wa-popup-title {
    font-size: 1.15rem;
    margin-bottom: 4px;
}

.wa-popup-layout--bottom-bar-image .wa-popup-subtitle {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.wa-popup-layout--bottom-bar-image .wa-popup-description {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.wa-popup-layout--bottom-bar-image .wa-popup-actions {
    flex-shrink: 0;
    padding-right: 32px;
    flex-direction: row;
    gap: 10px;
}

.wa-popup-layout--bottom-bar-image .wa-popup-cta {
    padding: 10px 24px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.wa-popup-layout--bottom-bar-image .wa-popup-close {
    top: 50%;
    transform: translateY(-50%);
    right: 8px;
    width: 28px;
    height: 28px;
}

.wa-popup-layout--bottom-bar-image .wa-popup-close:hover {
    transform: translateY(-50%) scale(1.08);
}

/* ============================================================
   ANIMATIONS
============================================================ */

/* --- Fade --- */

.wa-popup-anim--fade .wa-popup-container {
    opacity: 0;
    transition: opacity 0.35s ease;
}

.wa-popup-anim--fade[aria-hidden="false"] .wa-popup-container {
    opacity: 1;
}

/* --- Slide Up --- */

.wa-popup-anim--slide-up .wa-popup-container {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.wa-popup-anim--slide-up[aria-hidden="false"] .wa-popup-container {
    opacity: 1;
    transform: translateY(0);
}

/* --- Scale --- */

.wa-popup-anim--scale .wa-popup-container {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.wa-popup-anim--scale[aria-hidden="false"] .wa-popup-container {
    opacity: 1;
    transform: scale(1);
}

/* --- None --- */

.wa-popup-anim--none .wa-popup-container {
    transition: none;
}

/* --- Sidebar slide overrides --- */

.wa-popup-layout--sidebar-right .wa-popup-container {
    transform: translateX(100%);
    opacity: 1;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.wa-popup-layout--sidebar-right[aria-hidden="false"] .wa-popup-container {
    transform: translateX(0);
}

.wa-popup-layout--sidebar-left .wa-popup-container {
    transform: translateX(-100%);
    opacity: 1;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.wa-popup-layout--sidebar-left[aria-hidden="false"] .wa-popup-container {
    transform: translateX(0);
}

/* --- Bottom bar slide overrides --- */

.wa-popup-layout--bottom-bar .wa-popup-container,
.wa-popup-layout--bottom-bar-image .wa-popup-container {
    transform: translateY(100%);
    opacity: 1;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.wa-popup-layout--bottom-bar[aria-hidden="false"] .wa-popup-container,
.wa-popup-layout--bottom-bar-image[aria-hidden="false"] .wa-popup-container {
    transform: translateY(0);
}

/* ============================================================
   BODY SCROLL LOCK
============================================================ */

body.wa-popup-open {
    overflow: hidden;
    touch-action: none;
}

/* ============================================================
   RESPONSIVE (max-width: 767px)
============================================================ */

@media (max-width: 767px) {
    .wa-popup-container {
        width: 96%;
    }

    .wa-popup-content {
        padding: 24px 20px;
    }

    .wa-popup-title {
        font-size: 1.25rem;
    }

    .wa-popup-cta {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .wa-popup-actions {
        flex-direction: column;
    }

    .wa-popup-cta {
        width: 100%;
        text-align: center;
    }

    /* All side-by-side layouts stack on mobile */
    .wa-popup-layout--centered-image-left .wa-popup-inner,
    .wa-popup-layout--centered-image-right .wa-popup-inner,
    .wa-popup-layout--fullscreen-image-left .wa-popup-inner,
    .wa-popup-layout--fullscreen-image-right .wa-popup-inner {
        flex-direction: column;
    }

    .wa-popup-layout--centered-image-left .wa-popup-image,
    .wa-popup-layout--centered-image-right .wa-popup-image,
    .wa-popup-layout--fullscreen-image-left .wa-popup-image,
    .wa-popup-layout--fullscreen-image-right .wa-popup-image {
        flex: none;
        max-width: 100%;
        height: auto;
    }

    /* Mobile: image should not be cropped, show full height */
    .wa-popup-image {
        max-height: none;
    }

    .wa-popup-image img {
        height: auto;
        object-fit: contain;
    }

    /* Fullscreen stacks on mobile */
    .wa-popup-layout--fullscreen-image-left .wa-popup-container,
    .wa-popup-layout--fullscreen-image-right .wa-popup-container {
        overflow-y: auto;
    }

    .wa-popup-layout--fullscreen-image-left .wa-popup-content,
    .wa-popup-layout--fullscreen-image-right .wa-popup-content {
        padding: 24px 20px;
    }

    /* Bottom bars stack on mobile */
    .wa-popup-layout--bottom-bar .wa-popup-inner,
    .wa-popup-layout--bottom-bar-image .wa-popup-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .wa-popup-layout--bottom-bar .wa-popup-actions,
    .wa-popup-layout--bottom-bar-image .wa-popup-actions {
        padding: 0 20px 16px;
        flex-direction: column;
    }

    .wa-popup-layout--bottom-bar-image .wa-popup-image {
        margin-left: 0;
        flex: none;
        max-width: 100%;
        width: 100%;
        height: 120px;
        border-radius: 0;
    }

    .wa-popup-layout--bottom-bar .wa-popup-close,
    .wa-popup-layout--bottom-bar-image .wa-popup-close {
        top: 8px;
        transform: none;
    }

    .wa-popup-layout--bottom-bar .wa-popup-close:hover,
    .wa-popup-layout--bottom-bar-image .wa-popup-close:hover {
        transform: scale(1.08);
    }

    /* Sidebar takes full width on mobile */
    .wa-popup-layout--sidebar-left .wa-popup-container,
    .wa-popup-layout--sidebar-right .wa-popup-container {
        width: 100%;
    }
}
