/* === News Page — Matches site design system === */
:root {
    --news-accent:       #2563eb;
    --news-accent-hover: #1d4ed8;
    --news-success:      #10b981;
    --news-warning:      #f59e0b;
    --news-danger:       #ef4444;
    --news-info:         #0ea5e9;
    --news-shadow:       0 4px 6px -1px rgba(0,0,0,.1),  0 2px 4px -1px rgba(0,0,0,.06);
    --news-shadow-lg:    0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);
    --news-radius:       14px;
    --news-radius-sm:    8px;
    --news-radius-lg:    20px;
    --news-card-img-h:   192px;
}

/* ── Page Shell ───────────────────────────────────────────────────────────── */
.news-page {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 0 4rem;
}

.news-page button,
.news-page input {
    -webkit-appearance: none;
    appearance: none;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* ── Context Box ──────────────────────────────────────────────────────────── */
.news-context {
    margin: 1rem 0;
    background: var(--surf, #fff);
    border: 1px solid var(--brd, #e2e8f0);
    border-radius: 16px;
    padding: 18px;
    color: var(--txt-2, #475569);
    line-height: 1.7;
    box-shadow: 0 4px 18px rgba(15,23,42,.04);
}
.news-context h2 {
    margin: 0 0 8px;
    color: var(--txt, #0f172a);
    font-size: 1.05rem;
    font-weight: 800;
}
.news-context p {
    margin: 0 0 10px;
    font-size: .9rem;
}
.news-context-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.news-context-item {
    background: var(--surf2, #f8fafc);
    border: 1px solid var(--brd, #e2e8f0);
    border-radius: 12px;
    padding: 12px;
    min-width: 0;
}
.news-context-item strong {
    display: block;
    color: var(--txt, #0f172a);
    font-size: .86rem;
    margin-bottom: 4px;
    font-weight: 700;
}
.news-context-item span {
    display: block;
    font-size: .8rem;
    line-height: 1.55;
    color: var(--txt-2, #64748b);
}

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.news-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin: 1rem 0 0;
    background: var(--surf, #fff);
    border: 1px solid var(--brd, #e2e8f0);
    border-radius: 14px;
    box-shadow: var(--news-shadow);
}
.news-tab-lbl {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--txt-2, #64748b);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: 4px;
    white-space: nowrap;
}
.news-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1.5px solid transparent;
    background: var(--surf2, #f8fafc);
    color: var(--txt-2, #64748b);
    cursor: pointer;
    font-size: .8rem;
    font-weight: 600;
    transition: all .18s;
    white-space: nowrap;
    position: relative;
}
.news-tab:hover {
    border-color: var(--news-accent);
    color: var(--news-accent);
    background: color-mix(in srgb, var(--news-accent) 8%, transparent);
}
.news-tab.act {
    background: var(--news-accent);
    color: #fff;
    border-color: var(--news-accent);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--news-accent) 40%, transparent);
}
.news-tab.act .ndot { opacity: .85; }
.ndot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.news-tab-cnt {
    font-size: .65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 20px;
    background: rgba(0,0,0,.12);
    color: inherit;
    min-width: 18px;
    text-align: center;
}
.news-tab.act .news-tab-cnt {
    background: rgba(255,255,255,.25);
    color: #fff;
}

/* ── Category Filter Bar ──────────────────────────────────────────────────── */
.news-filter {
    margin: .6rem 0 1rem;
    background: var(--surf, #fff);
    border: 1px solid var(--brd, #e2e8f0);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
.news-filter-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.news-filter-lbl {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--txt-2, #64748b);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.news-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--surf2, #f1f5f9);
    color: var(--txt-2, #64748b);
    border: 1.5px solid transparent;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    user-select: none;
    white-space: nowrap;
}
.news-chip:hover {
    border-color: var(--news-accent);
    color: var(--news-accent);
}
.news-chip.act {
    background: var(--news-accent);
    color: #fff;
    border-color: var(--news-accent);
}
.news-search-wrap {
    position: relative;
    margin-left: auto;
    display: flex;
    align-items: center;
}
.news-search-wrap > .fa-magnifying-glass {
    position: absolute;
    left: 9px;
    color: var(--txt-2, #94a3b8);
    font-size: .8rem;
    pointer-events: none;
}
.news-search {
    padding: 5px 10px 5px 28px;
    border-radius: 8px;
    border: 1.5px solid var(--brd, #e2e8f0);
    background: var(--surf2, #f8fafc);
    color: var(--txt, #0f172a);
    font-size: .82rem;
    width: 190px;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.news-search:focus {
    border-color: var(--news-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--news-accent) 18%, transparent);
}
.news-search::placeholder { color: var(--txt-2, #94a3b8); }

/* ── News Grid ────────────────────────────────────────────────────────────── */
.news-grid {
    display: none;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 18px;
    margin-top: 0;
}
.news-grid.act {
    display: grid;
    animation: gridIn .3s ease both;
}
@keyframes gridIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* ── News Card ────────────────────────────────────────────────────────────── */
.news-card {
    background: var(--surf, #fff);
    border: 1px solid var(--brd, #e2e8f0);
    border-radius: var(--news-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .2s, box-shadow .2s, border-color .2s;
    animation: cardIn .4s ease both;
    box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
.news-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--news-shadow-lg);
    border-color: var(--news-accent);
}
.news-card-img-wrap {
    display: block;
    overflow: hidden;
    height: var(--news-card-img-h);
    background: var(--surf2, #f1f5f9);
    position: relative;
    flex-shrink: 0;
}
.news-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s;
    display: block;
}
.news-card:hover .news-card-img {
    transform: scale(1.04);
}
.news-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}
.news-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: .73rem;
    flex-wrap: wrap;
}
.news-card-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: .68rem;
}
.news-card-time {
    color: var(--txt-2, #94a3b8);
    font-size: .7rem;
    white-space: nowrap;
}
.news-card-title {
    margin: 0;
    font-size: .93rem;
    font-weight: 700;
    line-height: 1.45;
    color: var(--txt, #0f172a);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.news-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color .15s;
}
.news-card-title a:hover {
    color: var(--news-accent);
}
.news-card-desc {
    margin: 0;
    font-size: .8rem;
    color: var(--txt-2, #64748b);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}
.news-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px solid var(--brd, #f1f5f9);
}
.news-read-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .75rem;
    font-weight: 700;
    color: var(--news-accent);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1.5px solid var(--news-accent);
    transition: all .15s;
    white-space: nowrap;
}
.news-read-link:hover {
    background: var(--news-accent);
    color: #fff;
}
.news-read-link i { font-size: .65rem; }

/* ── Category Badges ──────────────────────────────────────────────────────── */
.news-cat-badge {
    display: inline-flex;
    align-items: center;
    font-size: .66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 2px 8px;
    border-radius: 20px;
}
.news-cat-ev         { background: #d1fae5; color: #065f46; }
.news-cat-autonomous { background: #ede9fe; color: #4c1d95; }
.news-cat-ai         { background: #fce7f3; color: #9d174d; }
.news-cat-hydrogen   { background: #cffafe; color: #164e63; }
.news-cat-policy     { background: #fef3c7; color: #78350f; }
.news-cat-industry   { background: #f1f5f9; color: #334155; }
.news-cat-auto       { background: #ffedd5; color: #7c2d12; }

[data-theme="dark"] .news-cat-ev         { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .news-cat-autonomous { background: #2e1065; color: #c4b5fd; }
[data-theme="dark"] .news-cat-ai         { background: #500724; color: #f9a8d4; }
[data-theme="dark"] .news-cat-hydrogen   { background: #083344; color: #67e8f9; }
[data-theme="dark"] .news-cat-policy     { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .news-cat-industry   { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] .news-cat-auto       { background: #431407; color: #fdba74; }

/* ── Results Bar ──────────────────────────────────────────────────────────── */
.news-results-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: color-mix(in srgb, var(--news-accent) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--news-accent) 30%, transparent);
    border-radius: 10px;
    font-size: .8rem;
    color: var(--news-accent);
    font-weight: 600;
    margin-bottom: .75rem;
    animation: slideDown .2s ease both;
}
@keyframes slideDown {
    from { opacity:0; transform: translateY(-6px); }
    to   { opacity:1; transform: none; }
}
.news-clear-btn {
    margin-left: auto;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1.5px solid currentColor;
    background: transparent;
    color: var(--news-accent);
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all .15s;
}
.news-clear-btn:hover {
    background: var(--news-accent);
    color: #fff;
}

/* ── Empty State ──────────────────────────────────────────────────────────── */
.news-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--txt-2, #64748b);
}
.news-empty i {
    font-size: 2.5rem;
    color: var(--news-warning);
    margin-bottom: 1rem;
    display: block;
}
.news-empty p {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--txt, #0f172a);
}
.news-empty span {
    font-size: .83rem;
}

/* ── Source Cards Section ─────────────────────────────────────────────────── */
.news-sources-section {
    margin-top: 2.5rem;
}
.news-sources-title {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--txt-2, #64748b);
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: .75rem;
}
.news-source-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 14px;
}
.news-source-card {
    background: var(--surf, #fff);
    border: 1px solid var(--brd, #e2e8f0);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform .2s, box-shadow .2s;
}
.news-source-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--news-shadow);
}
.news-source-card.offline {
    opacity: .6;
    border-style: dashed;
}
.news-source-card-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.news-source-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.news-source-name {
    font-size: .9rem;
    font-weight: 800;
    color: var(--txt, #0f172a);
    line-height: 1.3;
}
.news-source-desc {
    font-size: .75rem;
    color: var(--txt-2, #64748b);
    margin-top: 2px;
}
.news-source-status {
    margin-left: auto;
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.news-source-status.online  { background: #d1fae5; color: #065f46; }
.news-source-status.offline { background: #fee2e2; color: #991b1b; }
.news-source-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.news-source-tags span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .7rem;
    color: var(--txt-2, #94a3b8);
    background: var(--surf2, #f8fafc);
    border: 1px solid var(--brd, #e2e8f0);
    border-radius: 6px;
    padding: 2px 8px;
}
.news-source-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .75rem;
    font-weight: 700;
    color: var(--news-accent);
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 8px;
    border: 1.5px solid var(--news-accent);
    transition: all .15s;
    align-self: flex-start;
}
.news-source-link:hover {
    background: var(--news-accent);
    color: #fff;
}
.news-source-link i { font-size: .65rem; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.news-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--surf, #fff);
    border: 1px solid var(--brd, #e2e8f0);
    border-radius: 14px;
    padding: 12px 16px;
    box-shadow: var(--news-shadow-lg);
    z-index: 9000;
    min-width: 220px;
    max-width: 340px;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}
.news-toast.show {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}
.news-toast-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
    background: #d1fae5; color: #065f46;
}
.news-toast.error   .news-toast-icon { background: #fee2e2; color: #991b1b; }
.news-toast.info    .news-toast-icon { background: #dbeafe; color: #1e40af; }
.news-toast.warn    .news-toast-icon { background: #fef3c7; color: #78350f; }
.news-toast-title {
    font-size: .82rem;
    font-weight: 700;
    color: var(--txt, #0f172a);
    margin-bottom: 2px;
}
.news-toast-msg {
    font-size: .75rem;
    color: var(--txt-2, #64748b);
    line-height: 1.4;
}

/* ── Dark Mode ────────────────────────────────────────────────────────────── */
[data-theme="dark"] .news-context,
[data-theme="dark"] .news-card,
[data-theme="dark"] .news-tabs,
[data-theme="dark"] .news-filter,
[data-theme="dark"] .news-source-card,
[data-theme="dark"] .news-toast {
    background: var(--surf, #111f3a);
    border-color: var(--brd, rgba(255,255,255,.08));
}
[data-theme="dark"] .news-context-item {
    background: var(--surf2, #172542);
    border-color: var(--brd, rgba(255,255,255,.08));
}
[data-theme="dark"] .news-chip,
[data-theme="dark"] .news-tab:not(.act) {
    background: var(--surf2, #172542);
    border-color: transparent;
}
[data-theme="dark"] .news-search {
    background: var(--surf2, #172542);
    border-color: var(--brd, rgba(255,255,255,.08));
    color: var(--txt, #e2e8f0);
}
[data-theme="dark"] .news-source-status.online  { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .news-source-status.offline { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .news-card-footer { border-color: rgba(255,255,255,.06); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .news-grid,
    .news-source-cards {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
    .news-context-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}
@media (max-width: 720px) {
    .news-tabs {
        gap: 4px;
        padding: 8px 10px;
    }
    .news-tab { padding: 5px 9px; font-size: .74rem; }
    .news-grid,
    .news-source-cards,
    .news-context-grid {
        grid-template-columns: 1fr;
    }
    .news-filter-inner { gap: 5px; }
    .news-search { width: 140px; }
    .news-toast { bottom: .75rem; right: .75rem; left: .75rem; max-width: unset; }
    :root { --news-card-img-h: 160px; }
}
@media (max-width: 480px) {
    .news-card-body { padding: 12px 13px 14px; }
    .news-source-cards { gap: 10px; }
    .news-source-card { padding: 12px 13px; }
}
