/**
 * ExtraTV Cards — v1.17.11 — Section Titles CSS.
 *
 * Production patch — fixes:
 *
 *  T3. Color presets reliable on real frontend. Variables are scoped on
 *      .extratv-premium-section-title itself (not only :root) so theme-level
 *      cascade or aggressive page-cache plugins can't strip them.
 *
 *  T4. Boxed style works on mobile. v1.17.1 used color-mix() which is
 *      unsupported on older mobile Safari and many in-app webviews. All
 *      boxed-style colors are now driven by pre-baked rgba variables
 *      emitted from PHP (--extratv-title-box-border-rgba and
 *      --extratv-title-box-glow-rgba) — no color-mix() needed.
 *
 *  T11. FOUC / CLS reduced. Layout-affecting rules (min-height reservation,
 *      flex layout, icon dimensions) are at the top of the file and ALSO
 *      inlined in <head> at priority 1 so they apply before any other
 *      stylesheet loads.
 *
 * Scope: every selector is namespaced under .extratv-premium-section-title
 * or its BEM modifiers. No card / badge / logo / checkout selectors.
 */

/* ---------------------------------------------------------------------------
   Critical layout block — first paint stability (T11).
   These rules MUST apply on first paint to prevent CLS. They are repeated
   inline in <head> by extratv_cards_print_premium_titles_vars_head() at
   priority 1 (the earliest reasonable hook) so they are present before
   any other stylesheet — including any cached/minified bundles.
--------------------------------------------------------------------------- */

.extratv-premium-section-title {
    /* Variable safety net — applies if the inline :root vars are stripped
       by an aggressive cache plugin or theme override. Same values as the
       neon_pink_purple preset emitted from PHP. */
    --extratv-title-g1: #ff6a00;
    --extratv-title-g2: #ff1493;
    --extratv-title-g3: #9d4edd;
    --extratv-title-icon:   #e879f9;
    --extratv-title-star:   #ff6a00;
    --extratv-title-line-a: #ff6a00;
    --extratv-title-line-b: #9d4edd;
    --extratv-title-dot:    #ff1493;
    --extratv-title-sub:    #cbd5e1;
    --extratv-title-box-border: #9d4edd;
    --extratv-title-box-glow:   #ff1493;
    /* Pre-baked rgba — T4 fix. Replaces color-mix() so boxed style works
       on every browser including older mobile Safari and in-app webviews. */
    --extratv-title-box-border-rgba: rgba(157, 78, 221, 0.55);
    --extratv-title-box-glow-rgba:   rgba(255, 20, 147, 0.28);
    --extratv-title-box-inner-rgba:  rgba(255, 20, 147, 0.22);
    --extratv-title-size-d: 28px;
    --extratv-title-size-m: 20px;
    --extratv-title-sub-d:  14px;
    --extratv-title-sub-m:  12px;
    --extratv-title-top:    24px;
    --extratv-title-bottom: 24px;

    /* Layout (critical for CLS). */
    display: block;
    width: 100%;
    margin: var(--extratv-title-top) auto var(--extratv-title-bottom) auto;
    max-width: 800px;
    font-family: 'Tajawal', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    box-sizing: border-box;
    /* Reserve a minimum block so the cards container below doesn't jump
       between the head emit and the external stylesheet load. */
    min-height: 72px;
}

.extratv-premium-section-title * {
    box-sizing: border-box;
}

.extratv-premium-section-title__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

/* Hard pixel dimensions on the SVG — T11. Inlined in head too. */
.extratv-premium-section-title__icon {
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0;
    stroke: var(--extratv-title-icon);
    color: var(--extratv-title-icon);
    filter: drop-shadow(0 0 6px var(--extratv-title-icon));
}

/* ---------------------------------------------------------------------------
   Accent bar — thin neon lines, small stars, optional small icons.
--------------------------------------------------------------------------- */

.extratv-premium-section-title__accent-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 280px;
    gap: 12px;
    margin-bottom: 2px;
}

.extratv-premium-section-title__line {
    flex-grow: 1;
    height: 1.5px;
    opacity: 0.85;
    border-radius: 1px;
}

.extratv-premium-section-title__line--right {
    background: linear-gradient(90deg, transparent, var(--extratv-title-line-a));
}

.extratv-premium-section-title__line--left {
    background: linear-gradient(270deg, transparent, var(--extratv-title-line-b));
}

.extratv-premium-section-title__star {
    color: var(--extratv-title-star);
    font-size: 12px;
    line-height: 1;
    text-shadow: 0 0 8px var(--extratv-title-star);
    flex-shrink: 0;
}

.extratv-premium-section-title__icon-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ---------------------------------------------------------------------------
   Heading — gradient text with admin-controlled font sizes.
--------------------------------------------------------------------------- */

.extratv-premium-section-title__heading {
    font-size: var(--extratv-title-size-d);
    font-weight: 800;
    margin: 0;
    padding: 0;
    line-height: 1.3;
    background: linear-gradient(to left, var(--extratv-title-g1), var(--extratv-title-g2), var(--extratv-title-g3));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    width: 100%;
    max-width: 100%;
    text-align: center;
    overflow: visible;
    text-overflow: clip;
}

.extratv-premium-section-title__nowrap {
    white-space: nowrap;
}

/* v1.17.11 — Section Header Mobile Text Fix.
   Keep admin-entered titles on one line without clipping on mobile.
   Scope is limited to section headers only. */
.extratv-premium-section-title__lang,
.extratv-premium-section-title__nowrap {
    max-width: 100%;
    min-width: 0;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}
.extratv-premium-section-title__lang--en {
    direction: ltr;
    unicode-bidi: isolate;
}
.extratv-premium-section-title__lang--ar {
    direction: rtl;
    unicode-bidi: isolate;
}

/* Robust fallback: when the new premium title is printed, keep the legacy
   title/divider hidden even if old settings were saved before this version. */
.extratv-premium-section-title[data-context="auto"] + .section-title,
.extratv-premium-section-title[data-context="auto"] + .section-title + .section-divider,
.extratv-premium-section-title[data-context="auto"] + .group-break,
.extratv-premium-section-title[data-context="auto"] + .group-break + .section-divider {
    display: none !important;
}

/* ---------------------------------------------------------------------------
   Subtitle.
--------------------------------------------------------------------------- */

.extratv-premium-section-title__subtitle {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    font-size: var(--extratv-title-sub-d);
    font-weight: 500;
    color: var(--extratv-title-sub);
    line-height: 1.4;
}

.extratv-premium-section-title__dot {
    color: var(--extratv-title-dot);
    font-size: 16px;
    line-height: 0;
    text-shadow: 0 0 8px var(--extratv-title-dot);
}

/* ---------------------------------------------------------------------------
   Boxed style (T4 + T5) — compact glass/neon container.
   T4 root-cause fix: uses pre-baked rgba CSS variables instead of
   color-mix(). Works on every browser including mobile Safari ≤14.
--------------------------------------------------------------------------- */

.extratv-premium-section-title--boxed .extratv-premium-section-title__inner {
    position: relative;
    padding: 16px 20px;
    border-radius: 14px;
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.04), transparent 60%),
        rgba(15, 15, 20, 0.45);
    /* Pre-baked rgba — no color-mix dependency. */
    box-shadow:
        inset 0 0 14px 0 var(--extratv-title-box-inner-rgba),
        0 0 14px 0 var(--extratv-title-box-glow-rgba);
    border: 1px solid var(--extratv-title-box-border-rgba);
}

/* ---------------------------------------------------------------------------
   Mobile — compact sizing, tighter spacing, smaller icon.
   T4: explicit boxed-on-mobile rules so the border/shadow/radius don't get
   stripped by the responsive layout reset.
--------------------------------------------------------------------------- */

@media (max-width: 768px) {
    .extratv-premium-section-title {
        width: 100%;
        max-width: min(800px, calc(100vw - 16px));
        padding: 0 8px;
        min-height: 60px;
        overflow: visible;
    }
    .extratv-premium-section-title__inner {
        gap: 6px;
    }
    .extratv-premium-section-title__heading {
        font-size: min(var(--extratv-title-size-m), 5.15vw);
        letter-spacing: -0.35px;
        line-height: 1.22;
        max-width: calc(100vw - 24px);
        margin-left: auto;
        margin-right: auto;
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
    }
    .extratv-premium-section-title__lang {
        display: inline-block;
        max-width: 100%;
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
    }
    html[lang^="en"] .extratv-premium-section-title__lang--en {
        font-size: min(1em, 4.65vw);
    }
    .extratv-premium-section-title__subtitle {
        font-size: var(--extratv-title-sub-m);
        gap: 6px;
    }
    .extratv-premium-section-title__accent-bar {
        max-width: 200px;
        gap: 8px;
    }
    .extratv-premium-section-title__icon {
        width: 20px !important;
        height: 20px !important;
    }
    .extratv-premium-section-title__star {
        font-size: 10px;
    }
    .extratv-premium-section-title__dot {
        font-size: 14px;
    }

    /* T4 — explicit mobile boxed style. Same recipe as desktop but with
       slightly smaller padding so the box doesn't push cards too far down.
       All visual properties (background, border, box-shadow, radius) are
       re-declared explicitly so they survive any responsive reset and are
       NOT overridden by the generic mobile rule above. */
    .extratv-premium-section-title--boxed .extratv-premium-section-title__inner {
        padding: 12px 14px;
        border-radius: 12px;
        background:
            radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.04), transparent 60%),
            rgba(15, 15, 20, 0.45);
        box-shadow:
            inset 0 0 12px 0 var(--extratv-title-box-inner-rgba),
            0 0 12px 0 var(--extratv-title-box-glow-rgba);
        border: 1px solid var(--extratv-title-box-border-rgba);
    }
}

/* ---------------------------------------------------------------------------
   Admin Live Preview stage (T5).
--------------------------------------------------------------------------- */

.extratv-pst-preview-stage {
    background:
        radial-gradient(120% 120% at 50% 0%, rgba(157, 78, 221, 0.12), transparent 60%),
        radial-gradient(80% 80% at 100% 100%, rgba(255, 106, 0, 0.10), transparent 60%),
        #131320;
    border-radius: 12px;
    padding: 32px 16px;
    color: #e5e7eb;
    overflow: hidden;
}

.extratv-pst-preview-stage .extratv-premium-section-title {
    margin-top: 12px;
    margin-bottom: 12px;
}

/* ---------------------------------------------------------------------------
   ???? cleanup tool report (T8) — admin-page only.
--------------------------------------------------------------------------- */

.extratv-pst-scan-report {
    margin: 12px 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
.extratv-pst-scan-report table {
    width: 100%;
    border-collapse: collapse;
}
.extratv-pst-scan-report th,
.extratv-pst-scan-report td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}
.extratv-pst-scan-report th {
    background: #f8fafc;
    font-weight: 600;
}
.extratv-pst-scan-report tr:last-child td { border-bottom: 0; }
.extratv-pst-scan-report__count {
    display: inline-block;
    background: #fee2e2;
    color: #991b1b;
    padding: 1px 8px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
}
.extratv-pst-scan-report__count--ok {
    background: #dcfce7;
    color: #166534;
}

/* v1.17.5 — Section Titles Per Group language visibility */
.extratv-premium-section-title__lang{display:inline-flex;align-items:center;justify-content:center;gap:inherit;}
.extratv-premium-section-title__lang--en{display:none;}
html[lang^="en"] .extratv-premium-section-title__lang--ar{display:none !important;}
html[lang^="en"] .extratv-premium-section-title__lang--en{display:inline-flex !important;}
html[lang^="ar"] .extratv-premium-section-title__lang--ar{display:inline-flex !important;}
html[lang^="ar"] .extratv-premium-section-title__lang--en{display:none !important;}
