/* =========================================================
   EWI ANALYSIS PLUGIN — FRONTEND STYLES
   Covers: feed grid, cards, modal, single, submit form
   ========================================================= */

/* =========================================================
   FEED GRID
   ========================================================= */

.ap-feed-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: var(--space-8, 2rem);
    padding-bottom: var(--space-8, 2rem);
    width: 100%;
}
@media (max-width: 1199px) { .ap-feed-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width:  767px) { .ap-feed-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width:  479px) { .ap-feed-grid { grid-template-columns: 1fr; } }

.ap-wave-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.ap-form-hint {
    font-size: 12px;
    color: #8fa8c8;
    margin-top: -8px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .ap-wave-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .ap-wave-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   CARD
   ========================================================= */

.ap-analysis-card {
    background: var(--bg-alt, #1a1a1a);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 0.5rem);
    padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
    transition:
        transform var(--anim-med, 0.2s) ease,
        box-shadow var(--anim-med, 0.2s) ease,
        border-color var(--anim-med, 0.2s) ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.ap-analysis-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}

/* =========================================================
   THUMBNAIL
   ========================================================= */

.ap-analysis-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius-md, 8px);
}

.ap-analysis-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--anim-med, 0.2s) ease;
    display: block;
}

.ap-analysis-card:hover .ap-analysis-thumb img {
    transform: scale(1.03);
}

.ap-blurred img {
    filter: blur(6px);
}

/* =========================================================
   AUTHOR BAR
   ========================================================= */

.ap-card-author {
    display: flex;
    align-items: center;
    gap: var(--space-2, 0.5rem);
}

.ap-card-author__avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.ap-card-author__name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text, #fff);
    display: block;
}

.ap-card-author__meta {
    font-size: 0.75rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
    display: block;
}

/* =========================================================
   ENGAGEMENT BAR
   ========================================================= */

.ap-card-engagement {
    display: flex;
    align-items: center;
    gap: var(--space-3, 0.75rem);
    font-size: 0.8rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
}

.ap-engagement-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ap-like-btn,
.ap-follow-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted, rgba(255,255,255,0.55));
    padding: 5px 14px;
    min-height: 32px;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    font-family: inherit;
}

/* Admin-only "identified members" toggle — inherits .ap-engagement-stat's
   flex/gap look, just adds button-reset + hover affordance since it's
   interactive (the plain view-count span next to it isn't). */
.ap-engagement-viewers-toggle {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-size: 0.8125rem;
    color: inherit;
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}
.ap-engagement-viewers-toggle:hover { color: var(--accent, #4DA3FF); }

.ap-engagement-viewers-list {
    width: 100%;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.8125rem;
}

.ap-viewers-list__loading,
.ap-viewers-list__empty {
    margin: 0;
    color: var(--text-muted, rgba(255,255,255,0.55));
}

.ap-viewers-list__rows {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ap-viewers-list__row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.ap-viewers-list__row:last-child { border-bottom: none; padding-bottom: 0; }

.ap-viewers-list__name { font-weight: 600; }
.ap-viewers-list__email { color: var(--text-muted, rgba(255,255,255,0.55)); }
.ap-viewers-list__time { margin-left: auto; color: var(--text-muted, rgba(255,255,255,0.55)); white-space: nowrap; }

.ap-like-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.35);
    color: #ff6b6b;
}

.ap-like-btn--liked {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.45);
    color: #ff6b6b;
}

.ap-follow-btn {
    background: rgba(77, 163, 255, 0.08);
    border-color: rgba(77, 163, 255, 0.3);
    color: #4da3ff;
}

.ap-follow-btn:hover {
    background: rgba(77, 163, 255, 0.16);
    border-color: rgba(77, 163, 255, 0.5);
    color: #4da3ff;
}

.ap-follow-btn--following {
    background: rgba(77, 163, 255, 0.14);
    border-color: rgba(77, 163, 255, 0.4);
    color: #4da3ff;
}

.ap-like-count {
    font-size: 0.8125rem;
    font-weight: 600;
}

/* =========================================================
   BADGES
   ========================================================= */

.ap-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1, 0.25rem);
}

.ap-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full, 999px);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: var(--text-muted, rgba(255,255,255,0.5));
}

.ap-badge--market {
    background: rgba(255,255,255,0.08);
    color: var(--text-muted, rgba(255,255,255,0.5));
}

.ap-badge--category {
    background: rgba(0,200,255,0.12);
    color: #00c8ff;
    border-color: rgba(0,200,255,0.2);
}

.ap-badge--locked {
    background: rgba(255,200,0,0.12);
    color: #ffc107;
    border-color: rgba(255,200,0,0.2);
}

.ap-badge--released {
    background: rgba(0,200,100,0.12);
    color: #00c864;
    border-color: rgba(0,200,100,0.2);
}

.ap-badge--premium {
    background: rgba(255,200,0,0.12);
    color: #ffc107;
    border-color: rgba(255,200,0,0.2);
}

.ap-badge--free {
    background: rgba(76,175,114,0.10);
    color: #4caf72;
    border-color: rgba(76,175,114,0.2);
}

.ap-card-featured-badge {
    background: var(--accent, #00c8ff);
    color: #000;
    border-color: transparent;
}

/* =========================================================
   TITLE & META
   ========================================================= */

.ap-analysis-title {
    margin: 0;
    font-size: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
    line-height: 1.3;
    color: var(--text, #fff);
}

.ap-analysis-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2, 0.5rem);
    font-size: 0.75rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
    flex-wrap: wrap;
}

.ap-timeframe {
    font-size: 0.75rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
}

.ap-next-update {
    font-size: 0.75rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
}

/* Bias colours */
.ap-bias {
    font-weight: 600;
    font-size: 0.75rem;
}

.ap-bias-bullish { color: #4dff4d; }
.ap-bias-bearish { color: #ff6b6b; }
.ap-bias-neutral { color: #ffc107; }

/* =========================================================
   SUMMARY
   ========================================================= */

.ap-summary {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =========================================================
   ACTIONS
   ========================================================= */

.ap-analysis-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2, 0.5rem);
    margin-top: auto;
    padding-top: var(--space-1, 0.25rem);
}

.ap-bias-stamp {
    height: 40px;
    width: auto;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.ap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2, 0.5rem) var(--space-4, 1rem);
    border-radius: var(--radius-md, 8px);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--anim-fast, 0.15s) ease;
    border: none;
    background: var(--accent, #00c8ff);
    color: #000;
    text-decoration: none;
}

.ap-btn:hover {
    background: var(--accent-hover, #00a8d8);
}

.ap-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2, 0.5rem) var(--space-4, 1rem);
    border-radius: var(--radius-md, 8px);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--anim-fast, 0.15s) ease;
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    background: transparent;
    color: var(--text, #fff);
    text-decoration: none;
}

.ap-btn-secondary:hover {
    border-color: var(--accent, #00c8ff);
    color: var(--accent, #00c8ff);
}

.ap-btn-upgrade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2, 0.5rem) var(--space-4, 1rem);
    border-radius: var(--radius-md, 8px);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #000;
    border: none;
    text-decoration: none;
    transition: opacity var(--anim-fast, 0.15s) ease;
}

.ap-btn-upgrade:hover {
    opacity: 0.9;
}

/* =========================================================
   FILTER BAR EXTENSIONS — group, reset, turning bias, asset scroll
   ========================================================= */

/* Group container for Category + Asset dropdowns */
.ap-filterbar__group { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* Separator line between groups */
.ap-filterbar__sep {
    width: 1px; height: 20px;
    background: var(--border, rgba(255,255,255,.08));
    flex-shrink: 0; margin: 0 2px;
}

/* Turning bias accent colours */
.ap-dd-item--turning-bullish { color: #4da3ff; }
.ap-dd-item--turning-bearish { color: #f5a623; }

/* Reset button — only visible when .ap-filterbar--active */
.ap-filterbar__reset {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 10px; border-radius: 7px;
    border: 1px solid rgba(255,80,80,.2);
    background: rgba(255,80,80,.06);
    color: #ff7070; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit; white-space: nowrap;
    transition: all .15s; flex-shrink: 0;
}
.ap-filterbar__reset:hover { background: rgba(255,80,80,.15); border-color: rgba(255,80,80,.4); }
.ap-filterbar:not(.ap-filterbar--active) .ap-filterbar__reset { display: none; }

/* Active filter tags strip below the bar */
.ap-filterbar__tags {
    display: flex; gap: 4px; flex-wrap: wrap;
    margin-bottom: 12px; min-height: 0;
}
.ap-filterbar__tags:empty { margin-bottom: 0; }
.ap-active-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px;
    background: rgba(77,163,255,.12); border: 1px solid rgba(77,163,255,.3);
    border-radius: 999px; font-size: 11px; color: var(--accent, #4da3ff); white-space: nowrap;
}
.ap-active-tag button { background: none; border: none; color: inherit; cursor: pointer; padding: 0; font-size: 13px; line-height: 1; }

/* =========================================================
   UNIFIED PCARD — ewi-pcard design used across all feeds
   ========================================================= */

.ewi-pcard {
    background: var(--bg-alt, #1a1a1a);
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
    transition: border-color .15s, transform .15s;
}
.ewi-pcard:hover { border-color: rgba(77,163,255,.25); transform: translateY(-2px); }
.ewi-pcard--admin { border-top: 2px solid rgba(77,163,255,.2); }
.ewi-pcard__thumb { display: block; position: relative; aspect-ratio: 16/9; overflow: hidden; }
.ewi-pcard__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.ewi-pcard:hover .ewi-pcard__thumb img { transform: scale(1.03); }
.ewi-pcard__thumb--blurred img { filter: blur(10px); }
.ewi-pcard__badge { position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.ewi-pcard__badge--premium { background: rgba(77,163,255,.9); color: #000; }
.ewi-pcard__badge--free { background: rgba(76,175,114,.9); color: #000; }
.ewi-pcard__badge--released { background: rgba(255,193,7,.8); color: #000; font-size: 10px; position: absolute; bottom: 10px; right: 10px; top: auto; }
.ewi-pcard__badge--gallery { background: rgba(0,0,0,.65); color: #fff; position: absolute; bottom: 10px; left: 10px; top: auto; right: auto; }
.ewi-pcard__body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.ewi-pcard__meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.ewi-pcard__type { font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.ewi-pcard__type--market-hub { color: #4da3ff; background: rgba(77,163,255,.1); }
.ewi-pcard__type--intraday { color: #f5a623; background: rgba(245,166,35,.1); }
.ewi-pcard__type--pattern-recognition { color: #a855f7; background: rgba(168,85,247,.1); }
.ewi-pcard__type--blog-post { color: #4caf72; background: rgba(76,175,114,.1); }
.ewi-pcard__cat { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted, rgba(255,255,255,.5)); }
.ewi-pcard__tf { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent, #4da3ff); background: rgba(77,163,255,.08); padding: 2px 7px; border-radius: 4px; }
.ewi-pcard__market { font-size: 11px; color: var(--text-muted, rgba(255,255,255,.5)); background: rgba(255,255,255,.05); padding: 2px 7px; border-radius: 4px; }
.ewi-pcard__scenario { font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.ewi-pcard__scenario--primary { color: var(--text-muted, rgba(255,255,255,.5)); background: rgba(255,255,255,.05); }
.ewi-pcard__scenario--alternate { color: #f5a623; background: rgba(245,166,35,.1); }
.ewi-pcard .ap-bias-stamp { height: 28px; width: auto; flex-shrink: 0; }
.ewi-pcard__date { font-size: 12px; color: var(--text-muted, rgba(255,255,255,.5)); margin-left: auto; }
.ewi-pcard__title { font-size: .9375rem; font-weight: 700; color: var(--text, #fff); margin: 0 0 8px; line-height: 1.4; }
.ewi-pcard__title a { color: inherit; text-decoration: none; }
.ewi-pcard__title a:hover { color: var(--accent, #4da3ff); }
.ewi-pcard__excerpt { font-size: .8125rem; color: var(--text-muted, rgba(255,255,255,.5)); line-height: 1.6; margin: 0 0 14px; flex: 1; }
.ewi-pcard__actions { display: flex; align-items: center; gap: 10px; margin-top: auto; }
.ewi-pcard__link { font-size: .8125rem; font-weight: 600; color: var(--accent, #4da3ff); text-decoration: none; }
.ewi-pcard__link:hover { text-decoration: underline; }
.ewi-pcard__actions .ap-btn { font-size: .8125rem; padding: 5px 12px; }

@media (max-width: 768px) {
    .ewi-pcard__body { padding: 12px; }
}

/* ── SHARE ROW — shared by the single-post page, feed cards, and Quick
   View, so it lives here rather than the single-page-only stylesheet.
   Page-specific spacing (e.g. the single post's gutter padding) stays in
   each page's own CSS file, layered on top of these base rules. ────── */

.as-share-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.as-share-row__label {
    font-size: 0.75rem;
    color: var(--text-muted, rgba(255,255,255,.5));
    margin-right: 4px;
}

.as-share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    line-height: 1;
    flex-shrink: 0;
    transition: opacity 0.15s ease;
}

.as-share-btn:hover { opacity: 0.85; }

.as-share-btn--facebook { background: #1877f2; }
.as-share-btn--x        { background: #000; }
.as-share-btn--linkedin { background: #0a66c2; }
.as-share-btn--reddit   { background: #ff4500; }
.as-share-btn--telegram { background: #26a5e4; }
.as-share-btn--whatsapp { background: #25d366; }
.as-share-btn--email    { background: #6b7280; }

/* Compact variant — feed cards, inline within .ewi-pcard__actions */
.as-share-row--compact { gap: 6px; }
.as-share-row--compact .as-share-btn { width: 20px; height: 20px; font-size: 0.6rem; }

/* =========================================================
   QUICK VIEW MODAL — Redesigned
   ========================================================= */

/* Overlay */
.ap-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.8);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 9999;
}

.ap-modal-overlay.ap-modal--active,
.ap-modal-overlay:target {
    display: flex;
}

/* Prevent body scroll when modal open */
body.ap-modal-open {
    overflow: hidden;
}

/* Modal container */
.ap-modal {
    background: var(--bg-alt, #111827);
    width: min(860px, 100%);
    max-height: min(90vh, 800px);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
    position: relative;
    animation: apModalIn .2s ease;
}

@keyframes apModalIn {
    from { opacity: 0; transform: scale(.97) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── HEADER ── */
.ap-modal-header {
    padding: 20px 24px 16px;
    background: var(--bg, #0d1117);
    border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
    flex-shrink: 0;
}

.ap-modal-header__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.ap-modal-header__badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

/* Bias pill in header */
.ap-modal-bias {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 3px 8px;
    border-radius: 50px;
    border: 1px solid;
}

.ap-modal-bias.ap-bias-bullish {
    color: #4dff4d;
    background: rgba(77,255,77,.08);
    border-color: rgba(77,255,77,.2);
}

.ap-modal-bias.ap-bias-bearish {
    color: #ff6b6b;
    background: rgba(255,107,107,.08);
    border-color: rgba(255,107,107,.2);
}

.ap-modal-bias.ap-bias-neutral {
    color: #ffc107;
    background: rgba(255,193,7,.08);
    border-color: rgba(255,193,7,.2);
}

/* Close button */
.ap-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    color: var(--text-muted, rgba(255,255,255,.5));
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}

.ap-modal-close:hover {
    background: rgba(255,255,255,.1);
    color: var(--text, #fff);
}

/* Title */
.ap-modal-title {
    font-size: clamp(1rem, 1.25vw + .5rem, 1.375rem);
    font-weight: 700;
    color: var(--text, #fff);
    margin: 0 0 12px;
    line-height: 1.3;
    padding-right: 8px;
}

/* Meta row */
.ap-modal-header__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.ap-modal-date {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .8rem;
    color: var(--text-muted, rgba(255,255,255,.5));
}

/* ── BODY ── */
.ap-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Chart */
.ap-modal-chart {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background: var(--bg, #0d1117);
    border: 1px solid var(--border, rgba(255,255,255,.08));
}

.ap-modal-chart img {
    width: 100%;
    display: block;
    border-radius: 10px;
}

.ap-modal-chart.ap-blurred img {
    filter: blur(8px);
}

.ap-modal-chart__blur-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted, rgba(255,255,255,.5));
    font-size: .875rem;
    font-weight: 500;
}

/* Sections */
.ap-modal-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ap-modal-section__title {
    font-size: .8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted, rgba(255,255,255,.4));
    margin: 0;
}

.ap-modal-section__text {
    font-size: .9375rem;
    color: var(--text, #fff);
    line-height: 1.7;
    margin: 0;
}

/* Confluences */
.ap-modal-confluences {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ap-modal-confluence-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg, #0d1117);
    border: 1px solid var(--border, rgba(255,255,255,.06));
    border-radius: 8px;
}

.ap-modal-confluence-item__left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.ap-confluence-desc {
    font-size: .875rem;
    color: var(--text, #fff);
    line-height: 1.4;
}

.ap-confluence-level {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--accent, #4DA3FF);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ── FOOTER ── */
.ap-modal-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px;
    background: var(--bg, #0d1117);
    border-top: 1px solid var(--border, rgba(255,255,255,.08));
    flex-shrink: 0;
    flex-wrap: wrap;
}

.ap-modal-close-btn {
    margin-left: auto;
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
    .ap-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .ap-modal {
        width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        animation: apModalInMobile .25s ease;
    }

    @keyframes apModalInMobile {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    .ap-modal-header {
        padding: 16px 18px 14px;
    }

    .ap-modal-body {
        padding: 16px 18px;
    }

    .ap-modal-footer {
        padding: 14px 18px;
    }

    .ap-modal-footer .ap-modal-close-btn {
        display: none;
    }
}


/* =========================================================
   SINGLE / FULL VIEW
   ========================================================= */

.ap-full-analysis {
    max-width: var(--container, 1280px);
    margin-inline: auto;
    padding: var(--space-12, 3rem) var(--space-4, 1rem);
}

.ap-full-header {
    margin-bottom: var(--space-8, 2rem);
}

.ap-full-title {
    margin: 0 0 var(--space-3, 0.75rem);
    font-size: clamp(1.8rem, 1.2rem + 2vw, 3rem);
    line-height: 1.2;
    color: var(--text, #fff);
}

.ap-full-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3, 0.75rem);
    color: var(--text-muted, rgba(255,255,255,0.5));
    font-size: 0.875rem;
}

.ap-full-chart img {
    width: 100%;
    border-radius: var(--radius-lg, 12px);
    margin-bottom: var(--space-8, 2rem);
}

.ap-full-section {
    margin-bottom: var(--space-6, 1.5rem);
}

.ap-full-levels {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ap-full-levels li {
    padding: var(--space-2, 0.5rem) 0;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
    font-size: 0.875rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
}

/* =========================================================
   COMMENTS
   ========================================================= */

.ap-comments-section {
    margin-top: var(--space-10, 2.5rem);
    border-top: 1px solid var(--border, rgba(255,255,255,0.1));
    padding-top: var(--space-8, 2rem);
}

.ap-comments {
    display: flex;
    flex-direction: column;
    gap: var(--space-4, 1rem);
    margin-bottom: var(--space-6, 1.5rem);
}

.ap-comment-composer {
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 0.5rem);
}

.ap-comment-textarea {
    width: 100%;
    min-height: 80px;
    background: var(--bg-alt, #1a1a1a);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: var(--radius-md, 8px);
    color: var(--text, #fff);
    padding: var(--space-3, 0.75rem);
    font-size: 0.875rem;
    resize: vertical;
    font-family: inherit;
}

.ap-comment-textarea:focus {
    outline: none;
    border-color: var(--accent, #00c8ff);
}

.ap-comment-submit-row {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2, 0.5rem);
}

.ap-comment-cancel {
    background: none;
    border: none;
    color: var(--text-muted, rgba(255,255,255,0.5));
    cursor: pointer;
    font-size: 0.875rem;
}

/* =========================================================
   SUBMIT FORM
   ========================================================= */

.ap-submit-wrapper {
    max-width: 860px;
    margin-inline: auto;
    padding: var(--space-12, 3rem) var(--space-4, 1rem);
}

.ap-submit-header {
    margin-bottom: var(--space-6, 1.5rem);
}

/* Form tab navigation */
.ap-form-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 28px;
}

.ap-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 7px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted, rgba(255,255,255,0.5));
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.ap-tab-btn:hover {
    color: var(--text, #fff);
    background: rgba(255,255,255,0.04);
}

.ap-tab-btn.is-active {
    background: var(--accent, #4da3ff);
    color: #000;
}

/* Premium field visibility */
.ap-premium-field.is-hidden {
    display: none !important;
}

/* Pattern variation card grid */
.ap-variation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    margin-top: 4px;
}

.ap-variation-card {
    padding: 12px 14px;
    text-align: center;
    background: rgba(255,255,255,0.04);
    border: 2px solid var(--border, rgba(255,255,255,0.07));
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text, #fff);
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
    line-height: 1.3;
}

.ap-variation-card:hover {
    border-color: rgba(77,163,255,0.3);
    background: rgba(77,163,255,0.04);
}

.ap-variation-card.is-selected {
    border-color: var(--accent, #4da3ff);
    background: rgba(77,163,255,0.1);
    color: var(--accent, #4da3ff);
}

/* Edit mode banner */
.ap-edit-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 16px;
    margin-bottom: 20px;
    background: rgba(245,166,35,0.08);
    border: 1px solid rgba(245,166,35,0.25);
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
}

.ap-edit-banner strong { color: var(--text, #fff); }
.ap-edit-banner a { color: var(--accent, #4da3ff); }

/* Existing chart thumbnail preview in edit mode */
.ap-thumb-preview img {
    max-width: 200px;
    border-radius: 6px;
    display: block;
    margin-bottom: 6px;
}

.ap-analysis-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text, #fff);
    margin-bottom: var(--space-1, 0.25rem);
}

.ap-analysis-form input[type="text"],
.ap-analysis-form input[type="url"],
.ap-analysis-form input[type="date"],
.ap-analysis-form select,
.ap-analysis-form textarea {
    width: 100%;
    background: var(--bg, #111);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: var(--radius-md, 8px);
    color: var(--text, #fff);
    padding: var(--space-3, 0.75rem);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color var(--anim-fast, 0.15s) ease;
}

.ap-analysis-form input:focus,
.ap-analysis-form select:focus,
.ap-analysis-form textarea:focus {
    outline: none;
    border-color: var(--accent, #00c8ff);
}

.ap-analysis-form textarea {
    min-height: 120px;
    resize: vertical;
}

@media (max-width: 640px) {
    .ap-form-tabs { flex-direction: column; }
    .ap-variation-grid { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 640px) {
    .ap-modal {
        width: 95vw;
    }

    .ap-analysis-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .ap-btn,
    .ap-btn-secondary {
        text-align: center;
    }
}
.ap-analysis-card {
    margin-bottom: var(--space-2, 0.5rem);
}

/* Fix button text visibility on hover */
.ap-btn:hover {
    color: #000;
}
.ap-btn-secondary:hover {
    color: var(--accent, #00c8ff);
}
.ap-btn-upgrade {
    color: #000 !important;
}
.ap-btn-upgrade:hover {
    color: #000 !important;
    opacity: 0.9;
}

/* =========================================================
   ANALYSIS FEED PAGE — LAYOUT
   ========================================================= */
.ewi-analysis-feed {
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
    box-sizing: border-box;
}
@media (max-width: 768px) {
    .ewi-analysis-feed { padding: 0 8px; }
}

.ewi-analysis-feed__header {
    margin-bottom: var(--space-8, 2rem);
}

.ewi-analysis-feed__title {
    margin: 0 0 8px;
    font-size: clamp(1.8rem, 1.2rem + 2vw, 3rem);
    color: var(--text, #fff);
}

.ewi-analysis-feed__subtitle {
    color: var(--text-muted, rgba(255,255,255,0.5));
    margin: 0;
}

/* =========================================================
   LIGHT MODE FIXES — ANALYSIS CARDS
   ========================================================= */
body.light-mode .ap-analysis-card {
    background: #ffffff;
    border-color: rgba(0,0,0,0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body.light-mode .ap-analysis-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-color: rgba(0,0,0,0.15);
}

body.light-mode .ap-analysis-title {
    color: #1a1a1a;
}

body.light-mode .ap-analysis-meta,
body.light-mode .ap-summary,
body.light-mode .ap-card-author__name,
body.light-mode .ap-card-author__meta,
body.light-mode .ap-card-engagement {
    color: #555;
}

body.light-mode .ap-btn-secondary {
    border-color: rgba(0,0,0,0.15);
    color: #1a1a1a;
}

body.light-mode .ap-btn-secondary:hover {
    border-color: var(--accent, #0078ff);
    color: var(--accent, #0078ff);
}

body.light-mode .ewi-analysis-feed__title {
    color: #1a1a1a;
}

body.light-mode .ewi-analysis-feed__subtitle {
    color: #555;
}

/* ANALYSIS FEED LAYOUT — duplicate rules removed; block rules above are authoritative */

/* LIGHT MODE — ANALYSIS CARDS */
body.light-mode .ap-analysis-card { background: #ffffff; border-color: rgba(0,0,0,0.1); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
body.light-mode .ap-analysis-title { color: #1a1a1a; }
body.light-mode .ap-analysis-meta, body.light-mode .ap-summary, body.light-mode .ap-card-author__name, body.light-mode .ap-card-author__meta, body.light-mode .ap-card-engagement { color: #555; }
body.light-mode .ap-btn-secondary { border-color: rgba(0,0,0,0.15); color: #1a1a1a; }
body.light-mode .ap-btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
body.light-mode .ewi-analysis-feed__title { color: #1a1a1a; }
body.light-mode .ewi-analysis-feed__subtitle { color: #555; }

body.light-mode .ap-badge--locked   { background: rgba(180,120,0,0.15); color: #8a6000; border-color: rgba(180,120,0,0.3); }
body.light-mode .ap-badge--premium  { background: rgba(180,120,0,0.15); color: #8a6000; border-color: rgba(180,120,0,0.3); }
body.light-mode .ap-badge--free     { background: rgba(30,120,60,0.12); color: #1a6b38; border-color: rgba(30,120,60,0.25); }
body.light-mode .ap-badge--category { background: rgba(0,100,200,0.1); color: #0050aa; border-color: rgba(0,100,200,0.2); }
body.light-mode .ap-badge--market { background: rgba(0,0,0,0.06); color: #333; border-color: rgba(0,0,0,0.12); }

body.light-mode .ap-follow-btn { background: rgba(77,163,255,.07); border-color: rgba(77,163,255,.25); color: #0066cc; }
body.light-mode .ap-follow-btn:hover { background: rgba(77,163,255,.14); color: #0066cc; }
body.light-mode .ap-like-btn { background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.1); color: #555; }
body.light-mode .ap-card-author__name { color: #1a1a1a; }
body.light-mode .ap-card-author__meta { color: #666; }
body.light-mode .ap-engagement-stat { color: #666; }
body.light-mode .ap-engagement-viewers-toggle:hover { color: var(--accent, #0078ff); }
body.light-mode .ap-engagement-viewers-list { background: rgba(0,0,0,.03); border-color: rgba(0,0,0,.1); }
body.light-mode .ap-viewers-list__row { border-bottom-color: rgba(0,0,0,.08); }
body.light-mode .ap-viewers-list__loading,
body.light-mode .ap-viewers-list__empty,
body.light-mode .ap-viewers-list__email,
body.light-mode .ap-viewers-list__time { color: #666; }

/* =========================================================
   UNREAD DOT + BOOKMARK (added in mobile audit pass)
   ========================================================= */
.ap-analysis-card { position: relative; }

.ap-analysis-card.ap-card--unread::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 8px;
    height: 8px;
    background: #4da3ff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(77,163,255,0.6);
    pointer-events: none;
}

.ap-bookmark-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: none;
    background: transparent;
    color: var(--text-muted, #8b949e);
    cursor: pointer;
    border-radius: 6px;
    transition: color .15s, background .15s;
    vertical-align: middle;
}
.ap-bookmark-btn:hover { color: #4da3ff; background: rgba(77,163,255,.1); }
.ap-bookmark-btn--saved { color: #4da3ff; }
.ap-bookmark-btn--saved:hover { color: var(--text-muted, #8b949e); background: transparent; }

.ap-saved-count {
    display: none;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #4da3ff;
    font-weight: 600;
    padding: 4px 8px;
    background: rgba(77,163,255,.1);
    border-radius: 999px;
    white-space: nowrap;
}
.ap-saved-count.is-visible { display: flex; }

/* =========================================================
   PUSH NOTIFICATION PERMISSION PROMPT
   ========================================================= */
.ewi-push-prompt {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 9999;
    padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 16px);
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s ease;
}
.ewi-push-prompt.is-visible {
    pointer-events: auto;
    opacity: 1;
}

.ewi-push-prompt__box {
    background: #161b22;
    border: 1px solid rgba(77,163,255,.2);
    border-radius: 16px;
    padding: 20px 24px;
    max-width: 420px;
    width: calc(100% - 32px);
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
    transform: translateY(20px);
    transition: transform .3s ease;
}
.ewi-push-prompt.is-visible .ewi-push-prompt__box {
    transform: translateY(0);
}

.ewi-push-prompt__icon {
    width: 48px;
    height: 48px;
    background: rgba(77,163,255,.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.ewi-push-prompt__title {
    font-size: 1rem;
    font-weight: 700;
    color: #e6edf3;
    margin: 0 0 6px;
}
.ewi-push-prompt__desc {
    font-size: 0.8125rem;
    color: #8b949e;
    margin: 0 0 18px;
    line-height: 1.5;
}
.ewi-push-prompt__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.ewi-push-prompt__btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: opacity .15s;
}
.ewi-push-prompt__btn:hover { opacity: .85; }
.ewi-push-prompt__btn--enable {
    background: #4da3ff;
    color: #fff;
    flex: 1;
}
.ewi-push-prompt__btn--dismiss {
    background: rgba(255,255,255,.06);
    color: #8b949e;
    border: 1px solid rgba(255,255,255,.08);
}

body.light-mode .ewi-push-prompt__box { background: #fff; border-color: rgba(0,0,0,.1); }
body.light-mode .ewi-push-prompt__title { color: #1a1a1a; }
body.light-mode .ewi-push-prompt__desc { color: #555; }

/* =========================================================
   QUICK VIEW LIGHTBOX
   ========================================================= */

.ap-qv-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.ap-qv-lightbox.is-open {
    display: flex;
}

.ap-qv-lightbox__img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

.ap-qv-lightbox__close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity var(--anim-fast, 0.15s) ease;
}

.ap-qv-lightbox__close:hover {
    opacity: 1;
}

.ap-qv-chart__zoom {
    cursor: zoom-in;
    display: block;
}
