/* ============================================================
   Elementor Popup Widget — Frontend Styles
   ============================================================ */

/* ---------- Button ---------- */
.epw-button-wrapper {
    display: block;
    width: 100%;
    text-align: center;
}

.epw-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    background-color: transparent;
    color: #6C63FF;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.4;
    text-align: center;
    transition:
        background-color 0.25s ease,
        transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.25s ease;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.epw-trigger-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.2s ease;
    border-radius: inherit;
}

.epw-trigger-btn:hover {
    transform: translateY(-2px) scale(1.02);
}

.epw-trigger-btn:hover::after {
    background: rgba(255,255,255,0.08);
}

.epw-trigger-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.2);
}

.epw-trigger-btn:focus-visible {
    outline: 3px solid #6C63FF;
    outline-offset: 3px;
}

.epw-btn-content p {
    margin: 0;
    padding: 0;
}

/* ---------- Modal Overlay ---------- */
.epw-modal-wrapper {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.epw-modal-wrapper[aria-hidden="true"] {
    pointer-events: none;
}

.epw-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.65);
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.epw-modal-wrapper.epw-is-open .epw-overlay {
    opacity: 1;
}

/* ---------- Modal Box ---------- */
.epw-modal-box {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
    z-index: 1;
    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.2) transparent;
}

.epw-modal-box::-webkit-scrollbar {
    width: 6px;
}

.epw-modal-box::-webkit-scrollbar-track {
    background: transparent;
}

.epw-modal-box::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

/* ---------- Close Button ---------- */
.epw-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.06);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #888888;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.epw-modal-close:hover {
    background: rgba(0,0,0,0.12);
    color: #333333;
    transform: rotate(90deg) scale(1.1);
}

.epw-modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

.epw-modal-close:focus-visible {
    outline: 3px solid #6C63FF;
    outline-offset: 2px;
}

.epw-modal-close svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* ---------- Modal Content ---------- */
.epw-modal-body {
    padding: 40px;
}

.epw-modal-title {
    margin: 0 0 20px 0;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.25;
    color: #1a1a2e;
    padding-right: 32px;
}

.epw-modal-content {
    color: #444444;
    font-size: 1rem;
    line-height: 1.7;
}

.epw-modal-content > *:first-child { margin-top: 0; }
.epw-modal-content > *:last-child  { margin-bottom: 0; }

.epw-modal-content p {
    margin: 0 0 1em 0;
}

.epw-modal-content h1,
.epw-modal-content h2,
.epw-modal-content h3,
.epw-modal-content h4 {
    margin-top: 1.4em;
    margin-bottom: 0.5em;
    line-height: 1.3;
}

.epw-modal-content a {
    color: #6C63FF;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.epw-modal-content a:hover {
    color: #5A52D5;
}

.epw-modal-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.epw-modal-content ul,
.epw-modal-content ol {
    padding-left: 1.4em;
    margin: 0.5em 0 1em;
}

.epw-modal-content li {
    margin-bottom: 0.3em;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

/* --- fade-scale (default) --- */
.epw-modal-box {
    opacity: 0;
    transform: scale(0.88);
    transition:
        opacity 0.38s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.epw-modal-wrapper.epw-is-open .epw-modal-box {
    opacity: 1;
    transform: scale(1);
}

/* --- slide-up --- */
.epw-modal-wrapper[data-animation="slide-up"] .epw-modal-box {
    opacity: 0;
    transform: translateY(60px) scale(0.97);
}

.epw-modal-wrapper[data-animation="slide-up"].epw-is-open .epw-modal-box {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- slide-down --- */
.epw-modal-wrapper[data-animation="slide-down"] .epw-modal-box {
    opacity: 0;
    transform: translateY(-60px) scale(0.97);
}

.epw-modal-wrapper[data-animation="slide-down"].epw-is-open .epw-modal-box {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- flip --- */
.epw-modal-wrapper[data-animation="flip"] .epw-modal-box {
    opacity: 0;
    transform: perspective(800px) rotateX(-20deg) scale(0.92);
}

.epw-modal-wrapper[data-animation="flip"].epw-is-open .epw-modal-box {
    opacity: 1;
    transform: perspective(800px) rotateX(0deg) scale(1);
    transition:
        opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- bounce --- */
.epw-modal-wrapper[data-animation="bounce"] .epw-modal-box {
    opacity: 0;
    transform: scale(0.5);
    transition: none;
}

.epw-modal-wrapper[data-animation="bounce"].epw-is-open .epw-modal-box {
    opacity: 1;
    animation: epwBounceIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes epwBounceIn {
    0%   { opacity: 0; transform: scale(0.5); }
    60%  { opacity: 1; transform: scale(1.06); }
    80%  { transform: scale(0.97); }
    100% { opacity: 1; transform: scale(1); }
}

/* --- Closing animation --- */
.epw-modal-wrapper.epw-is-closing .epw-overlay {
    opacity: 0;
}

.epw-modal-wrapper.epw-is-closing .epw-modal-box {
    opacity: 0 !important;
    transform: scale(0.92) !important;
    transition:
        opacity 0.22s ease,
        transform 0.22s ease !important;
    animation: none !important;
}

/* ============================================================
   BODY LOCK (no scroll when modal open)
   ============================================================ */
body.epw-modal-open {
    overflow: hidden;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
    .epw-modal-wrapper {
        padding: 16px;
        align-items: center;
    }

    .epw-modal-box {
        max-height: 85vh;
    }

    .epw-modal-body {
        padding: 28px 24px;
    }
}
