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

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

.ap-feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: var(--space-6, 1.5rem);
    margin-top: var(--space-8, 2rem);
    max-width: var(--container, 1280px);
    margin-inline: auto;
    padding-inline: var(--space-4, 1rem);
}

.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-3, 0.75rem);
    padding: var(--space-5, 1.25rem);
    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: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
    padding: 0;
    transition: color var(--anim-fast, 0.15s) ease;
}

.ap-like-btn:hover,
.ap-like-btn--liked {
    color: #ff6b6b;
}

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

.ap-like-count {
    font-size: 0.8rem;
}

/* =========================================================
   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.875rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
    line-height: 1.5;
}

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

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

.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;
}

/* =========================================================
   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-feed-grid {
        grid-template-columns: 1fr;
    }

    .ap-modal {
        width: 95vw;
    }

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

    .ap-btn,
    .ap-btn-secondary {
        text-align: center;
    }
}
.ap-feed-grid {
    padding-bottom: var(--space-12, 3rem);
}

.ap-analysis-card {
    margin-bottom: var(--space-4, 1rem);
}

/* 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 {
    max-width: var(--container, 1280px);
    margin-inline: auto;
    padding: var(--space-8, 2rem) var(--space-4, 1rem);
}

.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 */
.ewi-analysis-feed { max-width: var(--container, 1280px); margin-inline: auto; padding: var(--space-8, 2rem) var(--space-4, 1rem); }
.ewi-analysis-feed__header { margin-bottom: var(--space-8, 2rem); }
.ewi-analysis-feed__title { margin: 0 0 8px; color: var(--text, #fff); }
.ewi-analysis-feed__subtitle { color: var(--text-muted); margin: 0; }

/* 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 { color: #555; }
body.light-mode .ap-follow-btn:hover { color: var(--accent, #0078ff); }
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; }

/* =========================================================
   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; }
