/**
 * EliPopup — Standalone Popup Styles
 * No external dependencies. Works without Tailwind.
 * @version 1.0.0
 */

/* ─── Animations ─────────────────────────────────────────────────────────── */

@keyframes elipopup-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes elipopup-fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

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

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

@keyframes elipopup-slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes elipopup-slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(100%); }
}

@keyframes elipopup-zoomIn {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes elipopup-zoomOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.8); }
}

/* ─── Wrapper & Overlay ──────────────────────────────────────────────────── */

.elipopup-wrap {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.elipopup-wrap.elipopup-visible {
    pointer-events: auto;
    opacity: 1;
}

.elipopup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: elipopup-fadeIn 0.3s ease forwards;
}

/* ─── Modal base ─────────────────────────────────────────────────────────── */

.elipopup-modal {
    position: absolute;
    box-sizing: border-box;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    overflow: auto;
    max-height: 90vh;
    opacity: 0;
}

/* Entry animations — applied by class */
.elipopup-wrap.elipopup-visible .elipopup-modal.elipopup-anim-fadeIn {
    animation: elipopup-fadeIn 0.35s ease forwards;
}

.elipopup-wrap.elipopup-visible .elipopup-modal.elipopup-anim-slideUp {
    animation: elipopup-slideUp 0.35s ease forwards;
}

.elipopup-wrap.elipopup-visible .elipopup-modal.elipopup-anim-slideInRight {
    animation: elipopup-slideInRight 0.35s ease forwards;
}

.elipopup-wrap.elipopup-visible .elipopup-modal.elipopup-anim-zoomIn {
    animation: elipopup-zoomIn 0.35s ease forwards;
}

/* Exit animations */
.elipopup-modal.elipopup-anim-out-fadeOut {
    animation: elipopup-fadeOut 0.3s ease forwards !important;
}

.elipopup-modal.elipopup-anim-out-slideDown {
    animation: elipopup-slideDown 0.3s ease forwards !important;
}

/* ─── Layout: Centered Modal ─────────────────────────────────────────────── */

.elipopup-modal--centered {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 280px;
}

/* ─── Layout: Slide-in Right ─────────────────────────────────────────────── */

.elipopup-modal--slide-in-right {
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0 !important;
    overflow-y: auto;
}

.elipopup-wrap.elipopup-visible .elipopup-modal--slide-in-right {
    animation: elipopup-slideInRight 0.35s ease forwards !important;
}

.elipopup-modal--slide-in-right.elipopup-anim-out-fadeOut {
    animation: elipopup-slideOutRight 0.3s ease forwards !important;
}

/* ─── Layout: Bottom Bar ─────────────────────────────────────────────────── */

.elipopup-modal--bottom-bar {
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0 !important;
    max-height: none;
    padding: 16px 24px;
}

.elipopup-wrap.elipopup-visible .elipopup-modal--bottom-bar {
    animation: elipopup-slideUp 0.3s ease forwards !important;
}

/* ─── Layout: Fullscreen ─────────────────────────────────────────────────── */

.elipopup-modal--fullscreen {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-height: 100vh;
    border-radius: 0 !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

/* ─── Close Button ───────────────────────────────────────────────────────── */

.elipopup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, color 0.15s;
    z-index: 1;
    line-height: 1;
}

.elipopup-close:hover {
    background: rgba(0, 0, 0, 0.18);
    color: #111;
}

.elipopup-close svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* ─── Content area ───────────────────────────────────────────────────────── */

.elipopup-content {
    word-break: break-word;
}

/* ─── Blocks ─────────────────────────────────────────────────────────────── */

.elipopup-block {
    margin-bottom: 16px;
}

.elipopup-block:last-child {
    margin-bottom: 0;
}

/* Rich text */
.elipopup-block--text {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
}

.elipopup-block--text h1,
.elipopup-block--text h2,
.elipopup-block--text h3 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
}

.elipopup-block--text h1 { font-size: 26px; }
.elipopup-block--text h2 { font-size: 22px; }
.elipopup-block--text h3 { font-size: 18px; }

.elipopup-block--text p {
    margin-bottom: 10px;
}

.elipopup-block--text p:last-child {
    margin-bottom: 0;
}

/* Image */
.elipopup-block--image img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
}

/* CTA Button */
.elipopup-block--cta {
    text-align: center;
}

/* Email form */
.elipopup-block--emailform {
    /* spacing handled by .elipopup-block */
}

/* Custom HTML */
.elipopup-block--custom {
    /* unstyled intentionally */
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.elipopup-btn {
    display: inline-block;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    border: 2px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
    white-space: nowrap;
}

.elipopup-btn--primary {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

.elipopup-btn--primary:hover {
    background: #4338ca;
    border-color: #4338ca;
}

.elipopup-btn--secondary {
    background: #64748b;
    color: #fff;
    border-color: #64748b;
}

.elipopup-btn--secondary:hover {
    background: #475569;
    border-color: #475569;
}

.elipopup-btn--outline {
    background: transparent;
    color: #4f46e5;
    border-color: #4f46e5;
}

.elipopup-btn--outline:hover {
    background: #4f46e5;
    color: #fff;
}

.elipopup-btn--ghost {
    background: transparent;
    color: #555;
    border-color: transparent;
    text-decoration: underline;
}

.elipopup-btn--ghost:hover {
    color: #111;
}

/* ─── Email Form ─────────────────────────────────────────────────────────── */

.elipopup-email-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.elipopup-email-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.elipopup-email-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.elipopup-email-form .elipopup-btn {
    width: 100%;
    text-align: center;
}

.elipopup-email-success {
    text-align: center;
    color: #059669;
    font-weight: 600;
    font-size: 15px;
    padding: 10px 0;
}

/* ─── Bottom bar layout adjustments ─────────────────────────────────────── */

.elipopup-modal--bottom-bar .elipopup-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.elipopup-modal--bottom-bar .elipopup-block {
    margin-bottom: 0;
    flex: 1;
}

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

@media (max-width: 480px) {
    .elipopup-modal--centered {
        width: 92vw !important;
        max-width: 92vw !important;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .elipopup-modal--slide-in-right {
        width: 100vw !important;
    }

    .elipopup-modal--bottom-bar .elipopup-content {
        flex-direction: column;
        align-items: stretch;
    }

    .elipopup-btn {
        width: 100%;
        text-align: center;
    }
}

/* ─── A11y: reduced motion ───────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .elipopup-modal,
    .elipopup-overlay,
    .elipopup-wrap {
        animation: none !important;
        transition: none !important;
    }
    .elipopup-wrap.elipopup-visible .elipopup-modal {
        opacity: 1 !important;
    }
}
