/**
 * Modern News Grid CSS
 * Grid layout with platform icons and popup functionality
 */

/* Container and Base Styles */
.news-grid-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Main News Background Container */
.news-main-background {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: 30px;
    margin: 20px auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.news-main-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.03) 0%, 
        rgba(118, 75, 162, 0.03) 50%,
        rgba(102, 126, 234, 0.03) 100%);
    pointer-events: none;
    z-index: 0;
}

.news-main-background > * {
    position: relative;
    z-index: 1;
}

/* Modern Grid Header */
.news-grid-header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 35px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.4);
    position: relative;
    overflow: hidden;
}

.news-grid-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    pointer-events: none;
}

.news-header-content {
    position: relative;
    z-index: 1;
}

.news-main-title {
    font-size: 36px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.news-main-title i {
    color: #667eea;
    font-size: 40px;
}

.news-main-subtitle {
    color: #64748b;
    font-size: 18px;
    margin: 0 0 25px 0;
    font-weight: 400;
}

.news-header-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.news-stat-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.news-stat-badge i {
    font-size: 16px;
}

/* News Grid Layout */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

/* Grid Card Styles */
.news-grid-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.4s ease;
    opacity: 0;
    transform: translateY(30px);
    position: relative;
}

.news-grid-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.05) 100%);
    pointer-events: none;
    z-index: 0;
}

.news-grid-card > * {
    position: relative;
    z-index: 1;
}

.news-grid-card.grid-fade-in {
    animation: gridFadeIn 0.6s ease forwards;
}

.news-grid-card:hover,
.news-grid-card.card-hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.95);
}

/* Card Header with Platform Icon */
.news-card-header {
    display: flex;
    align-items: center;
    padding: 20px 25px 15px;
    gap: 15px;
}

.news-platform-icon {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    background: rgba(102, 126, 234, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.news-platform-icon i {
    font-size: 24px;
    transition: all 0.3s ease;
}

.news-platform-icon i.icon-bounce {
    animation: iconBounce 0.6s ease;
}

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

.news-platform-name {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.news-card-date {
    font-size: 13px;
    color: #64748b;
    font-weight: 400;
}

/* Card Content */
.news-card-content {
    padding: 0 25px 20px;
}

.news-card-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 12px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-excerpt {
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Actions */
.news-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 25px;
    border-top: 1px solid rgba(226, 232, 240, 0.5);
}

.news-read-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.news-read-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.news-read-btn.btn-clicked {
    transform: scale(0.95);
}

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

.share-btn {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: white;
}

.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.2);
}

/* Empty State */
.news-grid-empty {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 18px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.4);
    margin-top: 20px;
}

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

.empty-icon {
    font-size: 80px;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 24px;
    color: #1e293b;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.empty-state p {
    color: #64748b;
    font-size: 16px;
    margin: 0 0 30px 0;
    line-height: 1.5;
}

.back-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.back-home-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

/* News Popup Modal */
.news-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

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

.news-popup {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    transform: scale(0.9) translateY(30px);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.news-popup.popup-enter {
    animation: popupEnter 0.3s ease;
}

.news-popup.popup-exit {
    animation: popupExit 0.3s ease;
}

/* Popup Header */
.news-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 25px 30px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

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

.popup-platform-icon {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    background: rgba(102, 126, 234, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-platform-icon i {
    font-size: 24px;
}

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

.popup-platform-name {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.popup-title {
    font-size: 22px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    line-height: 1.3;
}

.news-popup-close {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(226, 232, 240, 0.5);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #64748b;
    font-size: 16px;
}

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

/* Popup Content */
.news-popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.popup-content-text {
    color: #334155;
    line-height: 1.7;
    font-size: 16px;
}

.popup-content-text h1,
.popup-content-text h2,
.popup-content-text h3 {
    color: #1e293b;
    margin-top: 25px;
    margin-bottom: 15px;
    font-weight: 600;
}

.popup-content-text h1 { font-size: 28px; }
.popup-content-text h2 { font-size: 24px; }
.popup-content-text h3 { font-size: 20px; }

.popup-content-text p {
    margin: 0 0 18px 0;
}

.popup-content-text ul,
.popup-content-text ol {
    margin: 18px 0;
    padding-left: 25px;
}

.popup-content-text li {
    margin-bottom: 10px;
}

.popup-content-text strong {
    font-weight: 600;
    color: #1e293b;
}

.popup-content-text a {
    color: #667eea;
    text-decoration: none;
}

.popup-content-text a:hover {
    text-decoration: underline;
}

/* Popup Footer */
.news-popup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.popup-share {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: #64748b;
}

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

.popup-share-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    color: white;
}

.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.15);
}

.popup-close-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #6b7280;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.popup-close-btn:hover {
    background: #4b5563;
}

/* Animations */
@keyframes gridFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes popupEnter {
    from {
        transform: scale(0.9) translateY(30px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes popupExit {
    from {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    to {
        transform: scale(0.9) translateY(30px);
        opacity: 0;
    }
}

/* Body scroll lock */
body.popup-open {
    overflow: hidden;
}

/* Platform specific colors via CSS variables */
.news-grid-card[data-platform="android"] .news-platform-icon {
    background: rgba(61, 220, 132, 0.1);
}

.news-grid-card[data-platform="ios"] .news-platform-icon {
    background: rgba(0, 122, 255, 0.1);
}

.news-grid-card[data-platform="samsung"] .news-platform-icon {
    background: rgba(20, 40, 160, 0.1);
}

.news-grid-card[data-platform="lg"] .news-platform-icon {
    background: rgba(165, 0, 52, 0.1);
}

.news-grid-card[data-platform="fire"] .news-platform-icon {
    background: rgba(255, 153, 0, 0.1);
}

.news-grid-card[data-platform="roku"] .news-platform-icon {
    background: rgba(102, 45, 145, 0.1);
}

.news-grid-card[data-platform="web"] .news-platform-icon {
    background: rgba(66, 133, 244, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .news-grid-container {
        padding: 15px;
    }
    
    .news-main-background {
        padding: 20px;
        margin: 15px auto;
        border-radius: 20px;
    }
    
    .news-grid-header {
        padding: 25px 20px;
        margin-bottom: 20px;
        border-radius: 15px;
    }
    
    .news-main-title {
        font-size: 28px;
        flex-direction: column;
        gap: 10px;
    }
    
    .news-main-title i {
        font-size: 32px;
    }
    
    .news-main-subtitle {
        font-size: 16px;
    }
    
    .news-header-stats {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .news-card-header {
        padding: 15px 20px 12px;
    }
    
    .news-platform-icon {
        width: 45px;
        height: 45px;
    }
    
    .news-platform-icon i {
        font-size: 20px;
    }
    
    .news-card-content {
        padding: 0 20px 15px;
    }
    
    .news-card-title {
        font-size: 18px;
    }
    
    .news-card-actions {
        padding: 15px 20px 20px;
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .news-card-share {
        justify-content: center;
    }
    
    .news-popup {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .news-popup-header {
        padding: 20px;
    }
    
    .popup-title {
        font-size: 18px;
    }
    
    .news-popup-content {
        padding: 20px;
    }
    
    .popup-content-text {
        font-size: 15px;
    }
    
    .news-popup-footer {
        padding: 20px;
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .popup-share {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .news-grid-container {
        padding: 10px;
    }
    
    .news-main-background {
        padding: 15px;
        margin: 10px auto;
        border-radius: 18px;
    }
    
    .news-grid-header {
        padding: 20px 15px;
        border-radius: 12px;
    }
    
    .news-main-title {
        font-size: 24px;
    }
    
    .news-grid {
        gap: 15px;
    }
    
    .news-card-header {
        padding: 12px 15px 10px;
        gap: 12px;
    }
    
    .news-platform-icon {
        width: 40px;
        height: 40px;
    }
    
    .news-platform-icon i {
        font-size: 18px;
    }
    
    .news-card-content {
        padding: 0 15px 12px;
    }
    
    .news-card-title {
        font-size: 16px;
    }
    
    .news-card-excerpt {
        font-size: 13px;
    }
    
    .news-card-actions {
        padding: 12px 15px 15px;
    }
    
    .news-read-btn {
        padding: 8px 16px;
        font-size: 13px;
        justify-content: center;
    }
    
    .share-btn {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .news-popup-overlay {
        padding: 10px;
    }
    
    .news-popup-header {
        padding: 15px;
    }
    
    .popup-platform-info {
        gap: 12px;
    }
    
    .popup-platform-icon {
        width: 40px;
        height: 40px;
    }
    
    .popup-platform-icon i {
        font-size: 20px;
    }
    
    .popup-title {
        font-size: 16px;
    }
    
    .news-popup-content {
        padding: 15px;
    }
    
    .popup-content-text {
        font-size: 14px;
        line-height: 1.6;
    }
    
    .news-popup-footer {
        padding: 15px;
    }
    
    .popup-share-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .news-platform-icon,
    .popup-platform-icon {
        border: 0.5px solid rgba(226, 232, 240, 0.5);
    }
}

/* Reduced motion preference */
@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: translateY(0);
    }
    
    .news-platform-icon i.icon-bounce {
        animation: none;
    }
}

/* Print styles */
@media print {
    .news-grid-header,
    .news-grid-card {
        background: white;
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
    
    .news-card-actions,
    .news-popup-overlay {
        display: none;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
    }
}
