/* ═══════════════════════════════════════════════════════════════
   Analysis Single Page — EWI design system
   Variables: --bg, --bg-card (--bg-alt), --accent #4DA3FF,
              --border, --text, --text-muted
   ═══════════════════════════════════════════════════════════════ */

.as-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 60px;
    color: var(--text);
}

/* ── SECTION 1: HERO ──────────────────────────────────────────── */

.as-hero {
    padding: 32px 0 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
}

.as-hero__asset {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.as-hero__flag {
    font-size: 2rem;
    line-height: 1;
}

.as-hero__name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.as-hero__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.as-hero__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 12px;
    line-height: 1.4;
}

.as-hero__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ── BADGES ───────────────────────────────────────────────────── */

.as-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
}

.as-badge--sm {
    padding: 2px 7px;
    font-size: 0.6875rem;
}

.as-badge--bias.as-badge--bullish {
    background: rgba(76, 175, 114, 0.15);
    color: #4caf72;
    border: 1px solid rgba(76, 175, 114, 0.3);
}

.as-badge--bias.as-badge--bearish {
    background: rgba(255, 90, 90, 0.15);
    color: #ff5a5a;
    border: 1px solid rgba(255, 90, 90, 0.3);
}

.as-badge--bias.as-badge--neutral {
    background: rgba(150, 150, 150, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(150, 150, 150, 0.3);
}

.as-badge--timeframe {
    background: rgba(77, 163, 255, 0.12);
    color: #4DA3FF;
    border: 1px solid rgba(77, 163, 255, 0.25);
}

.as-badge--access {
    background: rgba(201, 162, 39, 0.12);
    color: #c9a227;
    border: 1px solid rgba(201, 162, 39, 0.25);
}

.as-badge--trade-type,
.as-badge--session {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ── SECTION 2: BODY ──────────────────────────────────────────── */

.as-body {
    display: grid;
    grid-template-columns: 65fr 35fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 860px) {
    .as-body {
        grid-template-columns: 1fr;
    }
}

/* ── CARDS ────────────────────────────────────────────────────── */

.as-card {
    background: var(--bg-card, var(--bg-alt));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.as-card--invalidation {
    border-color: rgba(255, 90, 90, 0.3);
    background: rgba(255, 90, 90, 0.04);
}

.as-card--intel-link {
    border-color: rgba(77, 163, 255, 0.25);
}

.as-card--journal {
    border-color: rgba(77, 163, 255, 0.15);
}

.as-card--trade {
    border-color: rgba(255, 255, 255, 0.1);
}

.as-card__title {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* ── WAVE COUNT ───────────────────────────────────────────────── */

.as-wave-section {
    margin-bottom: 16px;
}

.as-wave-section:last-child {
    margin-bottom: 0;
}

.as-wave-section__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0 0 8px;
}

.as-wave-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.875rem;
}

.as-wave-row:last-child {
    border-bottom: none;
}

.as-wave-row__key {
    color: var(--text-muted);
}

.as-wave-row__val {
    font-weight: 600;
    color: var(--text);
}

.as-wave-row__val--accent {
    color: #4DA3FF;
    font-size: 1rem;
}

/* ── MARKET CONDITION ─────────────────────────────────────────── */

.as-condition {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    margin: 0 0 14px;
}

.as-confidence {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8125rem;
}

.as-confidence__label {
    color: var(--text-muted);
    white-space: nowrap;
}

.as-confidence__track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.as-confidence__fill {
    height: 100%;
    background: #4DA3FF;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.as-confidence__val {
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 28px;
    text-align: right;
}

/* ── WAVE THESIS ──────────────────────────────────────────────── */

.as-thesis {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text);
}

.as-thesis p {
    margin: 0 0 12px;
}

.as-thesis p:last-child {
    margin-bottom: 0;
}

/* ── LOCKED / PREMIUM GATE ────────────────────────────────────── */

.as-locked {
    padding: 20px;
    background: rgba(255, 200, 0, 0.05);
    border: 1px solid rgba(255, 200, 0, 0.15);
    border-radius: 8px;
    text-align: center;
}

.as-locked p {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.as-upgrade-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #4DA3FF;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.2s;
}

.as-upgrade-btn:hover {
    background: #3a8fe8;
    color: #fff;
}

/* ── CHART ────────────────────────────────────────────────────── */

.as-chart {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.as-chart img {
    width: 100%;
    display: block;
}

.as-chart--blurred img {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

.as-chart--zoomable { position: relative; cursor: zoom-in; }

.as-chart__zoom-link { display: block; position: relative; }

.as-chart__zoom-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 1rem;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
}

.as-chart--zoomable:hover .as-chart__zoom-icon { opacity: 1; }

.as-chart__img { width: 100%; border-radius: 10px; display: block; }

/* Lightbox overlay */
.as-lightbox {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0,0,0,0.92) !important;
    z-index: 999999 !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: zoom-out;
}

.as-lightbox.is-open { display: flex !important; }

.as-lightbox__img {
    max-width: 95vw !important;
    max-height: 92vh !important;
    width: auto !important;
    height: auto !important;
    border-radius: 8px;
    object-fit: contain !important;
    display: block !important;
    margin: auto !important;
}

.as-lightbox__close {
    position: absolute;
    top: 16px;
    right: 20px;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
}

/* ── FULL CONTENT ─────────────────────────────────────────────── */

.as-content {
    font-size: 0.9375rem;
    line-height: 1.75;
    color: var(--text);
}

.as-content p {
    margin: 0 0 14px;
}

.as-content p:last-child {
    margin-bottom: 0;
}

.as-summary {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text);
    margin: 0;
}

/* ── INVALIDATION ─────────────────────────────────────────────── */

.as-invalidation-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ff5a5a;
    margin-bottom: 8px;
}

.as-invalidation-pattern {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

/* ── NEXT UPDATE ──────────────────────────────────────────────── */

.as-next-update {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(77, 163, 255, 0.06);
    border: 1px solid rgba(77, 163, 255, 0.15);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.as-next-update strong {
    color: var(--text);
}

/* ── TRADE LEVELS ─────────────────────────────────────────────── */

.as-trade-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.875rem;
}

.as-trade-row:last-child {
    border-bottom: none;
}

.as-trade-row__key {
    color: var(--text-muted);
}

.as-trade-row__val {
    font-weight: 700;
    font-size: 1rem;
}

.as-trade-row--entry .as-trade-row__val { color: var(--text); }
.as-trade-row--sl    .as-trade-row__val { color: #ff5a5a; }
.as-trade-row--tp    .as-trade-row__val { color: #4caf72; }
.as-trade-row--rr    .as-trade-row__val { color: #4DA3FF; font-size: 0.9375rem; }

/* ── INTEL LINK ───────────────────────────────────────────────── */

.as-intel-link__desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0 0 14px;
    line-height: 1.5;
}

.as-intel-link__btn {
    display: block;
    padding: 10px 16px;
    background: rgba(77, 163, 255, 0.1);
    border: 1px solid rgba(77, 163, 255, 0.25);
    border-radius: 8px;
    color: #4DA3FF;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    transition: background 0.2s;
}

.as-intel-link__btn:hover {
    background: rgba(77, 163, 255, 0.18);
    color: #4DA3FF;
}

/* ── TRADE JOURNAL CTA ────────────────────────────────────────── */

.as-journal__desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0 0 14px;
    line-height: 1.5;
}

.as-journal__btn {
    display: block;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    transition: background 0.2s, border-color 0.2s;
}

.as-journal__btn:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text);
}

/* ── RELATED ANALYSIS ─────────────────────────────────────────── */

.as-related {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.as-related__item {
    display: block;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.as-related__item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(77, 163, 255, 0.25);
}

.as-related__title {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.4;
}

.as-related__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.as-related__date {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* ── SECTION 3: DISCUSSION ────────────────────────────────────── */

.as-discussion {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

/* ── DISCUSSION REPLY IMAGES ──────────────────────────────────── */

.ewi-reply-image {
    margin-top: 8px;
}

.ewi-reply-img {
    max-width: 100%;
    border-radius: 8px;
    cursor: zoom-in;
    max-height: 400px;
    object-fit: contain;
}

.ewi-reply-img-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.ewi-reply-img-btn {
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    transition: background 0.2s;
    user-select: none;
}

.ewi-reply-img-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}
