/**
 * NewsPortal Enhancements Styles
 * Comprehensive styling for all new features
 */

/* ============================================================================
   DARK MODE
   ============================================================================ */
.dark-mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    background: white;
    border: 2px solid #ddd;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.dark-mode-toggle .sun-icon {
    display: block;
}

.dark-mode-toggle .moon-icon {
    display: none;
}

body.dark-mode .dark-mode-toggle .sun-icon {
    display: none;
}

body.dark-mode .dark-mode-toggle .moon-icon {
    display: block;
}

/* Dark mode global styles */
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode header,
body.dark-mode nav,
body.dark-mode footer {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .news-card,
body.dark-mode .article,
body.dark-mode article {
    background-color: #2d2d2d;
    border-color: #3d3d3d;
}

body.dark-mode a {
    color: #64b5f6;
}

body.dark-mode .dark-mode-toggle {
    background: #2d2d2d;
    border-color: #4d4d4d;
}

/* ============================================================================
   NEWSLETTER POPUP
   ============================================================================ */
.newsletter-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.newsletter-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.newsletter-modal {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

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

.newsletter-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: #666;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.newsletter-close:hover {
    color: #000;
}

.newsletter-content h3 {
    margin: 0 0 1rem 0;
    font-size: 1.75rem;
    color: #333;
}

.newsletter-content p {
    margin: 0 0 1.5rem 0;
    color: #666;
    line-height: 1.6;
}

.newsletter-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.newsletter-form input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.newsletter-form input:focus {
    outline: none;
    border-color: var(--primary-color, #1565c0);
}

.newsletter-form button {
    padding: 0.875rem 1.5rem;
    background: var(--primary-color, #1565c0);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.newsletter-form button:hover {
    background: var(--primary-dark, #0d47a1);
    transform: translateY(-1px);
}

.newsletter-privacy {
    font-size: 0.85rem;
    color: #999;
    margin: 0;
}

/* Dark mode newsletter */
body.dark-mode .newsletter-modal {
    background: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .newsletter-content h3 {
    color: #e0e0e0;
}

body.dark-mode .newsletter-content p {
    color: #aaa;
}

body.dark-mode .newsletter-form input {
    background: #1a1a1a;
    border-color: #4d4d4d;
    color: #e0e0e0;
}

/* ============================================================================
   TRENDING SIDEBAR
   ============================================================================ */
.trending-sidebar {
    position: sticky;
    top: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    max-width: 350px;
}

.trending-header {
    margin-bottom: 1rem;
}

.trending-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.trending-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.trending-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.trending-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.trending-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color, #1565c0);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.9rem;
}

.trending-content {
    flex: 1;
}

.trending-content h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #333;
}

.trending-meta {
    font-size: 0.75rem;
    color: #666;
}

/* Dark mode trending */
body.dark-mode .trending-sidebar {
    background: #2d2d2d;
}

body.dark-mode .trending-item {
    background: #1a1a1a;
}

body.dark-mode .trending-content h4 {
    color: #e0e0e0;
}

/* ============================================================================
   SEARCH BAR
   ============================================================================ */
.search-container {
    position: relative;
    margin: 0 1rem;
}

.search-wrapper {
    position: relative;
}

.search-input {
    width: 300px;
    padding: 0.625rem 1rem;
    border: 2px solid #ddd;
    border-radius: 24px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color, #1565c0);
    width: 400px;
}

.search-results {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.search-result-item {
    display: block;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

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

.search-result-item:hover {
    background: #f8f9fa;
}

.search-result-item h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
    color: #333;
}

.search-result-item p {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.search-result-item mark {
    background: #fff59d;
    padding: 0 2px;
    border-radius: 2px;
}

.search-no-results {
    padding: 1.5rem;
    text-align: center;
    color: #666;
}

/* Dark mode search */
body.dark-mode .search-input {
    background: #2d2d2d;
    border-color: #4d4d4d;
    color: #e0e0e0;
}

body.dark-mode .search-results {
    background: #2d2d2d;
}

body.dark-mode .search-result-item {
    border-color: #4d4d4d;
}

body.dark-mode .search-result-item:hover {
    background: #3d3d3d;
}

body.dark-mode .search-result-item h4 {
    color: #e0e0e0;
}

/* ============================================================================
   RELATED ARTICLES
   ============================================================================ */
.related-articles {
    margin: 3rem 0;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.related-articles h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    color: #333;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.related-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.related-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.related-content {
    padding: 1rem;
}

.related-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color, #1565c0);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.related-content h4 {
    margin: 0.5rem 0;
    font-size: 1rem;
    line-height: 1.4;
    color: #333;
}

.related-content time {
    font-size: 0.85rem;
    color: #666;
}

/* Dark mode related */
body.dark-mode .related-articles {
    background: #2d2d2d;
}

body.dark-mode .related-articles h3 {
    color: #e0e0e0;
}

body.dark-mode .related-card {
    background: #1a1a1a;
}

body.dark-mode .related-content h4 {
    color: #e0e0e0;
}

/* ============================================================================
   READING PROGRESS BAR
   ============================================================================ */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color, #1565c0), #42a5f5);
    width: 0;
    z-index: 9998;
    transition: width 0.1s ease;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================================================
   RESPONSIVE MOBILE
   ============================================================================ */
@media (max-width: 768px) {
    .dark-mode-toggle {
        top: 10px;
        right: 10px;
        width: 44px;
        height: 44px;
    }

    .newsletter-modal {
        padding: 1.5rem;
    }

    .newsletter-form {
        flex-direction: column;
    }

    .trending-sidebar {
        max-width: 100%;
        position: relative;
        top: 0;
    }

    .search-input {
        width: 200px;
    }

    .search-input:focus {
        width: 250px;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */
@media print {
    .dark-mode-toggle,
    .newsletter-popup,
    .trending-sidebar,
    .search-container,
    .related-articles,
    .reading-progress-bar,
    .toast-notification {
        display: none !important;
    }
}
