/**
 * digital-premium-content — Premium Gate & Badge Styles
 *
 * Applies to:
 *  - .dpc-gate-wrap / .dpc-is-gated  — wrapper for WRAP-style widgets
 *  - .dpc-gate-overlay                — locked content panel
 *  - .dpc-gate-panel                  — inner card of the overlay
 *  - .dpc-premium-badge               — small informational badge for accessible premium items
 *
 * Design goals: theme-independent, looks great on any background,
 * mobile-first, RTL-ready.
 */

/* ── WRAP container ──────────────────────────────────────────────── */
.dpc-gate-wrap {
    position: relative;
    display: block;
}

/*
 * When gated: blur and dim the card content beneath the overlay.
 * We target all direct children except the overlay itself.
 */
.dpc-gate-wrap.dpc-is-gated > *:not(.dpc-gate-overlay) {
    filter: blur(5px);
    opacity: 0.45;
    pointer-events: none;
    user-select: none;
}

/*
 * INJECT-style: .nett-postcard and .nc-list-item contain the overlay as
 * a child; use :has() to apply the blur to all other siblings.
 */
.nett-postcard:has(> .dpc-gate-overlay) > *:not(.dpc-gate-overlay),
.nc-list-item:has(> .dpc-gate-overlay) > *:not(.dpc-gate-overlay) {
    filter: blur(5px);
    opacity: 0.45;
    pointer-events: none;
    user-select: none;
}

/* Ensure the parent container allows absolute positioning of overlay */
.nett-postcard,
.npl-card,
.nc-list-item,
.nc-main-card,
.nct-row {
    position: relative;
}

/* ── Gate overlay ────────────────────────────────────────────────── */
.dpc-gate-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;

    /* Fallback solid background if rgba not supported */
    background: #f8fafc;

    /* backdrop-filter adds a real frosted-glass effect in modern browsers */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);

    border-radius: inherit;
    box-sizing: border-box;
}

/* ── Gate panel (inner card) ─────────────────────────────────────── */
.dpc-gate-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;

    background: #ffffff;
    border-radius: 16px;
    padding: 24px 20px 20px;
    width: 100%;
    max-width: 260px;

    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.07),
        0 10px 24px -4px rgba(0, 0, 0, 0.12);

    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── Lock icon ───────────────────────────────────────────────────── */
.dpc-gate-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 50%;
    color: #92400e;
    flex-shrink: 0;
}

.dpc-gate-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* ── Gate title ──────────────────────────────────────────────────── */
.dpc-gate-title {
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: #111827;
    border: none;
    background: none;
}

/* Reset potential theme overrides on h4 */
.dpc-gate-panel .dpc-gate-title::before,
.dpc-gate-panel .dpc-gate-title::after {
    display: none;
    content: none;
}

/* ── Gate message ────────────────────────────────────────────────── */
.dpc-gate-msg {
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.55;
    color: #6b7280;
}

/* ── CTA button ──────────────────────────────────────────────────── */
.dpc-gate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 4px;

    padding: 9px 20px;
    border-radius: 40px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    color: #ffffff !important;

    /* Background is set via inline style from widget settings */
    background: #e7b733;

    border: none;
    cursor: pointer;
    transition: filter 0.18s ease, transform 0.15s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

.dpc-gate-btn:hover,
.dpc-gate-btn:focus {
    filter: brightness(1.1);
    transform: translateY(-1px);
    text-decoration: none;
    color: #ffffff !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

/* ── Small informational badge ───────────────────────────────────── */
/*
 * Shown on items that ARE premium but the user HAS access
 * (e.g. a logged-in subscriber viewing premium posts).
 */
.dpc-premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    color: #fff;
    background: #e7b733; /* overridden by inline style */
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
    vertical-align: middle;
    pointer-events: none;
    user-select: none;
}

/* Absolute positioning when inside a relative card container */
.nett-postcard    > .dpc-premium-badge,
.npl-card         > .dpc-premium-badge,
.nc-main-card     > .dpc-premium-badge,
.nct-row          > .dpc-premium-badge,
.dpc-gate-wrap    > .dpc-premium-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

/* Inline context (comparisons side list, recipe card) */
.nc-list-item > .dpc-premium-badge {
    position: static;
    margin-bottom: 4px;
    display: block;
    width: fit-content;
    font-size: 10px;
    padding: 2px 8px;
}

/* ── RTL support ─────────────────────────────────────────────────── */
[dir="rtl"] .nett-postcard > .dpc-premium-badge,
[dir="rtl"] .npl-card      > .dpc-premium-badge,
[dir="rtl"] .nc-main-card  > .dpc-premium-badge,
[dir="rtl"] .nct-row       > .dpc-premium-badge,
[dir="rtl"] .dpc-gate-wrap > .dpc-premium-badge {
    right: auto;
    left: 10px;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media ( max-width: 480px ) {
    .dpc-gate-panel {
        padding: 18px 14px 16px;
        border-radius: 12px;
        max-width: 220px;
    }

    .dpc-gate-icon {
        width: 40px;
        height: 40px;
    }

    .dpc-gate-icon svg {
        width: 18px;
        height: 18px;
    }

    .dpc-gate-title { font-size: 14px; }
    .dpc-gate-msg   { font-size: 12px; }
    .dpc-gate-btn   { font-size: 12px; padding: 8px 16px; }
}
