/* ── PrimeVue-inspired design tokens ── */
:root {
    --pv-primary: #3B82F6;
    --pv-primary-hover: #2563EB;
    --pv-primary-focus: rgba(59, 130, 246, 0.25);
    --pv-text: #495057;
    --pv-text-secondary: #6c757d;
    --pv-border: #ced4da;
    --pv-border-light: #dee2e6;
    --pv-surface: #ffffff;
    --pv-surface-ground: #f8f9fa;
    --pv-radius: 6px;
    --pv-radius-sm: 4px;
    --pv-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --pv-shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
    --pv-transition: all 0.2s ease;
}

/* ── Layout ── */
.news-explainer {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    color: var(--pv-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.news-explainer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.news-explainer-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0;
    color: var(--pv-text);
}

.news-explainer-count {
    font-size: 0.875rem;
    color: var(--pv-text-secondary);
}

/* ── Filters panel ── */
.news-explainer-filters {
    background: var(--pv-surface);
    border: 1px solid var(--pv-border-light);
    border-radius: var(--pv-radius);
    box-shadow: var(--pv-shadow-card);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.filter-row + .filter-row {
    margin-top: 1rem;
}

.filter-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pv-text-secondary);
    margin-bottom: 0.375rem;
}

/* PrimeVue Dropdown / Calendar inputs */
.pv-select,
.pv-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--pv-text);
    background: var(--pv-surface);
    border: 1px solid var(--pv-border);
    border-radius: var(--pv-radius);
    transition: var(--pv-transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.pv-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.pv-select:focus,
.pv-input:focus {
    border-color: var(--pv-primary);
    box-shadow: 0 0 0 0.2rem var(--pv-primary-focus);
}

.pv-select::placeholder,
.pv-input::placeholder {
    color: var(--pv-text-secondary);
}

.date-inputs {
    display: flex;
    gap: 0.5rem;
}

.date-inputs input {
    flex: 1 1 0;
    min-width: 0;
}

.filter-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

/* ── Buttons ── */
.pv-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--pv-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--pv-transition);
    outline: none;
    background: var(--pv-primary);
    color: #fff;
}

.pv-button:hover {
    background: var(--pv-primary-hover);
}

.pv-button:focus {
    box-shadow: 0 0 0 0.2rem var(--pv-primary-focus);
}

.pv-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pv-button--text {
    background: transparent;
    color: var(--pv-primary);
    border-color: transparent;
    padding: 0.25rem 0.5rem;
}

.pv-button--text:hover {
    background: rgba(59, 130, 246, 0.04);
}

.pv-button--outlined {
    background: transparent;
    color: var(--pv-primary);
    border-color: var(--pv-primary);
}

.pv-button--outlined:hover {
    background: rgba(59, 130, 246, 0.04);
}

/* ── Cards ── */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.news-card {
    background: var(--pv-surface);
    border: 1px solid var(--pv-border-light);
    border-radius: var(--pv-radius);
    box-shadow: var(--pv-shadow-card);
    padding: 1.25rem 1.5rem;
    transition: box-shadow 0.2s ease;
}

.news-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.news-card-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--pv-border-light);
}

.news-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.news-company {
    font-size: 0.8rem;
    color: var(--pv-text-secondary);
    margin-bottom: 0.375rem;
}

.news-company a {
    color: var(--pv-text-secondary);
    text-decoration: none;
    font-weight: 500;
}

.news-company a:hover {
    color: var(--pv-text);
    text-decoration: underline;
}

.news-date {
    margin-left: 0.25rem;
}

.news-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--pv-text);
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.news-title:hover {
    color: var(--pv-primary);
}

.news-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.news-toggle {
    margin-top: 0.75rem;
    padding-left: 0;
    padding-right: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--pv-primary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--pv-transition);
}

.news-toggle:hover {
    color: var(--pv-primary-hover);
    text-decoration: underline;
}

.news-collapsible {
    margin-top: 0.875rem;
}

.news-assessment {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--pv-border-light);
}

.assessment-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.assessment-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pv-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ── Tags (PrimeVue Tag style) ── */
.pv-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--pv-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    background: #E3F2FD;
    color: #1976D2;
    border: none;
    white-space: nowrap;
}

.pv-tag--warning {
    background: #FFF3E0;
    color: #F57C00;
}

/* ── Verdict / Takeaway pills (PrimeVue severity style) ── */
.sentiment-pill,
.significance-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--pv-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.sentiment-pill.default,
.significance-pill.default {
    background: #f8f9fa;
    color: var(--pv-text);
    border: 1px solid var(--pv-border-light);
}

/* Custom sentiment colors mapped to PrimeVue-like severities */
.mc-badge-sentiment-positive {
    background: #E8F5E9;
    color: #388E3C;
}

.mc-badge-sentiment-mixed {
    background: #FFF3E0;
    color: #F57C00;
}

.mc-badge-sentiment-weak {
    background: #FFF8E1;
    color: #F9A825;
}

.mc-badge-sentiment-routine {
    background: #F5F5F5;
    color: #616161;
}

.mc-badge-significance-important {
    background: #E3F2FD;
    color: #1976D2;
}

.mc-badge-significance-incremental {
    background: #E0F7FA;
    color: #00838F;
}

.mc-badge-significance-noise {
    background: #FAFAFA;
    color: #9E9E9E;
    border: 1px solid #EEEEEE;
}

/* ── Card body ── */
.news-card-body {
    padding-top: 1rem;
}

.news-redflags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.news-section {
    margin-top: 0.875rem;
}

.news-section:first-child {
    margin-top: 0;
}

.news-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pv-text-secondary);
    margin-bottom: 0.375rem;
}

.news-section p,
.news-section li {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--pv-text);
    margin-bottom: 0;
}

.news-section ul {
    margin: 0;
    padding-left: 1.25rem;
}

.news-section li + li {
    margin-top: 0.375rem;
}

/* ── Chip (PrimeVue Chip style) ── */
.pv-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: #E3F2FD;
    color: #1976D2;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.pv-chip button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    transition: var(--pv-transition);
}

.pv-chip button:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.08);
}

/* ── Autocomplete dropdown (PrimeVue OverlayPanel style) ── */
.company-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--pv-surface);
    border: 1px solid var(--pv-border-light);
    border-radius: var(--pv-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    max-height: 240px;
    overflow-y: auto;
}

.company-autocomplete-item {
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--pv-text);
    transition: background 0.15s ease;
}

.company-autocomplete-item:hover,
.company-autocomplete-item:focus {
    background-color: var(--pv-surface-ground);
    outline: none;
}

/* ── Status panels (loading / empty) ── */
.pv-panel {
    background: var(--pv-surface);
    border: 1px solid var(--pv-border-light);
    border-radius: var(--pv-radius);
    box-shadow: var(--pv-shadow-card);
    padding: 2rem;
}

.pv-panel--center {
    text-align: center;
    color: var(--pv-text-secondary);
}

.pv-panel p {
    margin: 0;
    font-size: 0.9rem;
}

/* ── Footer ── */
.news-explainer-footer {
    text-align: center;
    padding: 1.5rem 0;
}

.news-hint {
    font-size: 0.875rem;
    color: var(--pv-text-secondary);
}

/* ── Single article page ── */
.news-article {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    color: var(--pv-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.news-article-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--pv-border-light);
    margin-bottom: 1.25rem;
}

.news-article-title {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--pv-text);
    text-decoration: none;
    margin-bottom: 0.75rem;
}

.news-article-title:hover {
    color: var(--pv-primary);
}

.news-article-meta {
    font-size: 0.875rem;
    color: var(--pv-text-secondary);
    margin-bottom: 0.5rem;
}

.news-article-company {
    color: var(--pv-text-secondary);
    text-decoration: none;
    font-weight: 500;
}

.news-article-company:hover {
    color: var(--pv-text);
    text-decoration: underline;
}

.news-article-date {
    margin-left: 0.25rem;
}

.news-explanation {
    background: var(--pv-surface-ground);
    border: 1px solid var(--pv-border-light);
    border-radius: var(--pv-radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.news-article-body {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--pv-text);
}

.news-article-body p {
    margin-bottom: 1rem;
}

.news-article-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--pv-border-light);
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .news-explainer {
        padding: 1rem;
    }

    .news-explainer-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .news-card-header {
        flex-direction: column;
    }

    .news-title {
        font-size: 1rem;
    }

    .news-section p,
    .news-section li {
        font-size: 0.95rem;
        line-height: 1.55;
    }

    .news-article {
        padding: 1rem;
    }

    .news-article-title {
        font-size: 1.25rem;
    }

    .news-explanation {
        padding: 1rem;
    }
}
