/* News & CMS Styles */

/* Override body background for news pages */
body:has(.news-container),
body:has(.news-detail-container) {
    background: #f5f5f5 !important;
}

/* Keep content wrapper flex layout for ads */
body:has(.news-container) .content-wrapper,
body:has(.news-detail-container) .content-wrapper {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 20px !important;
    padding: 20px !important;
    max-width: 1800px !important;
    margin: 0 auto !important;
}

.news-container {
    max-width: 1200px;
    flex: 1;
    padding: 40px 20px;
    background: transparent;
}

.news-header {
    text-align: center;
    margin-bottom: 40px;
    background: white;
    padding: 40px 20px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.news-header h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 10px;
}

.news-header .subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 20px;
}

.news-nav {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    gap: 10px;
    max-width: 500px;
    margin: 20px auto 0;
}

.search-box input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

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

.news-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    border: 1px solid #e0e0e0;
}

.news-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.news-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.news-card-content {
    padding: 20px;
}

.news-card-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-excerpt {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #999;
}

.news-card-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.news-card-stats {
    display: flex;
    gap: 15px;
}

/* News Detail */
.news-detail-container {
    max-width: 900px;
    flex: 1;
    padding: 40px 20px;
}

.breadcrumb {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

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

.breadcrumb a:hover {
    text-decoration: underline;
}

.news-article {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

.article-header {
    margin-bottom: 30px;
}

.article-title {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 20px;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.article-thumbnail {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 30px;
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}

.article-content p {
    margin-bottom: 20px;
}

.article-content h2 {
    font-size: 1.8rem;
    color: #667eea;
    margin: 30px 0 15px;
    font-weight: 700;
}

.article-content h3 {
    font-size: 1.4rem;
    color: #764ba2;
    margin: 25px 0 12px;
    font-weight: 600;
}

.article-content ul, .article-content ol {
    margin: 15px 0 15px 30px;
    padding-left: 20px;
}

.article-content li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.article-content strong {
    font-weight: 700;
    color: #333;
}

.article-content em {
    font-style: italic;
}

.article-content a {
    color: #667eea;
    text-decoration: underline;
}

.article-content a:hover {
    color: #764ba2;
}

/* Code blocks */
.article-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.article-content pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
}

.article-content pre code {
    background: none;
    padding: 0;
}

/* Blockquotes */
.article-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: #666;
}

/* Images in content */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
    display: block;
}

/* Tables */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.article-content table th,
.article-content table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.article-content table th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.article-content table tr:nth-child(even) {
    background: #f9f9f9;
}

/* Button Styles Override for News Pages */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

/* Comments Section */
.comments-section {
    margin-top: 40px;
}

.comments-section h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 30px;
}

.comment-form-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
}

.comment-form-card h3 {
    font-size: 1.5rem;
    color: #667eea;
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.input-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 0.85rem;
    color: #999;
    margin-top: 10px;
}

.comments-list {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
}

.comment-item {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

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

.comment-author {
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.comment-date {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 10px;
}

.comment-text {
    color: #333;
    line-height: 1.6;
}

.load-more-container {
    text-align: center;
    margin: 40px 0;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.2rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .news-header h1 {
        font-size: 2rem;
    }
    
    .news-header {
        padding: 30px 15px;
    }
    
    .article-title {
        font-size: 2rem;
    }
    
    .news-article {
        padding: 25px;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-box input,
    .search-box button {
        width: 100%;
    }
    
    /* Mobile popup ads for news pages */
    body:has(.news-container) .side-ad,
    body:has(.news-detail-container) .side-ad {
        display: none !important;
    }
    
    /* Show mobile banner ad */
    body:has(.news-container) .mobile-ad-banner,
    body:has(.news-detail-container) .mobile-ad-banner {
        display: block !important;
    }
    
    /* Center content on mobile */
    body:has(.news-container) .content-wrapper,
    body:has(.news-detail-container) .content-wrapper {
        padding: 10px !important;
    }
    
    .news-container,
    .news-detail-container {
        padding: 20px 10px;
    }
}

/* Mobile Banner Ad (Popup) */
.mobile-ad-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
    padding: 10px;
}

/* When ad is closed - HIGHEST SPECIFICITY */
.mobile-ad-banner.ad-closed {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Social Share Buttons */
.social-share-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
}

.share-title {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.social-share-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.share-btn:active {
    transform: translateY(-1px);
}

.whatsapp-btn {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

.whatsapp-btn:hover {
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.4);
}

.facebook-btn {
    background: linear-gradient(135deg, #1877F2 0%, #0C63D4 100%);
}

.facebook-btn:hover {
    box-shadow: 0 5px 15px rgba(24, 119, 242, 0.4);
}

.twitter-btn {
    background: linear-gradient(135deg, #1DA1F2 0%, #0C85D0 100%);
}

.twitter-btn:hover {
    box-shadow: 0 5px 15px rgba(29, 161, 242, 0.4);
}

.copy-btn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

.copy-btn:hover {
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

.share-icon {
    font-size: 1.2rem;
}

.share-text {
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .social-share-buttons {
        flex-direction: column;
    }
    
    .share-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   TAGS FOOTER
   ======================================== */

.tags-footer {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 3px solid #e0e0e0;
}

.tags-footer-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e0e0e0;
}

.tags-footer-title {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: center;
    justify-content: center;
}

.tags-footer-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.tags-footer-list .tag-btn,
.tag-btn {
    display: inline-block;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.95rem;
    color: #555;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.tags-footer-list .tag-btn:hover,
.tag-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tags-footer-list .tag-btn.active,
.tag-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    font-weight: 600;
}

.loading-tags {
    text-align: center;
    padding: 20px;
    color: #999;
}

/* Active Tag Banner */
.active-tag-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.active-tag-banner strong {
    font-weight: 700;
}

.btn-clear-filter {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-clear-filter:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .tags-footer {
        margin-top: 40px;
        padding-top: 30px;
    }
    
    .tags-footer-section {
        padding: 20px;
    }
    
    .tags-footer-title {
        font-size: 1.3rem;
    }
    
    .tags-footer-list {
        gap: 8px;
    }
    
    .tags-footer-list .tag-btn,
    .tag-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .active-tag-banner {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .btn-clear-filter {
        width: 100%;
    }
}

.mobile-ad-content {
    position: relative;
    max-width: 100%;
    height: 100%;
    background: white;
    border-radius: 15px 15px 0 0;
    overflow: hidden;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    max-height: 50vh;
}

.mobile-ad-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 50px; /* Bigger for easier tap */
    height: 50px;
    background: rgba(255, 0, 0, 0.98) !important;
    color: white !important;
    border: 3px solid white !important;
    border-radius: 50%;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 999999 !important; /* Maximum z-index */
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7) !important;
    line-height: 1;
    padding: 0;
    pointer-events: auto !important; /* Force clickable */
    touch-action: manipulation !important; /* Better touch response */
}

.mobile-ad-close:hover {
    background: rgba(255, 0, 0, 1) !important;
    transform: scale(1.2);
    box-shadow: 0 5px 20px rgba(255, 0, 0, 0.6) !important;
}

.mobile-ad-close:active {
    transform: scale(0.95) !important;
    background: rgba(200, 0, 0, 1) !important;
}

.mobile-ad-banner a {
    display: block;
    height: 100%;
    pointer-events: auto; /* Allow clicks on ad */
}

.mobile-ad-banner img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 50vh;
    object-fit: contain;
    background: white;
    pointer-events: none; /* Prevent image from blocking close button */
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* Show ads on larger screens (same as game page) */
@media (min-width: 1400px) {
    body:has(.news-container) .side-ad,
    body:has(.news-detail-container) .side-ad {
        display: block !important;
    }
    
    /* Hide mobile banner on desktop */
    .mobile-ad-banner {
        display: none !important;
    }
}
