/**
 * News Grid CSS - Dark Theme
 * Matches homepage dark theme: #080b12 background system
 */

/* ---- Variables ---- */
:root {
    --ng-bg:           #0f1117;
    --ng-section-bg:   #080b12;
    --ng-card-bg:      #1a1d27;
    --ng-card-border:  #2a2d3a;
    --ng-accent:       #4f8ef7;
    --ng-accent-2:     #7c5ef8;
    --ng-text:         #f0f2f8;
    --ng-text-muted:   #9aa0b8;
    --ng-badge-bg:     rgba(79,142,247,0.12);
    --ng-badge-border: rgba(79,142,247,0.3);
    --ng-glow:         rgba(79,142,247,0.18);
}

body { background: #0f1117 !important; }

/* ---- Page Wrapper ---- */
.news-grid-container {
    background: var(--ng-bg);
    min-height: 100vh;
    padding: 0 0 80px 0;
}

/* ---- Section Header ---- */
.news-section-header {
    text-align: center;
    padding: 72px 20px 52px;
}

.ng-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ng-badge-bg);
    border: 1px solid var(--ng-badge-border);
    border-radius: 20px;
    padding: 7px 18px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ng-accent);
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.ng-badge i { font-size: 12px; }

.ng-section-title {
    font-size: 40px;
    font-weight: 700;
    color: var(--ng-text);
    margin: 0 0 12px 0;
    line-height: 1.2;
}

.ng-section-title span {
    background: linear-gradient(135deg, var(--ng-accent) 0%, var(--ng-accent-2) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ng-section-sub {
    font-size: 17px;
    color: var(--ng-text-muted);
    margin: 0 0 28px 0;
}

.ng-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.ng-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    color: var(--ng-text-muted);
}

.ng-stat-pill i { color: var(--ng-accent); font-size: 12px; }

/* ---- Grid Wrapper ---- */
.news-main-background {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ---- Card ---- */
.news-grid-card {
    background: var(--ng-card-bg);
    border: 1px solid var(--ng-card-border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.news-grid-card:hover {
    border-color: var(--ng-accent);
    box-shadow: 0 0 0 1px var(--ng-accent), 0 8px 32px var(--ng-glow);
    transform: translateY(-4px);
}

.news-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 20px 0;
}

.news-platform-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(79,142,247,0.12);
}

.news-platform-icon i { font-size: 20px; color: var(--ng-accent); }

/* Platform brand colors */
.news-grid-card[data-platform="android"] .news-platform-icon { background: rgba(61,220,132,0.12); }
.news-grid-card[data-platform="android"] .news-platform-icon i { color: #3ddc84; }
.news-grid-card[data-platform="ios"] .news-platform-icon { background: rgba(0,122,255,0.12); }
.news-grid-card[data-platform="ios"] .news-platform-icon i { color: #007aff; }
.news-grid-card[data-platform="samsung"] .news-platform-icon { background: rgba(30,70,220,0.14); }
.news-grid-card[data-platform="samsung"] .news-platform-icon i { color: #4f8ef7; }
.news-grid-card[data-platform="lg"] .news-platform-icon { background: rgba(165,0,52,0.12); }
.news-grid-card[data-platform="lg"] .news-platform-icon i { color: #e05070; }
.news-grid-card[data-platform="roku"] .news-platform-icon { background: rgba(102,45,145,0.14); }
.news-grid-card[data-platform="roku"] .news-platform-icon i { color: #b07cf8; }
.news-grid-card[data-platform="fire"] .news-platform-icon { background: rgba(255,153,0,0.12); }
.news-grid-card[data-platform="fire"] .news-platform-icon i { color: #ff9900; }
.news-grid-card[data-platform="web"] .news-platform-icon { background: rgba(79,142,247,0.12); }
.news-grid-card[data-platform="web"] .news-platform-icon i { color: var(--ng-accent); }
.news-grid-card[data-platform="general"] .news-platform-icon { background: rgba(124,94,248,0.12); }
.news-grid-card[data-platform="general"] .news-platform-icon i { color: var(--ng-accent-2); }

.news-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.news-platform-name {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--ng-accent);
}

.news-card-date {
    font-size: 12px;
    color: var(--ng-text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.news-card-date i { font-size: 11px; }

.news-card-content {
    padding: 16px 20px 12px;
    flex: 1;
}

.news-card-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--ng-text);
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.news-card-excerpt {
    font-size: 14px;
    color: var(--ng-text-muted);
    line-height: 1.6;
    margin: 0;
}

.news-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 20px;
    border-top: 1px solid var(--ng-card-border);
    margin-top: 4px;
    gap: 10px;
}

.news-read-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--ng-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.news-read-btn:hover {
    background: #3a7ae0;
    box-shadow: 0 4px 16px rgba(79,142,247,0.35);
    transform: translateY(-1px);
}

.news-card-share { display: flex; gap: 8px; }

.share-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 14px;
    color: #fff;
}

.share-btn:nth-child(1) { background: #1da1f2; }
.share-btn:nth-child(2) { background: #4267b2; }

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ---- Empty State ---- */
.news-grid-empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--ng-card-bg);
    border: 1px solid var(--ng-card-border);
    border-radius: 18px;
    margin-top: 20px;
}

.empty-state { max-width: 400px; margin: 0 auto; }

.empty-icon {
    font-size: 70px;
    color: var(--ng-text-muted);
    margin-bottom: 20px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 22px;
    color: var(--ng-text);
    margin: 0 0 10px 0;
    font-weight: 600;
}

.empty-state p {
    color: var(--ng-text-muted);
    font-size: 15px;
    margin: 0 0 28px 0;
    line-height: 1.5;
}

.back-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ng-accent);
    color: #fff;
    padding: 11px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.back-home-btn:hover {
    background: #3a7ae0;
    box-shadow: 0 6px 20px rgba(79,142,247,0.38);
    transform: translateY(-2px);
    color: #fff;
    text-decoration: none;
}

/* ---- Popup Modal ---- */
.news-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6,9,18,0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

.news-popup-overlay.active { opacity: 1; visibility: visible; }

.news-popup {
    background: #0f1320;
    border: 1px solid #1e2438;
    border-radius: 20px;
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(79,142,247,0.15);
    transform: scale(0.93) translateY(24px);
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    opacity: 0;
}

.news-popup-overlay.active .news-popup {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.news-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 26px;
    border-bottom: 1px solid #1a1e30;
    background: rgba(79,142,247,0.05);
    flex-shrink: 0;
}

.popup-platform-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.popup-platform-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: rgba(79,142,247,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.popup-platform-icon i { font-size: 22px; color: var(--ng-accent); }

.popup-header-text { flex: 1; min-width: 0; }

.popup-platform-name {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--ng-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.popup-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ng-text);
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-popup-close {
    width: 38px;
    height: 38px;
    border: 1px solid #1e2438;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    color: var(--ng-text-muted);
    font-size: 15px;
    flex-shrink: 0;
}

.news-popup-close:hover {
    background: rgba(239,68,68,0.12);
    border-color: rgba(239,68,68,0.4);
    color: #ef4444;
}

.news-popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 26px;
    scrollbar-width: thin;
    scrollbar-color: #1e2438 transparent;
}

.news-popup-content::-webkit-scrollbar { width: 5px; }
.news-popup-content::-webkit-scrollbar-track { background: transparent; }
.news-popup-content::-webkit-scrollbar-thumb { background: #1e2438; border-radius: 4px; }

.popup-content-text {
    color: #b0b8cc;
    line-height: 1.75;
    font-size: 15px;
}

.popup-content-text h1,.popup-content-text h2,.popup-content-text h3 {
    color: var(--ng-text);
    margin-top: 26px;
    margin-bottom: 14px;
    font-weight: 600;
}

.popup-content-text h1 { font-size: 26px; }
.popup-content-text h2 { font-size: 22px; }
.popup-content-text h3 { font-size: 18px; }
.popup-content-text p { margin: 0 0 16px 0; }
.popup-content-text ul,.popup-content-text ol { margin: 16px 0; padding-left: 24px; }
.popup-content-text li { margin-bottom: 8px; }
.popup-content-text strong { font-weight: 600; color: var(--ng-text); }
.popup-content-text a { color: var(--ng-accent); text-decoration: none; }
.popup-content-text a:hover { text-decoration: underline; }

.news-popup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 26px;
    border-top: 1px solid #1a1e30;
    background: rgba(0,0,0,0.2);
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 12px;
}

.popup-share {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--ng-text-muted);
}

.popup-share-buttons { display: flex; gap: 8px; }

.popup-share-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}

.popup-share-btn.twitter { background: #1da1f2; }
.popup-share-btn.facebook { background: #4267b2; }
.popup-share-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

.popup-close-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,0.06);
    color: var(--ng-text-muted);
    border: 1px solid #1e2438;
    padding: 9px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-size: 13px;
    font-weight: 500;
}

.popup-close-btn:hover { background: rgba(255,255,255,0.1); color: var(--ng-text); }

/* ---- Animations ---- */
@keyframes ngCardIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.news-grid-card.grid-fade-in { animation: ngCardIn 0.4s ease both; }

@keyframes iconBounce {
    0%,20%,50%,80%,100% { transform: translateY(0); }
    40%  { transform: translateY(-5px); }
    60%  { transform: translateY(-3px); }
}

.news-platform-icon i.icon-bounce { animation: iconBounce 0.6s ease; }
body.popup-open { overflow: hidden; }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
    .news-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .ng-section-title { font-size: 30px; }
    .news-main-background { padding: 0 12px; }
    .news-grid { grid-template-columns: 1fr; gap: 16px; }
    .news-section-header { padding: 48px 16px 36px; }
    .news-card-actions { flex-direction: column; align-items: stretch; }
    .news-read-btn { justify-content: center; }
    .news-card-share { justify-content: center; }
    .news-popup-header { padding: 16px 18px; }
    .popup-title { font-size: 17px; }
    .news-popup-content { padding: 18px; }
    .news-popup-footer { flex-direction: column; align-items: stretch; }
    .popup-share { justify-content: center; }
}

@media (max-width: 480px) {
    .ng-section-title { font-size: 24px; }
    .news-section-header { padding: 36px 12px 28px; }
    .news-grid { gap: 12px; }
    .news-card-title { font-size: 15px; }
    .news-card-excerpt { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    .news-grid-card, .news-read-btn, .share-btn, .news-popup { transition: none; }
    .news-grid-card.grid-fade-in { animation: none; opacity: 1; transform: none; }
    .news-platform-icon i.icon-bounce { animation: none; }
}
