/**
 * WOCOO News Feed — Light Theme
 * 
 * Inherits design tokens from custom.css (:root variables).
 * Scoped to .news-theme to avoid leaking into landing page.
 * 
 * @version 2.0.0
 */


/* ============================================================
   FEED PAGE LAYOUT
   ============================================================ */

.news-theme {
    background: var(--bg-alt);
    min-height: 80vh;
}

.newsfeed-section {
    padding: var(--sp-lg) 0 var(--sp-3xl);
}

.newsfeed-section .container {
    max-width: 820px;
}


/* ============================================================
   FILTER TABS
   ============================================================ */

.feed-filters {
    display: flex;
    gap: var(--sp-xs);
    padding: var(--sp-sm) 0 var(--sp-lg);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.feed-filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background: var(--bg-body);
    border: 1px solid var(--border-light);
    padding: 0.6rem 1.4rem;
    border-radius: 24px;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-body);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.filter-btn:hover {
    background: var(--bg-card);
    color: var(--text-heading);
}

.filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}


/* ============================================================
   NEWS POST CARDS
   ============================================================ */

.news-feed {
    display: flex;
    flex-direction: column;
    gap: var(--sp-md);
}

.news-post {
    background: var(--bg-body);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border-light);
    border-top: 4px solid var(--primary);          /* default: magenta */
}

.news-post:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* ── Colored top borders by content category ── */
.news-post[data-badge="breaking"]  { border-top-color: #e53935; }
.news-post[data-badge="live"]      { border-top-color: #e53935; }
.news-post[data-badge="politics"]  { border-top-color: #5c6bc0; }
.news-post[data-badge="business"]  { border-top-color: #1565c0; }
.news-post[data-badge="climate"]   { border-top-color: #2e7d32; }
.news-post[data-badge="health"]    { border-top-color: #00897b; }
.news-post[data-badge="sports"]    { border-top-color: #f57c00; }
.news-post[data-badge="news"]      { border-top-color: var(--primary); }


/* ── Post Header ── */

.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-sm) var(--sp-md);
    border-bottom: 1px solid var(--bg-alt);
}

.source-info,
.publisher-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.source-avatar,
.publisher-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wocoo-teal), var(--wocoo-blue));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.source-avatar-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border-light);
}

.publisher-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.source-details h4,
.publisher-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-heading);
    margin: 0 0 2px;
}

.source-time,
.post-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.breaking-badge {
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--primary);                     /* default: magenta */
}

/* Badge colors matching card top borders */
.news-post[data-badge="breaking"] .breaking-badge  { background: #e53935; animation: pulse 2s infinite; }
.news-post[data-badge="live"] .breaking-badge       { background: #e53935; animation: pulse 2s infinite; }
.news-post[data-badge="politics"] .breaking-badge   { background: #5c6bc0; }
.news-post[data-badge="business"] .breaking-badge   { background: #1565c0; }
.news-post[data-badge="climate"] .breaking-badge    { background: #2e7d32; }
.news-post[data-badge="health"] .breaking-badge     { background: #00897b; }
.news-post[data-badge="sports"] .breaking-badge     { background: #f57c00; }
.news-post[data-badge="news"] .breaking-badge       { background: var(--primary); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}


/* ── Post Title ── */

.post-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.4;
    padding: var(--sp-sm) var(--sp-md) 0;
    margin: 0;
}


/* ── Video Player ── */

.video-player-area {
    position: relative;
    width: 100%;
    padding-top: 56.25%;    /* 16:9 ratio */
    margin-top: var(--sp-sm);
    background: var(--bg-card);
    overflow: hidden;
}

.video-player-area iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Placeholder for demo / unavailable videos */
.video-placeholder {
    position: relative;
}

.video-placeholder .video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-placeholder-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--bg-card) 0%, #e2e4e9 100%);
}

.placeholder-icon {
    font-size: 2.5rem;
    opacity: 0.5;
}

.placeholder-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 2;
}

.play-button:hover {
    background: var(--primary);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* ── Verification Section ── */

.verified-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: var(--sp-sm) var(--sp-md) 0;
    font-size: 0.85rem;
}

.verified-label {
    color: var(--text-muted);
    font-weight: 500;
}

.verifier-links a {
    color: var(--wocoo-teal);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.verifier-links a:hover {
    color: var(--wocoo-blue);
    text-decoration: underline;
}


/* ── Fact-Check Row ── */

.fact-check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: var(--sp-xs) var(--sp-md) 0;
    flex-wrap: wrap;
}

.fact-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.fact-badge.ai-verified {
    background: #e8f5e9;
    color: #2e7d32;
}

.fact-badge.ai-verified .badge-icon {
    color: #2e7d32;
}

.fact-badge.trust-score {
    background: #e3f2fd;
    color: #1565c0;
}

.fact-badge.pending {
    background: #fff3e0;
    color: #e65100;
}

.fact-badge.unverified {
    background: #ffebee;
    color: #c62828;
}


/* ── Engagement Row ── */

.engagement-row {
    padding: var(--sp-sm) var(--sp-md);
    border-top: 1px solid var(--bg-alt);
    margin-top: var(--sp-sm);
}

.engagement-stats {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
}

.stat-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.stat-button:hover {
    background: var(--bg-card);
    color: var(--text-heading);
}

.stat-button .stat-icon {
    font-size: 1rem;
}


/* ── Post Actions (like/comment/share) ── */

.post-actions {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0.75rem var(--sp-md);
    border-top: 1px solid var(--bg-alt);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--bg-card);
    color: var(--text-heading);
}

.action-btn.active {
    color: var(--primary);
    background: rgba(233, 30, 99, 0.08);
}


/* ============================================================
   COMMENTS SECTION
   ============================================================ */

.comments-section {
    border-top: 1px solid var(--bg-alt);
    padding: var(--sp-sm) var(--sp-md);
    background: var(--bg-alt);
}

.comment-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.comment-input {
    flex: 1;
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 10px 16px;
    resize: none;
    font-family: var(--font);
    font-size: 0.9rem;
    transition: var(--transition);
    background: var(--bg-body);
}

.comment-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.comment-submit-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.comment-submit-btn:hover {
    background: var(--primary-hover);
}


/* ============================================================
   LOADING / LOAD MORE / END MESSAGE
   ============================================================ */

.loading {
    text-align: center;
    padding: var(--sp-xl) 0;
    color: var(--text-muted);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--bg-card);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--sp-sm);
}

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

.load-more-container {
    text-align: center;
    padding: var(--sp-xl) 0;
}

.load-more-btn {
    background: var(--bg-body);
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 0.75rem 2rem;
    border-radius: 24px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.load-more-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.25);
}

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.load-more-info {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: var(--sp-xs) 0 0;
}

.end-message {
    text-align: center;
    padding: var(--sp-xl);
    background: var(--bg-body);
    border-radius: var(--radius);
    margin-top: var(--sp-lg);
    border: 1px solid var(--border-light);
}

.end-message p {
    font-size: 1.05rem;
    color: var(--text-body);
    margin-bottom: var(--sp-md);
}

.end-message .cta-primary {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.end-message .cta-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}


/* ============================================================
   ERROR STATE
   ============================================================ */

.error-state {
    text-align: center;
    padding: var(--sp-2xl) var(--sp-md);
    background: var(--bg-body);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.error-state h3 {
    color: var(--text-heading);
    margin-bottom: var(--sp-xs);
}

.error-state p {
    color: var(--text-muted);
    margin-bottom: var(--sp-md);
}

.retry-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 24px;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.retry-btn:hover {
    background: var(--primary-hover);
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .newsfeed-section {
        padding: var(--sp-sm) 0 var(--sp-xl);
    }
    
    .newsfeed-section .container {
        padding: 0 var(--sp-sm);
    }

    .news-post {
        border-radius: var(--radius-sm);
    }

    .post-title {
        font-size: 1.05rem;
    }

    .engagement-stats {
        gap: var(--sp-sm);
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .post-actions {
        padding: 0.6rem var(--sp-sm);
    }
}

@media (max-width: 480px) {
    .post-header {
        padding: var(--sp-sm);
    }
    
    .post-title {
        padding: var(--sp-xs) var(--sp-sm) 0;
    }

    .verified-section,
    .fact-check-row,
    .engagement-row {
        padding-left: var(--sp-sm);
        padding-right: var(--sp-sm);
    }

    .source-avatar,
    .publisher-avatar {
        width: 38px;
        height: 38px;
        font-size: 0.75rem;
    }

    .source-avatar-img {
        width: 38px;
        height: 38px;
    }
}