.easey-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    padding: 20px;
    box-sizing: border-box;
}

.easey-popup {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    margin: auto;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-sizing: border-box;
}

.easey-popup-content {
    position: relative;
    width: 100%;
    height: auto;
    overflow: auto;
    padding: 0;
    box-sizing: border-box;
}

/* Fallback styles for images without inline styles */
.easey-popup-content img:not([style]) {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 70vh;
}

/* Safety constraints for images with inline styles — only limit overflow */
.easey-popup-content img[style] {
    box-sizing: border-box;
}

.easey-popup-content * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Form elements styling inside popup - fallback for elements without inline styles */
.easey-popup-content input[type="text"]:not([style]),
.easey-popup-content input[type="email"]:not([style]),
.easey-popup-content input[type="password"]:not([style]),
.easey-popup-content input[type="number"]:not([style]),
.easey-popup-content input[type="tel"]:not([style]),
.easey-popup-content input[type="url"]:not([style]),
.easey-popup-content input[type="search"]:not([style]),
.easey-popup-content input[type="date"]:not([style]),
.easey-popup-content input[type="time"]:not([style]),
.easey-popup-content input[type="datetime-local"]:not([style]),
.easey-popup-content textarea:not([style]),
.easey-popup-content select:not([style]) {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 8px 12px;
    margin: 8px 0;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    color: #111827;
    background-color: #ffffff;
    box-sizing: border-box;
    opacity: 1;
    visibility: visible;
    z-index: 1;
    position: relative;
}

/* Base form element styles for elements with inline styles */
.easey-popup-content input[type="text"][style],
.easey-popup-content input[type="email"][style],
.easey-popup-content input[type="password"][style],
.easey-popup-content input[type="number"][style],
.easey-popup-content input[type="tel"][style],
.easey-popup-content textarea[style],
.easey-popup-content select[style] {
    box-sizing: border-box;
    opacity: 1;
    visibility: visible;
}

.easey-popup-content input:focus,
.easey-popup-content textarea:focus,
.easey-popup-content select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.easey-popup-content textarea {
    min-height: 100px;
    resize: vertical;
}

.easey-popup-content label {
    display: block;
    margin: 12px 0 4px 0;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.easey-popup-content button[type="submit"]:not([style]),
.easey-popup-content input[type="submit"]:not([style]),
.easey-popup-content button:not(.easey-popup-close):not([style]),
.easey-popup-content a[data-action-type]:not([style]) {
    display: inline-block;
    padding: 10px 20px;
    margin: 8px 4px 8px 0;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background-color: #3b82f6;
    color: #ffffff;
    transition: background-color 0.2s ease;
    z-index: 1;
    position: relative;
}

/* Minimal base styles for buttons with inline styles */
.easey-popup-content button[style],
.easey-popup-content a[data-action-type][style] {
    box-sizing: border-box;
    z-index: 1;
    position: relative;
}

.easey-popup-content button[type="submit"]:hover,
.easey-popup-content input[type="submit"]:hover,
.easey-popup-content button:not(.easey-popup-close):hover,
.easey-popup-content a[data-action-type]:hover {
    opacity: 0.9;
}

/* Close button - inside popup, top-right corner */
.easey-popup-close {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0;
    line-height: 1;
    color: #9ca3af;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    opacity: 1;
    transition: color 0.2s ease;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.easey-popup-close:hover {
    color: #111827;
}

.easey-popup-close svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* Body scroll lock when popup is visible */
body.easey-popup-active {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    /* All popups on mobile: override fixed dimensions */
    .easey-popup-overlay .easey-popup {
        width: 95% !important;
        max-width: 95% !important;
        height: auto !important;
        max-height: calc(100vh - 40px) !important;
    }

    /* Corner positions: slightly smaller to show positioning */
    .position-top-left .easey-popup,
    .position-top-right .easey-popup,
    .position-bottom-left .easey-popup,
    .position-bottom-right .easey-popup {
        width: 90% !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 24px) !important;
    }

    .easey-popup-overlay {
        padding: 12px;
    }

    .easey-popup-content {
        height: auto !important;
    }

    .easey-popup-content img:not([style]) {
        max-width: 100% !important;
        height: auto !important;
        max-height: 50vh;
    }

    .easey-popup-content img[style] {
        max-width: 100% !important;
    }

    /* Stack multi-column layouts vertically on mobile */
    .easey-popup-content div[data-column-count="2"],
    .easey-popup-content div[data-column-count="3"],
    .easey-popup-content div[data-column-count="4"] {
        flex-direction: column !important;
        flex-wrap: wrap !important;
    }

    .easey-popup-content div[data-column-count="2"] > div,
    .easey-popup-content div[data-column-count="3"] > div,
    .easey-popup-content div[data-column-count="4"] > div {
        width: 100% !important;
    }

    /* Fallback for older popups without data attributes */
    .easey-popup-content div[style*="flex-direction: row"][style*="flex-wrap: nowrap"] {
        flex-direction: column !important;
        flex-wrap: wrap !important;
    }

    .easey-popup-content div[style*="flex-direction: row"][style*="flex-wrap: nowrap"] > div {
        width: 100% !important;
    }
}

/* Position classes */
.easey-popup-overlay.position-center {
    justify-content: center;
    align-items: center;
}

.easey-popup-overlay.position-center.is-visible {
    display: flex;
}

.easey-popup-overlay.position-top-left {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    padding: 20px !important;
}

.easey-popup-overlay.position-top-right {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: flex-start !important;
    padding: 20px !important;
}

.easey-popup-overlay.position-bottom-left {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: flex-end !important;
    padding: 20px !important;
}

.easey-popup-overlay.position-bottom-right {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: flex-end !important;
    padding: 20px !important;
}

/* Position-specific popup margin overrides */
.position-center .easey-popup {
    margin: auto;
}

.position-top-left .easey-popup,
.position-top-right .easey-popup,
.position-bottom-left .easey-popup,
.position-bottom-right .easey-popup {
    margin: 0;
}

/* Animations */
.animation-fade {
    animation: fadeIn 0.3s ease-in;
}

.animation-fade-out {
    animation: fadeOut 0.3s ease-out;
}

.animation-slide-up {
    animation: slideUp 0.3s ease-in;
}

.animation-slide-up-out {
    animation: slideDown 0.3s ease-out;
}

.animation-slide-down {
    animation: slideDown 0.3s ease-in;
}

.animation-slide-down-out {
    animation: slideUp 0.3s ease-out;
}

.animation-slide-left {
    animation: slideLeft 0.3s ease-in;
}

.animation-slide-left-out {
    animation: slideRight 0.3s ease-out;
}

.animation-slide-right {
    animation: slideRight 0.3s ease-in;
}

.animation-slide-right-out {
    animation: slideLeft 0.3s ease-out;
}

/* Animation Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes slideLeft {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes slideRight {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}
