/**
 * PopFlow Pro — Frontend Popup Styles
 * Premium animations, glassmorphism, responsive design.
 *
 * @package PopFlow_Pro
 */

/* ═══════════════════════════════════════
   CSS CUSTOM PROPERTIES (set inline per popup)
   --pfp-bg, --pfp-text, --pfp-cta-bg, --pfp-cta-text,
   --pfp-overlay-color, --pfp-max-width, --pfp-radius
   ═══════════════════════════════════════ */

/* ═══════════════════════════════════════
   BASE POPUP CONTAINER
   ═══════════════════════════════════════ */

.pfp-popup {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Hidden state */
.pfp-popup[style*="display: none"] {
    pointer-events: none;
}

/* ═══════════════════════════════════════
   OVERLAY
   ═══════════════════════════════════════ */

.pfp-popup__overlay {
    position: fixed;
    inset: 0;
    background: var(--pfp-overlay-color, rgba(0, 0, 0, 0.6));
    z-index: -1;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ═══════════════════════════════════════
   MODAL TYPE
   ═══════════════════════════════════════ */

.pfp-popup--modal {
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pfp-popup--modal .pfp-popup__container {
    background: var(--pfp-bg, #ffffff);
    color: var(--pfp-text, #1a1a2e);
    max-width: var(--pfp-max-width, 560px);
    width: 100%;
    border-radius: var(--pfp-radius, 16px);
    position: relative;
    overflow: hidden;
}

/* ═══════════════════════════════════════
   FULLSCREEN TYPE
   ═══════════════════════════════════════ */

.pfp-popup--fullscreen {
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pfp-popup--fullscreen .pfp-popup__container {
    background: var(--pfp-bg, #ffffff);
    color: var(--pfp-text, #1a1a2e);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

.pfp-popup--fullscreen .pfp-popup__content {
    max-width: 640px;
    padding: 48px;
}

.pfp-popup--fullscreen .pfp-popup__title {
    font-size: 36px;
    line-height: 1.2;
}

/* ═══════════════════════════════════════
   SLIDE-IN TYPE
   ═══════════════════════════════════════ */

.pfp-popup--slide-in {
    bottom: 24px;
    right: 24px;
    max-width: var(--pfp-max-width, 380px);
    width: calc(100% - 48px);
}

.pfp-popup--slide-in.pfp-popup--bottom-left {
    right: auto;
    left: 24px;
}

.pfp-popup--slide-in .pfp-popup__container {
    background: var(--pfp-bg, #ffffff);
    color: var(--pfp-text, #1a1a2e);
    border-radius: var(--pfp-radius, 16px);
    position: relative;
    overflow: hidden;
}

/* ═══════════════════════════════════════
   FLOATING BAR TYPE
   ═══════════════════════════════════════ */

.pfp-popup--floating-bar {
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999998;
}

.pfp-popup--floating-bar.pfp-popup--top {
    bottom: auto;
    top: 0;
}

.pfp-popup--floating-bar .pfp-popup__container {
    background: var(--pfp-bg, #1a1a2e);
    color: var(--pfp-text, #ffffff);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 14px 24px;
    position: relative;
}

.pfp-popup--floating-bar .pfp-popup__content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    justify-content: center;
}

.pfp-popup--floating-bar .pfp-popup__body {
    margin: 0;
}

.pfp-popup--floating-bar .pfp-popup__body p {
    margin: 0;
}

.pfp-popup--floating-bar .pfp-popup__actions {
    margin: 0;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════
   NOTIFICATION TYPE
   ═══════════════════════════════════════ */

.pfp-popup--notification {
    bottom: 24px;
    right: 24px;
    max-width: 340px;
    width: calc(100% - 48px);
}

.pfp-popup--notification.pfp-popup--bottom-left {
    right: auto;
    left: 24px;
}

.pfp-popup--notification.pfp-popup--top-right {
    bottom: auto;
    top: 24px;
}

.pfp-popup--notification.pfp-popup--top-left {
    bottom: auto;
    top: 24px;
    right: auto;
    left: 24px;
}

.pfp-popup--notification .pfp-popup__container {
    background: var(--pfp-bg, #ffffff);
    color: var(--pfp-text, #1a1a2e);
    border-radius: var(--pfp-radius, 12px);
    position: relative;
    overflow: hidden;
    border-left: 4px solid var(--pfp-cta-bg, #6c5ce7);
}

/* ═══════════════════════════════════════
   POPUP CONTENT
   ═══════════════════════════════════════ */

.pfp-popup__container {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.05);
}

.pfp-popup--shadow .pfp-popup__container {
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25),
                0 8px 32px rgba(0, 0, 0, 0.12),
                0 0 0 1px rgba(255, 255, 255, 0.08);
}

.pfp-popup__content {
    padding: 32px;
}

.pfp-popup__title {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 12px 0;
    line-height: 1.3;
    letter-spacing: -0.3px;
    color: var(--pfp-text, #1a1a2e);
}

.pfp-popup__body {
    font-size: 15px;
    color: var(--pfp-text, #1a1a2e);
    opacity: 0.85;
    margin-bottom: 20px;
}

.pfp-popup__body p {
    margin: 0 0 10px 0;
}

.pfp-popup__body p:last-child {
    margin-bottom: 0;
}

.pfp-popup__body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* ═══════════════════════════════════════
   CTA BUTTON
   ═══════════════════════════════════════ */

.pfp-popup__actions {
    margin-top: 20px;
}

.pfp-popup__cta {
    display: inline-block;
    padding: 12px 28px;
    background: var(--pfp-cta-bg, #6c5ce7);
    color: var(--pfp-cta-text, #ffffff);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.pfp-popup__cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

.pfp-popup__cta:active {
    transform: translateY(0);
}

/* Image-only popup styles */
.pfp-popup--image-only .pfp-popup__container {
    padding: 0;
    overflow: hidden;
}

.pfp-popup__image-wrap {
    width: 100%;
    height: 100%;
    display: block;
    line-height: 0;
}

.pfp-popup__image-wrap a {
    display: block;
    width: 100%;
    height: 100%;
}

.pfp-popup__img {
    width: 100%;
    height: 100%;
    aspect-ratio: var(--pfp-aspect-ratio, auto);
    object-fit: var(--pfp-image-fit, contain);
    display: block;
    border-radius: var(--pfp-radius, 16px);
}

/* ═══════════════════════════════════════
   CLOSE BUTTON
   ═══════════════════════════════════════ */

.pfp-popup__close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    border: none !important;
    background: rgba(0, 0, 0, 0.55) !important;
    background-color: rgba(0, 0, 0, 0.55) !important;
    color: #ffffff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    z-index: 999999 !important;
    padding: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
    outline: none !important;
    line-height: 1 !important;
}

.pfp-popup__close:hover {
    filter: brightness(1.2) !important;
    transform: scale(1.1) rotate(90deg) !important;
    background-color: rgba(0, 0, 0, 0.75) !important;
}

.pfp-popup__close svg {
    width: 18px !important;
    height: 18px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: none !important;
    overflow: visible !important;
}

.pfp-popup__close svg path,
.pfp-popup__close svg line {
    stroke: #ffffff !important;
    stroke-width: 2.8px !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    fill: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Floating bar close */
.pfp-popup--floating-bar .pfp-popup__close {
    position: relative;
    top: auto;
    right: auto;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
    color: var(--pfp-text, #ffffff);
}

/* ═══════════════════════════════════════
   ANIMATIONS — ENTRANCE
   ═══════════════════════════════════════ */

.pfp-anim-fadeIn {
    animation: pfpFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.pfp-anim-slideUp {
    animation: pfpSlideUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pfp-anim-slideDown {
    animation: pfpSlideDown 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pfp-anim-slideLeft {
    animation: pfpSlideLeft 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pfp-anim-slideRight {
    animation: pfpSlideRight 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pfp-anim-bounceIn {
    animation: pfpBounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) both;
}

.pfp-anim-zoomIn {
    animation: pfpZoomIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ═══════════════════════════════════════
   ANIMATIONS — EXIT
   ═══════════════════════════════════════ */

.pfp-anim-fadeOut {
    animation: pfpFadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.pfp-anim-slideDown-out {
    animation: pfpSlideDownOut 0.35s cubic-bezier(0.4, 0, 1, 1) both;
}

.pfp-anim-slideUp-out {
    animation: pfpSlideUpOut 0.35s cubic-bezier(0.4, 0, 1, 1) both;
}

.pfp-anim-zoomOut {
    animation: pfpZoomOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ═══════════════════════════════════════
   @KEYFRAMES
   ═══════════════════════════════════════ */

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

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

@keyframes pfpSlideUp {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pfpSlideDown {
    from { opacity: 0; transform: translateY(-40px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pfpSlideLeft {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes pfpSlideRight {
    from { opacity: 0; transform: translateX(-40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes pfpBounceIn {
    from { opacity: 0; transform: scale(0.3); }
    50%  { opacity: 1; transform: scale(1.05); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes pfpZoomIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes pfpZoomOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.85); }
}

@keyframes pfpSlideDownOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(40px); }
}

@keyframes pfpSlideUpOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-40px); }
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 600px) {
    .pfp-popup--modal {
        padding: 12px;
    }

    .pfp-popup--modal .pfp-popup__container {
        border-radius: 12px;
    }

    .pfp-popup__content {
        padding: 24px 20px;
    }

    .pfp-popup__title {
        font-size: 18px;
    }

    .pfp-popup__body {
        font-size: 14px;
    }

    .pfp-popup--slide-in,
    .pfp-popup--notification {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
        width: auto;
    }

    .pfp-popup--floating-bar .pfp-popup__container {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .pfp-popup--floating-bar .pfp-popup__content {
        flex-direction: column;
    }

    .pfp-popup--fullscreen .pfp-popup__content {
        padding: 24px;
    }

    .pfp-popup--fullscreen .pfp-popup__title {
        font-size: 24px;
    }
}

/* ═══════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .pfp-popup,
    .pfp-popup__cta,
    .pfp-popup__close {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════
   CTA BUTTON OVERLAY ON IMAGE
   ═══════════════════════════════════════ */

.pfp-popup__img-cta {
    position: absolute;
    z-index: 15;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none !important;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    cursor: pointer;
    line-height: 1.2;
}

.pfp-popup__img-cta--bottom-center {
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
}

.pfp-popup__img-cta--bottom-center:hover {
    transform: translateX(-50%) translateY(-2px) scale(1.03);
}

.pfp-popup__img-cta--bottom-left {
    bottom: 24px;
    left: 24px;
}

.pfp-popup__img-cta--bottom-left:hover {
    transform: translateY(-2px) scale(1.03);
}

.pfp-popup__img-cta--bottom-right {
    bottom: 24px;
    right: 24px;
}

.pfp-popup__img-cta--bottom-right:hover {
    transform: translateY(-2px) scale(1.03);
}

.pfp-popup__img-cta--center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.pfp-popup__img-cta--center:hover {
    transform: translate(-50%, -50%) scale(1.04);
}
