/* ==========================================================================
   Pistis Floating Messages - Frontend Styles v2.0
   ========================================================================== */

/* ---------- Base Wrapper ---------- */
.pfm-wrapper {
    position: fixed;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    box-sizing: border-box;
}
.pfm-wrapper.pfm-visible {
    visibility: visible;
}
.pfm-wrapper a {
    text-decoration: none;
    font-weight: bold;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pfm-wrapper .pfm-content {
    font-weight: bold;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------- Close Button ---------- */
.pfm-close {
    position: absolute;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    text-align: center;
    line-height: 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    z-index: 100000;
    transition: transform 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.pfm-close:hover {
    background: rgba(220, 50, 50, 0.9);
    transform: scale(1.15);
}

/* ---------- Icon ---------- */
.pfm-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
}
.pfm-icon .dashicons {
    font-size: inherit;
    width: auto;
    height: auto;
    line-height: inherit;
}

/* ---------- Overlay (for center position) ---------- */
.pfm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.pfm-overlay.pfm-visible {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   POSITIONS
   ========================================================================== */

/* -- Bottom Center -- */
.pfm-pos-bottom-center {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 10px 10px 0 0;
}
.pfm-pos-bottom-center .pfm-close { top: -12px; right: -12px; }

/* -- Bottom Left -- */
.pfm-pos-bottom-left {
    bottom: 0;
    left: 20px;
    border-radius: 10px 10px 0 0;
}
.pfm-pos-bottom-left .pfm-close { top: -12px; right: -12px; }

/* -- Bottom Right -- */
.pfm-pos-bottom-right {
    bottom: 0;
    right: 20px;
    border-radius: 10px 10px 0 0;
}
.pfm-pos-bottom-right .pfm-close { top: -12px; left: -12px; }

/* -- Top Center -- */
.pfm-pos-top-center {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 10px 10px;
}
.pfm-pos-top-center .pfm-close { bottom: -12px; right: -12px; }

/* -- Top Left -- */
.pfm-pos-top-left {
    top: 0;
    left: 20px;
    border-radius: 0 0 10px 10px;
}
.pfm-pos-top-left .pfm-close { bottom: -12px; right: -12px; }

/* -- Top Right -- */
.pfm-pos-top-right {
    top: 0;
    right: 20px;
    border-radius: 0 0 10px 10px;
}
.pfm-pos-top-right .pfm-close { bottom: -12px; left: -12px; }

/* -- Left Center (vertical text) -- */
.pfm-pos-left {
    left: 0;
    top: 50%;
    writing-mode: vertical-lr;
    transform: translateY(-50%) rotate(180deg);
    border-radius: 0 10px 10px 0;
}
.pfm-pos-left .pfm-close { top: -12px; right: -12px; transform: rotate(180deg); }
.pfm-pos-left a,
.pfm-pos-left .pfm-content { padding: 24px 10px; }

/* -- Right Center (vertical text) -- */
.pfm-pos-right {
    right: 0;
    top: 50%;
    writing-mode: vertical-rl;
    transform: translateY(-50%);
    border-radius: 10px 0 0 10px;
}
.pfm-pos-right .pfm-close { top: -12px; left: -12px; }
.pfm-pos-right a,
.pfm-pos-right .pfm-content { padding: 24px 10px; }

/* -- Center (modal-style) -- */
.pfm-pos-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 12px;
    max-width: 90vw;
}
.pfm-pos-center .pfm-close { top: -12px; right: -12px; }

/* -- Top Full Width (Relative & Fixed) -- */
.pfm-pos-top-full-relative,
.pfm-pos-top-full-fixed {
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
    top: 0;
    bottom: auto;
    transform: none;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.pfm-pos-top-full-relative {
    position: relative;
}
.pfm-pos-top-full-fixed {
    position: fixed;
    z-index: 99999;
}
.pfm-pos-top-full-relative a,
.pfm-pos-top-full-relative .pfm-content,
.pfm-pos-top-full-fixed a,
.pfm-pos-top-full-fixed .pfm-content {
    padding-right: 45px;
}
.pfm-pos-top-full-relative .pfm-close,
.pfm-pos-top-full-fixed .pfm-close {
    top: 50%;
    right: 15px;
    left: auto;
    bottom: auto;
    transform: translateY(-50%);
    z-index: 100001;
}
.pfm-pos-top-full-relative .pfm-close:hover,
.pfm-pos-top-full-fixed .pfm-close:hover {
    transform: translateY(-50%) scale(1.15);
}

/* -- Bottom Full Width (Relative & Fixed) -- */
.pfm-pos-bottom-full-relative,
.pfm-pos-bottom-full-fixed {
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    transform: none;
    border-radius: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
}
.pfm-pos-bottom-full-relative {
    position: relative;
}
.pfm-pos-bottom-full-fixed {
    position: fixed;
    z-index: 99999;
}
.pfm-pos-bottom-full-relative a,
.pfm-pos-bottom-full-relative .pfm-content,
.pfm-pos-bottom-full-fixed a,
.pfm-pos-bottom-full-fixed .pfm-content {
    padding-right: 45px;
}
.pfm-pos-bottom-full-relative .pfm-close,
.pfm-pos-bottom-full-fixed .pfm-close {
    top: 50%;
    right: 15px;
    left: auto;
    bottom: auto;
    transform: translateY(-50%);
    z-index: 100001;
}
.pfm-pos-bottom-full-relative .pfm-close:hover,
.pfm-pos-bottom-full-fixed .pfm-close:hover {
    transform: translateY(-50%) scale(1.15);
}

/* ==========================================================================
   ANIMATION KEYFRAMES — ENTRANCE
   ========================================================================== */

/* -- fadeIn -- */
@keyframes pfm-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* -- slideInUp -- */
@keyframes pfm-slideInUp {
    from { opacity: 0; transform: translateY(60px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* -- slideInDown -- */
@keyframes pfm-slideInDown {
    from { opacity: 0; transform: translateY(-60px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* -- slideInLeft -- */
@keyframes pfm-slideInLeft {
    from { opacity: 0; transform: translateX(-60px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* -- slideInRight -- */
@keyframes pfm-slideInRight {
    from { opacity: 0; transform: translateX(60px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* -- bounceIn -- */
@keyframes pfm-bounceIn {
    0%   { opacity: 0; transform: scale(0.3); }
    50%  { opacity: 1; transform: scale(1.08); }
    70%  { transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

/* -- zoomIn -- */
@keyframes pfm-zoomIn {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}

/* -- flipInX -- */
@keyframes pfm-flipInX {
    from { opacity: 0; transform: perspective(400px) rotateX(90deg); }
    40%  { transform: perspective(400px) rotateX(-15deg); }
    70%  { transform: perspective(400px) rotateX(10deg); }
    to   { opacity: 1; transform: perspective(400px) rotateX(0deg); }
}

/* -- rotateIn -- */
@keyframes pfm-rotateIn {
    from { opacity: 0; transform: rotate(-200deg) scale(0.5); }
    to   { opacity: 1; transform: rotate(0deg) scale(1); }
}

/* ==========================================================================
   ANIMATION KEYFRAMES — EXIT
   ========================================================================== */

/* -- fadeOut -- */
@keyframes pfm-fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* -- slideOutUp -- */
@keyframes pfm-slideOutUp {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-60px); }
}

/* -- slideOutDown -- */
@keyframes pfm-slideOutDown {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(60px); }
}

/* -- slideOutLeft -- */
@keyframes pfm-slideOutLeft {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-60px); }
}

/* -- slideOutRight -- */
@keyframes pfm-slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(60px); }
}

/* -- bounceOut -- */
@keyframes pfm-bounceOut {
    0%   { opacity: 1; transform: scale(1); }
    25%  { transform: scale(0.95); }
    50%  { opacity: 1; transform: scale(1.08); }
    100% { opacity: 0; transform: scale(0.3); }
}

/* -- zoomOut -- */
@keyframes pfm-zoomOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.5); }
}

/* -- flipOutX -- */
@keyframes pfm-flipOutX {
    from { opacity: 1; transform: perspective(400px) rotateX(0deg); }
    30%  { transform: perspective(400px) rotateX(-15deg); }
    to   { opacity: 0; transform: perspective(400px) rotateX(90deg); }
}

/* -- rotateOut -- */
@keyframes pfm-rotateOut {
    from { opacity: 1; transform: rotate(0deg) scale(1); }
    to   { opacity: 0; transform: rotate(200deg) scale(0.5); }
}

/* ==========================================================================
   INFINITE MARQUEE (TICKER) STYLES
   ========================================================================== */

.pfm-wrapper.pfm-has-marquee {
    overflow: hidden !important;
    padding: 0 !important;
}

.pfm-marquee {
    position: relative;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding-right: 50px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 35px, #000 calc(100% - 60px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 35px, #000 calc(100% - 60px), transparent 100%);
}

.pfm-marquee-track {
    display: flex;
    align-items: center;
    width: max-content;
    will-change: transform;
    animation: pfm-marquee-scroll var(--pfm-marquee-duration, 25s) linear infinite;
}

.pfm-marquee-track.pfm-reverse {
    animation-direction: reverse;
}

.pfm-marquee[data-pause="1"]:hover .pfm-marquee-track,
.pfm-marquee-track.pfm-is-paused {
    animation-play-state: paused;
}

.pfm-marquee-group {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.pfm-marquee-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    white-space: nowrap;
    font-weight: 600;
    box-sizing: border-box;
}

.pfm-wrapper.pfm-has-marquee a,
.pfm-marquee-item a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 !important;
    font-weight: inherit;
    transition: opacity 0.2s ease, text-decoration 0.2s ease;
}

.pfm-marquee-item a:hover {
    opacity: 0.85;
    text-decoration: underline;
}

.pfm-marquee-item .pfm-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pfm-marquee-sep {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.65;
    padding: 0 4px;
    user-select: none;
    font-size: 0.9em;
    flex-shrink: 0;
}

@keyframes pfm-marquee-scroll {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 600px) {
    .pfm-pos-bottom-center,
    .pfm-pos-top-center {
        width: calc(100% - 20px);
        left: 10px;
        transform: none;
    }
    .pfm-pos-center {
        width: calc(100% - 30px);
        max-width: none;
    }
    .pfm-wrapper a,
    .pfm-wrapper .pfm-content {
        padding: 10px 18px;
        font-size: 14px;
    }
    .pfm-marquee {
        padding-right: 42px;
        -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 15px, #000 calc(100% - 50px), transparent 100%);
        mask-image: linear-gradient(90deg, transparent 0%, #000 15px, #000 calc(100% - 50px), transparent 100%);
    }
    .pfm-marquee-item {
        padding: 8px 12px;
        font-size: 13px;
    }
}
