/**
 * Essential Pro Pack — shared frontend styles.
 *
 * Loaded on any page where an EPP widget, popup, or theme template renders.
 * Every per-widget stylesheet declares this file as a dependency, so the custom
 * properties defined here are always available to them.
 */

:root {
    --eppro-input-bg: #ffffff;
    --eppro-input-color: #0f172a;
    --eppro-btn-bg: #4f46e5;
    --eppro-btn-color: #ffffff;
    --eppro-card-bg: #ffffff;
    --eppro-radius: 8px;

    --eppro-border: #e2e8f0;
    --eppro-muted: #64748b;
    --eppro-shadow: 0 1px 3px rgba(15, 23, 42, .08);
    --eppro-shadow-lg: 0 20px 45px rgba(15, 23, 42, .18);
    --eppro-transition: .25s ease;
}

/* ── Shared primitives ──────────────────────────────────────────────────── */

.eppro-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.eppro-icon svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

.eppro-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.eppro-editor-notice {
    padding: 10px 14px;
    border: 1px dashed #c7d2fe;
    border-radius: var(--eppro-radius);
    background: #eef2ff;
    color: #4338ca;
    font-size: 13px;
}

.eppro-template-shortcode,
.eppro-theme-header,
.eppro-theme-footer {
    width: 100%;
}

/* ── Popups ─────────────────────────────────────────────────────────────── */

.eppro-popup {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.eppro-popup[hidden] {
    display: none;
}

.eppro-popup.is-open {
    display: flex;
}

.eppro-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .6);
}

.eppro-popup__dialog {
    position: relative;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 28px;
    border-radius: calc(var(--eppro-radius) * 1.5);
    background: var(--eppro-card-bg);
    box-shadow: var(--eppro-shadow-lg);
}

.eppro-popup__close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--eppro-muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--eppro-transition), color var(--eppro-transition);
}

.eppro-popup__close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.eppro-popup__close:focus-visible {
    outline: 2px solid var(--eppro-btn-bg);
    outline-offset: 2px;
}

/* Positions */
.eppro-popup--top    { align-items: flex-start; }
.eppro-popup--bottom { align-items: flex-end; }
.eppro-popup--left   { justify-content: flex-start; }
.eppro-popup--right  { justify-content: flex-end; }

/* Entrance animations */
.eppro-popup.is-open .eppro-popup__dialog {
    animation: eppro-popup-fade .28s ease both;
}

.eppro-popup--slide-up.is-open .eppro-popup__dialog   { animation-name: eppro-popup-slide-up; }
.eppro-popup--slide-down.is-open .eppro-popup__dialog { animation-name: eppro-popup-slide-down; }
.eppro-popup--zoom.is-open .eppro-popup__dialog       { animation-name: eppro-popup-zoom; }

@keyframes eppro-popup-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes eppro-popup-slide-up {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: none; }
}

@keyframes eppro-popup-slide-down {
    from { opacity: 0; transform: translateY(-28px); }
    to   { opacity: 1; transform: none; }
}

@keyframes eppro-popup-zoom {
    from { opacity: 0; transform: scale(.92); }
    to   { opacity: 1; transform: none; }
}

/* Prevent the page behind an open popup from scrolling. */
body.eppro-popup-open {
    overflow: hidden;
}

/* ── Post grid (shared by the widget and its AJAX load-more responses) ──── */

.eppro-pg-item {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--eppro-border);
    border-radius: var(--eppro-radius);
    background: var(--eppro-card-bg);
}

.eppro-pg-thumb img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.eppro-pg-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
}

.eppro-pg-category a {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    text-decoration: none;
    color: var(--eppro-btn-bg);
}

.eppro-pg-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.35;
}

.eppro-pg-title a {
    color: inherit;
    text-decoration: none;
}

.eppro-pg-title a:hover {
    color: var(--eppro-btn-bg);
}

.eppro-pg-excerpt {
    color: var(--eppro-muted);
    font-size: 14px;
    line-height: 1.6;
}

.eppro-pg-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--eppro-muted);
}

.eppro-pg-author {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.eppro-pg-author img {
    border-radius: 50%;
}

.eppro-pg-author a {
    color: inherit;
    text-decoration: none;
}

.eppro-pg-read-more {
    align-self: flex-start;
    margin-top: 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--eppro-btn-bg);
}

.eppro-pg-read-more:hover {
    text-decoration: underline;
}

/* ── Sticky extension ───────────────────────────────────────────────────── */

.eppro-is-sticky {
    position: fixed !important;
    left: 0;
    right: 0;
    width: 100%;
}

.eppro-sticky-placeholder {
    display: block;
}

/* ── WooCommerce mini-cart badge (kept in sync server-side) ─────────────── */

.eppro-wmc-count {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--eppro-btn-bg);
    color: var(--eppro-btn-color);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

/* ── Motion preferences ─────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .eppro-popup.is-open .eppro-popup__dialog {
        animation: none;
    }

    .eppro-popup__close {
        transition: none;
    }
}
