/**
 * ShowcaseX Pro — Animations & Modals
 */

/* -----------------------------------------------------------------------
   RIPPLE EFFECT
   ----------------------------------------------------------------------- */
.pixsp-ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: pixsp-ripple 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 0;
}

@keyframes pixsp-ripple {
    to {
        transform: scale(1);
        opacity: 0;
    }
}

/* -----------------------------------------------------------------------
   MODAL OVERLAY & SPINNER
   ----------------------------------------------------------------------- */
body.pixsp-modal-open {
    overflow: hidden !important;
}

#pixsp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: var(--pixsp-z-modal-bg);
    display: none;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 40px 20px;
}

#pixsp-modal-overlay.loading {
    display: flex;
}

#pixsp-modal-overlay.open {
    display: flex !important;
}

.pixsp-modal-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: calc(var(--pixsp-z-modal-bg) + 1);
    display: none;
}

.spinner-ring {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* -----------------------------------------------------------------------
   MODAL CONTENT
   ----------------------------------------------------------------------- */
.pixsp-modal-content {
	--pixsp-bg: #ffffff;
	--pixsp-bg-2: #f8fafc;
	--pixsp-text: #1e293b;
	--pixsp-text-muted: #64748b;
	--pixsp-border: #e2e8f0;
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: auto;
    background: var(--pixsp-popup-bg, var(--pixsp-bg));
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    z-index: var(--pixsp-z-modal);
    opacity: 0; /* Animated in via GSAP */
    overflow: hidden;
}

.pixsp-modal-error {
    max-width: 34rem;
    padding: 5rem 2rem 2rem;
    color: var(--pixsp-text);
    text-align: center;
}
.pixsp-modal-error h2 { margin: 0 0 .75rem; font-size: 1.35rem; }
.pixsp-modal-error p { margin: 0 0 1.5rem; color: var(--pixsp-text-muted); }

/* A focused, readable case-study layout for the popup. */
.popup-dark { --pixsp-bg: var(--pixsp-popup-bg, #0b1220); --pixsp-bg-2: #152137; --pixsp-text: #f8fafc; --pixsp-text-muted: #9aabc2; --pixsp-border: #2d405d; }
.pixsp-modal-content.popup-dark { border: 1px solid rgba(148,163,184,.2); }
.pixsp-modal-content.popup-dark .pixsp-modal-title { color: #f8fafc; }
.pixsp-modal-content.popup-dark .pixsp-modal-subtitle { color: #cbd5e1; }
.pixsp-modal-content.popup-dark .pixsp-modal-prose { color: #d5deeb; font-size: 1rem; line-height: 1.75; }
.pixsp-modal-content.popup-dark .pixsp-modal-section-title { color: #f8fafc; border-color: rgba(148,163,184,.2); }
.pixsp-modal-content.popup-dark .pixsp-modal-sidebar-card { background: rgba(30,41,59,.86); border-color: rgba(148,163,184,.2); }
.pixsp-modal-content.popup-dark .pixsp-cta-secondary { color: var(--pixsp-link); }

/* Popup presentation variants. */
.popup-style-centered { max-width: 64rem; }
.popup-style-slide-in { max-width: 48rem; margin: 0 0 0 auto; min-height: 100%; border-radius: 1.25rem 0 0 1.25rem; }
.popup-style-article { max-width: 54rem; background: var(--pixsp-popup-bg, var(--pixsp-bg)); }
.popup-style-article .pixsp-modal-body-grid { grid-template-columns: 1fr; }
.popup-style-article .pixsp-modal-sidebar { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.popup-style-article .pixsp-modal-sidebar-card { margin: 0; }

/* Close & Nav buttons */
.pixsp-modal-close,
.pixsp-modal-nav {
    position: absolute;
    top: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(8px);
    transition: background 0.2s, transform 0.2s;
}
.pixsp-modal-close.material-symbols-outlined { font-size: 1.35rem; }

/* Keep modal controls insulated from page-builder/theme button styles. */
#pixsp-modal-overlay .pixsp-modal-close,
#pixsp-modal-overlay .pixsp-modal-nav {
	width: 2.75rem !important;
	height: 2.75rem !important;
	min-width: 2.75rem !important;
	padding: 0 !important;
	border: 1px solid rgba(255,255,255,.24) !important;
	border-radius: 999px !important;
	background: rgba(15,23,42,.9) !important;
	color: #fff !important;
	line-height: 1 !important;
	box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.24) !important;
}
#pixsp-modal-overlay .pixsp-modal-close:hover,
#pixsp-modal-overlay .pixsp-modal-nav:hover { background: var(--pixsp-button, #7c3aed) !important; }

.pixsp-modal-close {
    right: 20px;
}

.pixsp-modal-nav {
    top: 50%;
    transform: translateY(-50%);
}
.pixsp-modal-prev { left: 20px; }
.pixsp-modal-next { right: 20px; }

.pixsp-modal-close:hover,
.pixsp-modal-nav:hover {
    background: rgba(0,0,0,0.8);
    transform: scale(1.1) translateY(0);
}
.pixsp-modal-nav:hover {
    transform: scale(1.1) translateY(-50%);
}

/* -----------------------------------------------------------------------
   MODAL INTERNALS
   ----------------------------------------------------------------------- */
.pixsp-modal-inner {
    padding-bottom: 80px; /* space for sticky footer */
}

/* Hero */
.pixsp-modal-hero-wrapper {
    position: relative;
    width: 100%;
    height: 50vh;
    min-height: 400px;
    overflow: hidden;
}

.pixsp-modal-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pixsp-modal-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--pixsp-bg) 0%, transparent 100%);
}

.pixsp-modal-hero-text {
    position: absolute;
    bottom: 40px;
    left: 40px;
    right: 40px;
    z-index: 2;
}

.pixsp-modal-title {
    font-family: var(--pixsp-font-headings);
    font-size: 42px;
    font-weight: 800;
    margin: 10px 0;
    line-height: 1.2;
}

.pixsp-modal-subtitle {
    font-size: 18px;
    opacity: 0.8;
}

/* Body Grid */
.pixsp-modal-body-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    padding: 40px;
}

.pixsp-modal-section {
    margin-bottom: 40px;
}

.pixsp-modal-section-title {
    font-family: var(--pixsp-font-headings);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--pixsp-border);
    padding-bottom: 10px;
}

/* Sidebar */
.pixsp-modal-sidebar-card {
    background: var(--pixsp-bg-2);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--pixsp-border);
}

.pixsp-sidebar-card-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pixsp-text-muted);
}

.pixsp-modal-meta-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.pixsp-modal-meta-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--pixsp-border);
    font-size: 14px;
}
.pixsp-modal-meta-list li:last-child {
    border-bottom: none;
}
.meta-label { color: var(--pixsp-text-muted); }
.meta-value { font-weight: 600; text-align: right; }

/* Sticky CTA */
.pixsp-modal-sticky-cta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--pixsp-border);
    padding: 20px 40px;
    z-index: 5;
}

.popup-dark .pixsp-modal-sticky-cta {
    background: rgba(15, 23, 42, 0.9);
}

/* Case-study polish: clearer hierarchy, lighter controls and responsive flow. */
.pixsp-modal-header-no-hero { padding: 4.75rem 3rem 1.5rem; border-bottom: 1px solid var(--pixsp-border); }
.pixsp-modal-type-chip { display: inline-flex; padding: .35rem .65rem; border: 1px solid var(--pixsp-border); border-radius: 999px; color: var(--pixsp-text-muted); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.pixsp-modal-body-grid { grid-template-columns: minmax(0, 1.45fr) minmax(17rem, .75fr); gap: 2rem; padding: 2.5rem 3rem 7rem; }
.pixsp-modal-main { min-width: 0; }
.pixsp-modal-sidebar { position: sticky; top: 1.5rem; align-self: start; }
.pixsp-modal-prose h3 { margin: 1.75rem 0 .5rem; color: var(--pixsp-text); font-size: 1rem; }
.pixsp-modal-prose p { margin: 0 0 1rem; }
.pixsp-modal-meta-list li { gap: 1rem; }
.pixsp-modal-meta-list .meta-value { color: var(--pixsp-text); }
.pixsp-modal-sticky-cta { display: flex; align-items: center; min-height: 4.75rem; padding: .875rem 3rem; }
.pixsp-sticky-cta-inner { display: flex; align-items: center; width: 100%; gap: .75rem; }
.pixsp-sticky-cta .pixsp-cta-btn { background: transparent; border: 1px solid var(--pixsp-border); color: var(--pixsp-link); box-shadow: none; }
.pixsp-sticky-cta .pixsp-cta-primary { background: var(--pixsp-button); border-color: var(--pixsp-button); color: #fff; }
.pixsp-share-buttons { display: flex; gap: .5rem; margin-left: auto; }
.pixsp-share-btn { width: 2.75rem; height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--pixsp-border); border-radius: .65rem; background: transparent; color: var(--pixsp-text); cursor: pointer; }
.pixsp-share-btn svg { display: block !important; width: 1.1rem !important; height: 1.1rem !important; fill: currentColor !important; stroke: currentColor; }
.pixsp-share-btn .material-symbols-outlined { display: block !important; width: 1.1rem; height: 1.1rem; font-size: 1.1rem; line-height: 1; color: currentColor; }
.pixsp-share-btn:hover { border-color: var(--pixsp-button); color: var(--pixsp-button); }

@media (max-width: 900px) {
    #pixsp-modal-overlay { align-items: flex-start; padding: 0; }
    .pixsp-modal-content { min-height: 100vh; border-radius: 0; }
    .pixsp-modal-body-grid { grid-template-columns: 1fr; padding: 1.5rem 1.25rem 7rem; }
    .pixsp-modal-sidebar { position: static; }
    .pixsp-modal-header-no-hero { padding: 4.5rem 1.25rem 1.25rem; }
    .pixsp-sticky-cta { padding: .75rem 1.25rem; }
    .pixsp-sticky-cta-inner { flex-wrap: wrap; }
    .pixsp-share-buttons { margin-left: 0; }
}

.pixsp-sticky-cta-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pixsp-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.pixsp-cta-primary {
    background: var(--pixsp-primary);
    color: #fff;
}
.pixsp-cta-primary:hover {
    background: var(--pixsp-primary-hover);
    transform: translateY(-2px);
}

/* Lightbox */
.pixsp-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: var(--pixsp-z-lightbox);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.pixsp-lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}
.pixsp-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: #fff;
    background: transparent;
    border: none;
    cursor: pointer;
}
