/* ============================================================
   PC Edu News Feed — modern public UI
   ============================================================ */

.news-page {
    --news-accent: #0d6efd;
    --news-accent-soft: rgba(13, 110, 253, 0.12);
    --news-surface: #ffffff;
    --news-surface-2: #f4f7fb;
    --news-border: rgba(15, 23, 42, 0.08);
    --news-text: #0f172a;
    --news-muted: #64748b;
    --news-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
    --news-radius: 18px;
    min-height: 100vh;
    background: var(--news-surface-2);
    color: var(--news-text);
}

:root.dark-mode .news-page {
    --news-accent: #4c8dff;
    --news-accent-soft: rgba(76, 141, 255, 0.15);
    --news-surface: #161b22;
    --news-surface-2: #0d1117;
    --news-border: rgba(255, 255, 255, 0.08);
    --news-text: #e8eaed;
    --news-muted: #9aa0a6;
    --news-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

/* Hero */
.news-hero {
    position: relative;
    padding: 4rem 0 5rem;
    background: linear-gradient(135deg, #0a3d91 0%, #0d6efd 45%, #3b9eff 100%);
    color: #fff;
    overflow: hidden;
}

.news-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.15), transparent 40%),
                radial-gradient(circle at 80% 0%, rgba(255,255,255,0.1), transparent 35%);
    pointer-events: none;
}

.news-hero-inner {
    position: relative;
    z-index: 1;
}

.news-hero h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.news-hero p {
    max-width: 680px;
    margin: 0 auto 1.75rem;
    opacity: 0.92;
    font-size: 1.05rem;
    line-height: 1.7;
}

/* Sticky toolbar */
.news-toolbar {
    position: sticky;
    top: 72px;
    z-index: 100;
    padding: 1rem 0;
    background: color-mix(in srgb, var(--news-surface-2) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--news-border);
}

.news-search-wrap {
    position: relative;
    max-width: 520px;
    margin: 0 auto;
}

.news-search-wrap i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--news-muted);
}

.news-search {
    width: 100%;
    border: 1px solid var(--news-border);
    background: var(--news-surface);
    color: var(--news-text);
    border-radius: 999px;
    padding: 0.85rem 1rem 0.85rem 2.75rem;
    font-size: 1rem;
    box-shadow: var(--news-shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.news-search:focus {
    outline: none;
    border-color: var(--news-accent);
    box-shadow: 0 0 0 4px var(--news-accent-soft);
}

.news-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.85rem;
}

.news-filter-chip {
    border: 1px solid var(--news-border);
    background: var(--news-surface);
    color: var(--news-muted);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.news-filter-chip:hover,
.news-filter-chip.active {
    background: var(--news-accent);
    border-color: var(--news-accent);
    color: #fff;
}

/* Feed grid */
.news-feed {
    padding: 2rem 0 4rem;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.news-card {
    background: var(--news-surface);
    border: 1px solid var(--news-border);
    border-radius: var(--news-radius);
    overflow: hidden;
    box-shadow: var(--news-shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: newsFadeUp 0.45s ease both;
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

:root.dark-mode .news-card:hover {
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

@keyframes newsFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.news-card-media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--news-accent-soft);
}

.news-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.news-card-media iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.news-card-image-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--news-accent);
    font-size: 2.25rem;
    background: var(--news-accent-soft);
}

.news-card:hover .news-card-media img {
    transform: scale(1.04);
}

.news-card-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.news-card-share {
    width: 34px;
    height: 34px;
    border: 1px solid var(--news-border);
    border-radius: 50%;
    background: var(--news-surface);
    color: var(--news-accent);
    cursor: pointer;
}

.news-card-share:hover {
    background: var(--news-accent-soft);
}

.news-card-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.news-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    backdrop-filter: blur(8px);
}

.news-badge-featured {
    background: rgba(255, 193, 7, 0.92);
    color: #1a1a1a;
}

.news-badge-dev {
    background: rgba(13, 110, 253, 0.9);
    color: #fff;
}

.news-badge-school {
    background: rgba(255, 255, 255, 0.92);
    color: #0d3b66;
}

.news-card-body {
    padding: 1.25rem 1.25rem 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.news-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--news-muted);
    margin-bottom: 0.65rem;
}

.news-school-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.news-school-pill img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
}

.news-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.5rem;
    color: var(--news-text);
}

.news-card-excerpt {
    color: var(--news-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    flex: 1;
}

.news-card-footer {
    padding: 0.75rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.news-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.news-emoji-btn {
    border: 1px solid var(--news-border);
    background: var(--news-surface-2);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    line-height: 1.4;
}

.news-emoji-btn:hover {
    transform: scale(1.08);
    background: var(--news-accent-soft);
}

.news-emoji-btn .count {
    font-size: 0.75rem;
    color: var(--news-muted);
    margin-left: 0.15rem;
}

.news-read-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    border: none;
    background: var(--news-accent);
    color: #fff !important;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.news-read-btn:hover {
    opacity: 0.9;
    color: #fff;
}

/* Single post */
.news-single {
    padding: 2rem 0 4rem;
}

.news-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--news-accent);
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    background: var(--news-accent-soft);
    transition: background 0.2s;
}

.news-back:hover {
    background: color-mix(in srgb, var(--news-accent-soft) 70%, var(--news-accent));
    color: var(--news-accent);
}

.news-article {
    background: var(--news-surface);
    border: 1px solid var(--news-border);
    border-radius: calc(var(--news-radius) + 4px);
    box-shadow: var(--news-shadow);
    overflow: hidden;
    max-width: 820px;
    margin: 0 auto;
}

.news-article-content {
    padding: 1rem 1.25rem 1.25rem;
}

.news-article-content h1 {
    font-size: clamp(1.45rem, 2.4vw, 1.95rem);
    font-weight: 800;
    line-height: 1.18;
    margin: 0.25rem 0 0.65rem;
}

.news-article-content .blog-content {
    line-height: 1.8;
    font-size: 1.05rem;
    color: var(--news-text);
}

.news-article-content .blog-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.news-article-content .blog-content ul {
    padding-left: 1.25rem;
    margin-bottom: 1rem;
}

.news-article-content .blog-content li {
    margin-bottom: 0.35rem;
    list-style: disc;
}

.news-cta-box {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--news-accent-soft), transparent);
    border: 1px solid var(--news-border);
    text-align: center;
}

.news-video {
    margin-top: 1.75rem;
    overflow: hidden;
    border-radius: 14px;
    background: #000;
}

.news-post-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.news-reactions, .news-share { position: relative; display: inline-block; }
.news-action-button { width: 38px; height: 34px; padding: 0; }
.news-reaction-menu, .news-share-menu {
    position: absolute;
    z-index: 5;
    left: 0;
    bottom: calc(100% + 0.5rem);
    min-width: 145px;
    padding: 0.4rem;
    border: 1px solid var(--news-border);
    border-radius: 10px;
    background: var(--news-surface);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.news-reaction-menu { display: flex; gap: .25rem; min-width: max-content; }
.news-share-menu a, .news-share-menu button { display: block; width: 100%; padding: .45rem .55rem; border: 0; background: transparent; color: var(--news-text); text-align: left; text-decoration: none; }
.news-share-menu a:hover, .news-share-menu button:hover { background: var(--news-surface-2); }
.news-share-menu i { width: 1.25rem; }

/* Comments */
.news-comments {
    max-width: 820px;
    margin: 2rem auto 0;
    background: var(--news-surface);
    border: 1px solid var(--news-border);
    border-radius: var(--news-radius);
    padding: 1.5rem;
}

.news-comment-item {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--news-border);
}

.news-comment-item:last-child {
    border-bottom: none;
}

.news-comment-form textarea {
    width: 100%;
    border: 1px solid var(--news-border);
    background: var(--news-surface-2);
    color: var(--news-text);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    resize: vertical;
    min-height: 90px;
}

/* Loading & empty */
.news-loading,
.news-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--news-muted);
}

.news-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--news-border);
    border-top-color: var(--news-accent);
    border-radius: 50%;
    animation: newsSpin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes newsSpin {
    to { transform: rotate(360deg); }
}

.news-sentinel {
    height: 1px;
}

@media (max-width: 768px) {
    .news-toolbar {
        top: 64px;
    }
    .news-grid {
        grid-template-columns: 1fr;
    }
    .news-article-content {
        padding: 1.25rem;
    }
}
