/**
 * Swift Whirlpool Frontend Popup Styles
 * Modern popup styling with animations and glassmorphism
 */

/* Base popup wrapper */
.sw-popup-wrapper {
    position: fixed;
    z-index: 999999;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sw-popup-wrapper.sw-active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

/* Stacking Support */
.sw-popups-stack {
    position: fixed;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    gap: 15px;
}

.sw-popups-stack .sw-popup-wrapper {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    pointer-events: auto;
    z-index: auto;
}

/* Stack Position classes */
.sw-stack-position-top-left {
    top: 20px;
    left: 20px;
    align-items: flex-start;
}

.sw-stack-position-top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
}

.sw-stack-position-top-right {
    top: 20px;
    right: 20px;
    align-items: flex-end;
}

.sw-stack-position-center-left {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    align-items: flex-start;
}

.sw-stack-position-center {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    align-items: center;
    justify-content: center;
}

.sw-stack-position-center-right {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    align-items: flex-end;
}

.sw-stack-position-bottom-left {
    bottom: 20px;
    left: 20px;
    align-items: flex-start;
    flex-direction: column-reverse;
}

.sw-stack-position-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
    flex-direction: column-reverse;
}

.sw-stack-position-bottom-right {
    bottom: 20px;
    right: 20px;
    align-items: flex-end;
    flex-direction: column-reverse;
}

/* Individual Position classes (fallback for non-stacked or legacy) */
.sw-position-top-left {
    top: 20px;
    left: 20px;
    align-items: flex-start;
    justify-content: flex-start;
}

.sw-position-top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    justify-content: center;
}

.sw-position-top-right {
    top: 20px;
    right: 20px;
    align-items: flex-start;
    justify-content: flex-end;
}

.sw-position-center-left {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    align-items: center;
    justify-content: flex-start;
}

.sw-position-center {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    align-items: center;
    justify-content: center;
}

.sw-position-center-right {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    align-items: center;
    justify-content: flex-end;
}

.sw-position-bottom-left {
    bottom: 20px;
    left: 20px;
    align-items: flex-end;
    justify-content: flex-start;
}

.sw-position-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    justify-content: center;
}

.sw-position-bottom-right {
    bottom: 20px;
    right: 20px;
    align-items: flex-end;
    justify-content: flex-end;
}

/* Overlay */
.sw-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sw-popup-wrapper.sw-active .sw-overlay {
    opacity: 1;
}

/* Popup container */
.sw-popup {
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

/* Style 2: Inline Row Layout (70/30 split) */
.sw-inline-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 15px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.sw-inline-row>.sw-desc {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    margin-bottom: 0 !important;
}

.sw-inline-row>div:last-child,
.sw-inline-row>.sw-btn {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    max-width: 35% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Close button */
.sw-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    color: inherit;
    cursor: pointer;
    transition: transform 0.2s ease;
    z-index: 10;
}

.sw-close-btn:hover {
    background: transparent !important;
    transform: scale(1.1);
}

.sw-close-btn:focus {
    outline: none !important;
    box-shadow: none !important;
}

.sw-close-btn svg {
    width: 20px;
    height: 20px;
}

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

/* Fade In */
@keyframes sw-fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.sw-animation-fadeIn {
    animation: sw-fadeIn 0.3s ease forwards;
}

/* Fade Out */
@keyframes sw-fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.sw-animation-fadeOut {
    animation: sw-fadeOut 0.3s ease forwards;
}

/* Slide In Up */
@keyframes sw-slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sw-animation-slideInUp {
    animation: sw-slideInUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Slide In Down */
@keyframes sw-slideInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sw-animation-slideInDown {
    animation: sw-slideInDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Slide In Left */
@keyframes sw-slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sw-animation-slideInLeft {
    animation: sw-slideInLeft 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Slide In Right */
@keyframes sw-slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sw-animation-slideInRight {
    animation: sw-slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Slide Out variations */
@keyframes sw-slideOutUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-50px);
    }
}

.sw-animation-slideOutUp {
    animation: sw-slideOutUp 0.3s ease forwards;
}

@keyframes sw-slideOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(50px);
    }
}

.sw-animation-slideOutDown {
    animation: sw-slideOutDown 0.3s ease forwards;
}

/* Zoom In */
@keyframes sw-zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.sw-animation-zoomIn {
    animation: sw-zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Zoom Out */
@keyframes sw-zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

.sw-animation-zoomOut {
    animation: sw-zoomOut 0.3s ease forwards;
}

/* Bounce In */
@keyframes sw-bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

.sw-animation-bounceIn {
    animation: sw-bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Flip In */
@keyframes sw-flipIn {
    from {
        opacity: 0;
        transform: perspective(400px) rotateX(30deg);
    }

    to {
        opacity: 1;
        transform: perspective(400px) rotateX(0);
    }
}

.sw-animation-flipIn {
    animation: sw-flipIn 0.5s ease forwards;
}

/* ============================================
   TEMPLATE STYLES
   ============================================ */

/* Event Template */
.sw-template-event {
    text-align: left;
}

.sw-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
}

.sw-badge svg {
    width: 18px;
    height: 18px;
}

.sw-title {
    margin: 0 0 20px;
    font-size: var(--sw-heading-size, 28px);
    font-weight: 700;
    line-height: 1.2;
}

.sw-text {
    margin: 0 0 20px;
    font-size: var(--sw-body-size, 16px);
    opacity: 0.9;
    line-height: 1.6;
}

.sw-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.sw-meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
}

.sw-meta-item svg {
    opacity: 0.8;
    flex-shrink: 0;
}

/* Buttons */
.sw-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.sw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.sw-btn:hover {
    transform: scale(1.05);
}

.sw-btn-outline {
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.sw-btn-outline:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.sw-btn-solid {
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
}

.sw-btn-solid:hover {
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.sw-btn-text {
    background: transparent;
    color: inherit;
    padding: 14px 16px;
}

.sw-btn-text:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Newsletter Template */
.sw-template-newsletter {
    text-align: center;
}

.sw-template-newsletter .sw-title {
    font-size: 24px;
}

.sw-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.sw-form input[type="email"],
.sw-form input[type="text"] {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.sw-form input::placeholder {
    color: inherit;
    opacity: 0.6;
}

.sw-form input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.sw-form .sw-btn {
    width: 100%;
}

.sw-privacy {
    margin: 0;
    font-size: 12px;
    opacity: 0.7;
}

/* Promo Template */
.sw-template-promo {
    text-align: center;
}

.sw-template-promo .sw-badge {
    background: rgba(0, 0, 0, 0.2);
}

.sw-countdown {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.sw-countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.sw-countdown-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.sw-countdown-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

/* Exit Intent Template */
.sw-template-exit {
    text-align: center;
    padding: 20px;
}

.sw-template-exit .sw-title {
    font-size: 26px;
}

/* Cookie Template */
.sw-template-cookie {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding: 16px 24px;
}

.sw-cookie-content {
    flex: 1;
    min-width: 200px;
}

.sw-cookie-content p {
    margin: 0;
    font-size: 14px;
}

.sw-cookie-buttons {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.sw-cookie-buttons .sw-btn {
    padding: 10px 20px;
    font-size: 13px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .sw-popup-wrapper {
        padding: 16px;
    }

    .sw-position-top-left,
    .sw-position-top-right,
    .sw-position-bottom-left,
    .sw-position-bottom-right {
        left: 16px;
        right: 16px;
        top: auto;
        bottom: 16px;
        transform: none;
    }

    .sw-position-top-center,
    .sw-position-bottom-center {
        left: 16px;
        right: 16px;
        transform: none;
    }

    .sw-popup {
        width: 100% !important;
        max-width: none !important;
    }

    .sw-buttons {
        flex-direction: column;
    }

    .sw-btn {
        width: 100%;
    }

    .sw-countdown {
        gap: 12px;
    }

    .sw-countdown-value {
        font-size: 24px;
    }

    .sw-template-cookie {
        flex-direction: column;
        text-align: center;
    }

    .sw-cookie-buttons {
        width: 100%;
        flex-direction: column;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.sw-popup:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* sw-close-btn:focus removed to maintain clean look */

.sw-btn:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    .sw-popup,
    .sw-overlay,
    .sw-popup-wrapper {
        animation: none !important;
        transition: opacity 0.1s !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .sw-popup {
        border: 2px solid currentColor;
    }

    .sw-btn {
        border: 2px solid currentColor;
    }
}