/* ============================================
   Popup Templates – Frontend CSS v1.3.0
   Mobile-first, all devices
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700&display=swap');

/* ── Overlay ─────────────────────────────── */
/* CRITICAL: NO display:flex !important here — JS controls display */
.pt-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: var(--pt-overlay-bg, rgba(0,0,0,0.75));
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 12px 12px;
    box-sizing: border-box;
}

/* When JS sets display:flex via showPopup() */
.pt-overlay.pt-visible {
    display: flex !important;
    animation: ptFadeIn 0.28s ease forwards;
}

@keyframes ptFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Popup wrapper — close btn anchors to this ── */
.pt-popup-wrap {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* ── Close button — top-right corner, just outside popup ── */
.pt-close {
    position: absolute;
    /* sits just above the top-right of the popup card */
    top: -20px;
    right: 0;
    z-index: 1000001;
    width: 40px;
    height: 40px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.55);
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    pointer-events: auto;
    box-shadow: 0 3px 12px rgba(0,0,0,0.5);
    transition: background 0.15s, transform 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.pt-close:hover {
    background: rgba(239, 68, 68, 0.95);
    border-color: rgba(255,255,255,0.9);
    transform: scale(1.1);
}

.pt-close:focus {
    outline: 3px solid rgba(255,255,255,0.7);
    outline-offset: 2px;
}

.pt-close:active {
    transform: scale(0.93);
}

/* ── Popup card ──────────────────────────── */
.pt-popup {
    position: relative;
    width: 100%;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.55);
    animation: ptSlideUp 0.36s cubic-bezier(0.34, 1.5, 0.64, 1) forwards;
    max-height: calc(95vh - 72px);
    display: flex;
    flex-direction: column;
    /* Does NOT capture clicks outside itself */
}

@keyframes ptSlideUp {
    from { transform: translateY(36px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* ── Image ───────────────────────────────── */
.pt-popup-image {
    width: 100%;
    flex-shrink: 0;
    overflow: hidden;
}

.pt-popup-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* ── Newsletter ──────────────────────────── */
.pt-newsletter-form { padding: 12px 16px 0; }

.pt-email-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #1a1d27;
    background: #f8f9fc;
    transition: border-color 0.15s;
}

.pt-email-input:focus {
    border-color: #6c63ff;
    outline: none;
    background: #fff;
}

/* ── Buttons ─────────────────────────────── */
.pt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px 14px;
    justify-content: center;
    background: #fff;
}

.pt-btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 13px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    min-height: 48px;
    flex: 1 1 130px;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(0,0,0,0.18);
}

.pt-btn-action:hover  { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.28); }
.pt-btn-action:active { transform: translateY(0); }
.pt-btn-icon { font-size: 16px; flex-shrink: 0; }

/* ── Responsive ──────────────────────────── */

/* Mobile < 480px */
@media (max-width: 479px) {
    .pt-overlay {
        padding: 16px 8px 8px;
        justify-content: flex-end;
    }

    .pt-close {
        top: -18px;
        right: 0;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .pt-popup {
        border-radius: 18px 18px 10px 10px;
        max-height: calc(90vh - 30px);
        animation: ptSlideUpMobile 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
    }

    @keyframes ptSlideUpMobile {
        from { transform: translateY(56px); opacity: 0.5; }
        to   { transform: translateY(0);    opacity: 1; }
    }

    .pt-buttons {
        flex-direction: column;
        padding: 10px 10px 12px;
    }

    .pt-btn-action {
        flex: none;
        width: 100%;
        font-size: 16px;
        padding: 15px 20px;
    }
}

/* Tablet 480–767px */
@media (min-width: 480px) and (max-width: 767px) {
    .pt-btn-action { flex: 1 1 120px; font-size: 14px; }
}

/* Short screens */
@media (max-height: 600px) {
    .pt-popup { overflow-y: auto; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .pt-overlay, .pt-popup { animation: none !important; }
}
