/* ==========================================================================
   MARKET OUTLOOK SINGLE PAGE
   ========================================================================== */

/* ── Hero ────────────────────────────────────────────────────────────── */

.rv-outlook-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: #ffffff;
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.rv-outlook-hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.03) 100%);
    pointer-events: none;
}

.rv-outlook-hero__top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.rv-outlook-hero__badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: var(--rv-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.rv-outlook-hero__meta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--rv-text-md);
    color: rgba(255, 255, 255, 0.7);
}

.rv-outlook-hero__sep {
    opacity: 0.4;
}

.rv-outlook-hero__quarter {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.rv-outlook-hero__title {
    font-size: var(--rv-text-4xl);
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 0.75rem 0;
    letter-spacing: -0.025em;
    color: #ffffff;
}

.rv-outlook-hero__subtitle {
    font-size: var(--rv-text-base);
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.75);
    margin: 0 0 1.5rem 0;
    font-style: italic;
}

.rv-outlook-hero__stats {
    display: flex;
    gap: 0;
    margin-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 1.25rem;
}

.rv-outlook-hero__stat {
    flex: 1;
    text-align: center;
    position: relative;
}

.rv-outlook-hero__stat:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 1px;
    background: rgba(255, 255, 255, 0.15);
}

.rv-outlook-hero__stat-value {
    display: block;
    font-size: var(--rv-text-2xl);
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.rv-outlook-hero__stat-label {
    display: block;
    font-size: var(--rv-text-xs);
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* ── Sticky TOC ──────────────────────────────────────────────────────── */
/* Column stretches to fill row height; inner card is the sticky element */

.rv-outlook-sidebar {
    align-self: stretch !important;
}

.rv-outlook-sidebar .rv-sidebar-card--sticky {
    position: sticky;
    top: 6rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
}

/* Mobile: stack columns, TOC above content, not sticky */
@media (max-width: 782px) {
    .rv-outlook-single .wp-block-columns {
        flex-direction: column;
    }

    .rv-outlook-sidebar {
        order: -1;
    }

    .rv-outlook-sidebar .rv-sidebar-card--sticky {
        position: static !important;
        top: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
    }
}

.rv-outlook-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rv-outlook-toc-list li {
    margin-bottom: 0.25rem;
}

.rv-outlook-toc-list a {
    display: block;
    padding: 0.375rem 0;
    color: var(--rv-text-secondary);
    text-decoration: none;
    font-size: var(--rv-text-md);
    line-height: 1.4;
    transition: color 0.15s ease;
}

.rv-outlook-toc-list a:hover {
    color: var(--rv-text-heading);
}

/* ── Executive Summary ───────────────────────────────────────────────── */

.rv-outlook-exec-summary h2 {
    color: var(--rv-text-heading);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--rv-border-primary);
}

.rv-outlook-exec-summary p {
    font-size: var(--rv-text-base);
    line-height: 1.8;
    color: var(--rv-text-secondary);
}

/* ── Report Sections (from shortcode) ────────────────────────────────── */

.rv-outlook-sections {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.rv-outlook-section-item {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--rv-border-primary);
}

.rv-outlook-section-item:last-child {
    border-bottom: none;
}

.rv-outlook-section-header {
    margin-bottom: 1.25rem;
}

/* Badge: uses flex layout with SVG icon + text label */
.rv-outlook-section-badge {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    width: fit-content;
    padding: 0.3rem 0.75rem;
    border-radius: 100px;
    font-size: var(--rv-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
    line-height: 1;
}

/* Section badge colors by type */
.rv-outlook-section-badge--market_analysis {
    background: #dbeafe;
    color: #1e40af;
}

.rv-outlook-section-badge--technology_trends {
    background: #ede9fe;
    color: #5b21b6;
}

.rv-outlook-section-badge--product_readiness {
    background: #dcfce7;
    color: #166534;
}

.rv-outlook-section-badge--category_spotlight {
    background: #fef3c7;
    color: #92400e;
}

.rv-outlook-section-badge--predictions {
    background: #e0e7ff;
    color: #3730a3;
}

.rv-outlook-section-badge--other {
    background: #f1f5f9;
    color: #475569;
}

.rv-outlook-section-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    line-height: 0;
}

.rv-outlook-section-icon svg {
    display: block;
}

.rv-outlook-section-badge-label {
    white-space: nowrap;
}

.rv-outlook-section-title {
    font-size: var(--rv-text-2xl) !important;
    font-weight: 700 !important;
    color: var(--rv-text-heading) !important;
    margin: 0 !important;
    line-height: 1.3;
}

/* ── Section Content Typography ──────────────────────────────────────── */

.rv-outlook-section-content h2 {
    font-size: var(--rv-text-2xl);
    font-weight: 700;
    color: var(--rv-text-heading);
    margin: 2.5rem 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--rv-border-primary);
}

.rv-outlook-section-content h3 {
    font-size: var(--rv-text-xl);
    font-weight: 700;
    color: var(--rv-text-heading);
    margin: 2rem 0 0.75rem 0;
}

.rv-outlook-section-content h4 {
    font-size: var(--rv-text-base);
    font-weight: 700;
    color: var(--rv-text-heading);
    margin: 1.5rem 0 0.5rem 0;
}

.rv-outlook-section-content p {
    font-size: var(--rv-text-base);
    line-height: 1.7;
    color: var(--rv-text-secondary);
    margin-bottom: 1rem;
}

.rv-outlook-section-content ul,
.rv-outlook-section-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.rv-outlook-section-content li {
    font-size: var(--rv-text-base);
    line-height: 1.7;
    color: var(--rv-text-secondary);
    margin-bottom: 0.375rem;
}

.rv-outlook-section-content strong {
    color: var(--rv-text-heading);
    font-weight: 600;
}

.rv-outlook-section-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--rv-border-primary);
    background: var(--rv-surface-secondary);
    border-radius: 0 6px 6px 0;
}

.rv-outlook-section-content blockquote p {
    margin-bottom: 0;
}

/* Also apply to executive summary, market overview, predictions, editor content */
.rv-outlook-market-overview p,
.rv-outlook-predictions p,
.rv-outlook-editor-content p {
    font-size: var(--rv-text-base);
    line-height: 1.7;
    color: var(--rv-text-secondary);
    margin-bottom: 1rem;
}

.rv-outlook-market-overview h2,
.rv-outlook-predictions h2 {
    font-size: var(--rv-text-2xl);
    font-weight: 700;
    color: var(--rv-text-heading);
    margin: 2.5rem 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--rv-border-primary);
}

.rv-outlook-market-overview h3,
.rv-outlook-predictions h3 {
    font-size: var(--rv-text-xl);
    font-weight: 700;
    color: var(--rv-text-heading);
    margin: 2rem 0 0.75rem 0;
}

/* ── Tables (matching site table styles) ─────────────────────────────── */

.rv-outlook-section-content table,
.rv-outlook-market-overview table,
.rv-outlook-predictions table,
.rv-outlook-editor-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: var(--rv-text-md);
    border: 1px solid var(--rv-border-primary);
    border-radius: 8px;
    overflow: hidden;
}

.rv-outlook-section-content thead th,
.rv-outlook-market-overview thead th,
.rv-outlook-predictions thead th,
.rv-outlook-editor-content thead th {
    background: var(--rv-text-heading, #1e3a5f);
    color: #ffffff;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: var(--rv-text-md);
    border-bottom: 2px solid var(--rv-text-heading);
}

.rv-outlook-section-content tbody tr:nth-child(even),
.rv-outlook-market-overview tbody tr:nth-child(even),
.rv-outlook-predictions tbody tr:nth-child(even),
.rv-outlook-editor-content tbody tr:nth-child(even) {
    background: var(--rv-surface-secondary);
}

.rv-outlook-section-content tbody td,
.rv-outlook-market-overview tbody td,
.rv-outlook-predictions tbody td,
.rv-outlook-editor-content tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--rv-border-primary);
    color: var(--rv-text-secondary);
    vertical-align: top;
    line-height: 1.5;
}

.rv-outlook-section-content tbody td:first-child,
.rv-outlook-market-overview tbody td:first-child,
.rv-outlook-predictions tbody td:first-child,
.rv-outlook-editor-content tbody td:first-child {
    font-weight: 600;
    color: var(--rv-text-primary);
}

/* Responsive table wrapper — scroll container injected by JS */
.rv-table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    margin: 1.5rem 0;
}

.rv-table-scroll-wrap table {
    margin: 0;
    min-width: max-content;
    width: 100%;
}

@media (max-width: 600px) {
    .rv-table-scroll-wrap table th {
        white-space: nowrap;
    }

    .rv-table-scroll-wrap table td {
        min-width: 120px;
        word-break: normal;
        overflow-wrap: normal;
        hyphens: none;
    }
}

/* ── Product Highlight Cards ─────────────────────────────────────────── */
/* Matches rv-section + rv-pc pattern from evaluation pages */

.rv-product-card {
    background: var(--rv-surface-primary);
    border: 1px solid var(--rv-border-primary);
    border-radius: 8px;
    padding: 0;
    margin: 1.25rem 0;
    overflow: hidden;
}

/* Product header link — inherits heading style, no default link decoration */
.rv-product-header-link {
    text-decoration: none;
    color: inherit;
}

.rv-product-header-link:hover .rv-product-name {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Product name header — matches rv-section header pattern */
.rv-product-card h4 {
    font-size: var(--rv-text-base) !important;
    font-weight: 700 !important;
    color: var(--rv-text-heading) !important;
    margin: 0 !important;
    padding: 1rem 1.25rem !important;
    line-height: 1.4;
    border-bottom: 1px solid var(--rv-border-primary);
    background: var(--rv-surface-secondary);
}

/* Base paragraph inside product card */
.rv-product-card p {
    font-size: var(--rv-text-md) !important;
    line-height: 1.6 !important;
    margin: 0 !important;
    padding: 0.75rem 1.25rem !important;
}

.rv-product-card p:last-child {
    padding-bottom: 1rem !important;
}

/* Product header structured spans */
.rv-product-name {
    color: var(--rv-text-heading);
}

.rv-product-price {
    color: var(--rv-text-secondary);
    font-weight: 600;
}

.rv-product-tag {
    display: inline-block;
    background: var(--rv-brand-accent-subtle, rgba(59, 130, 246, 0.1));
    color: var(--rv-brand-accent, #2563eb);
    font-size: var(--rv-text-xs);
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
    margin-left: 0.25rem;
}

/* Product auto-links */
.rv-product-link {
    color: var(--rv-brand-accent, #2563eb);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease;
}

.rv-product-link:hover {
    border-bottom-color: var(--rv-brand-accent, #2563eb);
}

/* Specs row */
.rv-product-specs {
    color: var(--rv-text-secondary) !important;
    font-style: italic;
    border-bottom: 1px solid var(--rv-border-primary);
}

/* Strengths — matches rv-pc__col--strengths pattern */
.rv-product-strengths {
    color: var(--rv-strength-fg, #166534) !important;
    background: rgba(34, 197, 94, 0.04);
    border-left: 3px solid rgba(34, 197, 94, 0.3);
}

/* Watch — matches rv-pc__col--weaknesses pattern */
.rv-product-watch {
    color: var(--rv-weakness-fg, #92400e) !important;
    background: rgba(239, 68, 68, 0.04);
    border-left: 3px solid rgba(239, 68, 68, 0.3);
}

/* ── Part Headers ────────────────────────────────────────────────────── */

.rv-part-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: #ffffff;
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    margin: 3rem 0 2rem 0;
    font-size: var(--rv-text-xl);
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ── PDF Download ────────────────────────────────────────────────────── */

.rv-outlook-download {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    background: var(--rv-surface-secondary);
    border: 1px solid var(--rv-border-primary);
    border-radius: 12px;
    padding: 1.5rem;
}

.rv-outlook-download--unavailable {
    opacity: 0.7;
}

.rv-outlook-download__icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.rv-outlook-download__title {
    font-size: var(--rv-text-xl) !important;
    font-weight: 700 !important;
    color: var(--rv-text-heading) !important;
    margin: 0 0 0.375rem 0 !important;
}

.rv-outlook-download__desc {
    font-size: var(--rv-text-md) !important;
    color: var(--rv-text-secondary) !important;
    line-height: 1.5 !important;
    margin: 0 0 1rem 0 !important;
}

.rv-outlook-download__button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--rv-text-heading, #1e3a5f);
    color: #ffffff;
    border-radius: 6px;
    font-size: var(--rv-text-md);
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.rv-outlook-download__button:hover {
    background: #2d4a6f;
    box-shadow: var(--rv-shadow-md);
    color: #ffffff;
}

/* ── Disclaimer ──────────────────────────────────────────────────────── */

.rv-outlook-disclaimer p {
    margin: 0;
}

/* ── Footer ──────────────────────────────────────────────────────────── */

.rv-outlook-footer a {
    color: var(--rv-brand-accent);
    text-decoration: none;
}

.rv-outlook-footer a:hover {
    text-decoration: underline;
}

/* Hide empty wrapper sections when ACF fields are empty */
.rv-outlook-market-overview:empty,
.rv-outlook-predictions:empty {
    display: none;
}

.rv-outlook-market-overview:not(:has(p:not(:empty))):not(:has(h2)):not(:has(h3)),
.rv-outlook-predictions:not(:has(p:not(:empty))):not(:has(h2)):not(:has(h3)) {
    display: none;
}

/* ── Back to Top ─────────────────────────────────────────────────────── */

.rv-back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--rv-text-heading, #1e3a5f);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--rv-shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background 0.15s ease;
    z-index: var(--rv-z-sticky, 500);
}

.rv-back-to-top--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.rv-back-to-top:hover {
    background: #2d4a6f;
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 782px) {
    .rv-outlook-hero {
        padding: 1.75rem;
    }

    .rv-outlook-hero__title {
        font-size: var(--rv-text-3xl);
    }

    .rv-outlook-hero__stats {
        flex-direction: column;
        gap: 0;
    }

    .rv-outlook-hero__stat {
        padding: 0.75rem 0;
    }

    .rv-outlook-hero__stat:not(:last-child)::after {
        width: 100%;
        height: 1px;
        top: auto;
        bottom: 0;
        right: auto;
        left: 0;
    }

    .rv-outlook-section-title {
        font-size: var(--rv-text-xl) !important;
    }
}

@media (max-width: 600px) {
    .rv-outlook-hero {
        padding: 1.25rem;
    }

    .rv-outlook-hero__title {
        font-size: var(--rv-text-2xl);
    }

    .rv-product-card h4 {
        padding: 0.75rem 1rem !important;
    }

    .rv-product-card p {
        padding: 0.5rem 1rem !important;
    }

    .rv-part-header {
        padding: 1rem;
        font-size: var(--rv-text-base);
    }
}

/* ── Dark Mode ───────────────────────────────────────────────────────── */

html[data-theme="dark"] .rv-outlook-hero {
    background: linear-gradient(135deg, #0a0f1a 0%, #152238 100%);
}

html[data-theme="dark"] .rv-outlook-toc {
    background: var(--rv-surface-primary) !important;
    border-color: var(--rv-border-primary) !important;
}

/* Dark mode product cards */
html[data-theme="dark"] .rv-product-card {
    background: var(--rv-surface-primary);
    border-color: var(--rv-border-primary);
}

html[data-theme="dark"] .rv-product-card h4 {
    background: var(--rv-surface-secondary) !important;
    border-bottom-color: var(--rv-border-primary) !important;
}

html[data-theme="dark"] .rv-product-tag {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

html[data-theme="dark"] .rv-product-strengths {
    color: #4ade80 !important;
    background: rgba(34, 197, 94, 0.06);
    border-left-color: rgba(34, 197, 94, 0.3);
}

html[data-theme="dark"] .rv-product-watch {
    color: #f87171 !important;
    background: rgba(239, 68, 68, 0.06);
    border-left-color: rgba(239, 68, 68, 0.3);
}

html[data-theme="dark"] .rv-part-header {
    background: linear-gradient(135deg, #0a0f1a 0%, #152238 100%);
}

/* Dark mode tables */
html[data-theme="dark"] .rv-outlook-section-content thead th,
html[data-theme="dark"] .rv-outlook-market-overview thead th,
html[data-theme="dark"] .rv-outlook-predictions thead th,
html[data-theme="dark"] .rv-outlook-editor-content thead th {
    background: #1e293b;
    border-bottom-color: #334155;
}

html[data-theme="dark"] .rv-outlook-section-content tbody tr:nth-child(even),
html[data-theme="dark"] .rv-outlook-market-overview tbody tr:nth-child(even),
html[data-theme="dark"] .rv-outlook-predictions tbody tr:nth-child(even),
html[data-theme="dark"] .rv-outlook-editor-content tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .rv-outlook-section-content tbody td,
html[data-theme="dark"] .rv-outlook-market-overview tbody td,
html[data-theme="dark"] .rv-outlook-predictions tbody td,
html[data-theme="dark"] .rv-outlook-editor-content tbody td {
    border-bottom-color: var(--rv-border-primary);
}

html[data-theme="dark"] .rv-outlook-section-content table,
html[data-theme="dark"] .rv-outlook-market-overview table,
html[data-theme="dark"] .rv-outlook-predictions table,
html[data-theme="dark"] .rv-outlook-editor-content table {
    border-color: var(--rv-border-primary);
}

/* Dark mode download */
html[data-theme="dark"] .rv-outlook-download {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--rv-border-primary);
}

html[data-theme="dark"] .rv-outlook-download__button {
    background: #334155;
}

html[data-theme="dark"] .rv-outlook-download__button:hover {
    background: #475569;
}

/* Dark mode section badges */
html[data-theme="dark"] .rv-outlook-section-badge--market_analysis {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

html[data-theme="dark"] .rv-outlook-section-badge--technology_trends {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
}

html[data-theme="dark"] .rv-outlook-section-badge--product_readiness {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

html[data-theme="dark"] .rv-outlook-section-badge--category_spotlight {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
}

html[data-theme="dark"] .rv-outlook-section-badge--predictions {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

html[data-theme="dark"] .rv-outlook-section-badge--other {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
}

html[data-theme="dark"] .rv-back-to-top {
    background: #334155;
}

html[data-theme="dark"] .rv-back-to-top:hover {
    background: #475569;
}

html[data-theme="dark"] .rv-outlook-disclaimer {
    background: rgba(255, 255, 255, 0.03) !important;
    border-left-color: var(--rv-brand-accent) !important;
}

html[data-theme="dark"] .rv-outlook-section-content blockquote {
    background: rgba(255, 255, 255, 0.03);
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .rv-outlook-hero {
        background: linear-gradient(135deg, #0a0f1a 0%, #152238 100%);
    }
}
