/* Reset & Base Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-dark: #3c366b;
    --secondary-color: #65676b;
    --accent-color: #31a24c;
    --danger-color: #e0245e;
    --warning-color: #f59e0b;
    --bg-color: #f5f7fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8ecf5;
    --text-color: #1a1a2e;
    --text-secondary: #616178;
    --border-color: rgba(79, 70, 229, 0.15);
    --card-bg: #ffffff;
    --card-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
    --card-hover-shadow: 0 8px 24px rgba(79, 70, 229, 0.15);
    --header-height: 60px;
    --sidebar-width: 240px;
    --container-width: 100%;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.2s ease-in-out;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}


/* Dark mode */

[data-theme="dark"] {
    --primary-color: #4f46e5;
    --primary-dark: #3c366b;
    --secondary-color: #65676b;
    --accent-color: #31a24c;
    --danger-color: #e0245e;
    --warning-color: #f59e0b;
    --bg-color: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-color: #ffffff;
    --text-secondary: #a0a6ac;
    --border-color: rgba(79, 70, 229, 0.15);
    --card-bg: #1a1a1a;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --card-hover-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}


/* Light mode for backward compatibility */

[data-theme="light"] {
    --primary-color: #4f46e5;
    --primary-dark: #3c366b;
    --secondary-color: #65676b;
    --accent-color: #31a24c;
    --danger-color: #e0245e;
    --warning-color: #f59e0b;
    --bg-color: #f5f7fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8ecf5;
    --text-color: #1a1a2e;
    --text-secondary: #616178;
    --border-color: rgba(79, 70, 229, 0.15);
    --card-bg: #ffffff;
    --card-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
    --card-hover-shadow: 0 8px 24px rgba(79, 70, 229, 0.15);
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: var(--container-width);
    padding: 0 15px;
    margin: 0 auto;
}


/* Typography */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    line-height: 1.3;
}


/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}


/* Content Wrapper - Sidebar + Main Layout */

.content-wrapper {
    display: flex;
    flex: 1;
    position: relative;
    margin-top: var(--header-height);
}


/* Sidebar Navigation */

.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    overflow-y: auto;
    z-index: 90;
    display: flex;
    flex-direction: column;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-item:hover {
    background-color: rgba(79, 70, 229, 0.15);
    color: var(--text-color);
}

.sidebar-item.active {
    background-color: rgba(79, 70, 229, 0.25);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--border-color);
    padding: 12px 0;
}

/* Sidebar Language Selector */
.sidebar-language-selector {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-section-header i {
    font-size: 16px;
    width: 24px;
    text-align: center;
}

.sidebar-select {
    width: 100%;
    padding: 10px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-color);
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-select:hover {
    border-color: var(--primary-color);
}

.sidebar-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}


/* Sidebar Overlay (Mobile) */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 85;
}

.sidebar-overlay.show {
    display: block;
}


/* Main Content Area */

.main {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 40px 20px;
    background-color: var(--bg-color);
}

.main-inner {
    max-width: 1200px;
    margin: 0 auto;
}


/* Header */

.header {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    z-index: 100;
    box-shadow: var(--card-shadow);
}

.header-content {
    width: 100%;
    height: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}


/* Header Zones */

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: max-content;
}

.header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 600px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: max-content;
}


/* Logo */

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.logo i {
    font-size: 24px;
    color: var(--primary-color);
}

.logo span {
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
}

.logo-image {
    height: 40px;
    width: auto;
    object-fit: contain;
    border-radius: 6px;
    transition: transform 0.2s ease;
}

.logo-image:hover {
    transform: scale(1.05);
}


/* Hamburger Menu */

.hamburger-menu {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-color);
    cursor: pointer;
    padding: 6px;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
}

.hamburger-menu:hover {
    background-color: rgba(79, 70, 229, 0.15);
    border-radius: 8px;
}


/* Search Box in Header */

.search-box {
    flex: 1;
    max-width: 500px;
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border-radius: 24px;
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.search-box:focus-within {
    background-color: var(--card-bg);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    padding-left: 24px;
    padding-right: 24px;
}

.search-box i {
    margin-right: 10px;
    color: var(--text-secondary);
    font-size: 16px;
}

#search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

#search-input::placeholder {
    color: var(--text-secondary);
}


/* Icon Buttons */

.icon-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: var(--transition);
}

.icon-btn:hover {
    background-color: rgba(79, 70, 229, 0.15);
    color: var(--primary-color);
}

/* Header Theme Toggle - Optimized for Mobile */
.theme-toggle {
    background: none;
    border: none;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-color);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    background-color: rgba(79, 70, 229, 0.15);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.theme-toggle i {
    transition: var(--transition-smooth);
    position: absolute;
    transform: translateX(0);
}

.theme-toggle .fa-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.theme-toggle .fa-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-toggle .fa-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-toggle .fa-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

/* Remove old notification button styles */
#notifications-btn {
    display: none !important;
}

/* Optimize header right section spacing */
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
}

/* Mobile responsive header improvements */
@media (max-width: 576px) {
    .header-right {
        gap: 4px;
    }
    
    .theme-toggle {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 17px;
    }
}

@media (max-width: 375px) {
    .header-content {
        padding: 0 8px;
        padding-right: env(safe-area-inset-right, 8px);
    }
    
    .header-right {
        gap: 4px;
        padding-right: 4px;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 16px;
        margin-right: 2px;
        flex-shrink: 0;
    }
}

/* Smooth theme transition for all elements */
* {
    transition: background-color 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                color 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.search-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    transition: var(--transition);
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.search-btn-icon:hover {
    background-color: rgba(79, 70, 229, 0.15);
    color: var(--primary-color);
}


/* Weather Bar Section */

.weather-bar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 95;
    padding: 8px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    will-change: transform, opacity;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                opacity 0.25s ease-out;
}

.weather-bar.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.weather-bar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.weather-icon {
    font-size: 28px;
    color: var(--primary-color);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.weather-temp {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.weather-temp span:first-child {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    font-family: 'Poppins', sans-serif;
}

.weather-unit {
    font-size: 14px;
    color: var(--text-secondary);
}

.weather-condition {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.weather-details {
    display: flex;
    align-items: center;
    gap: 20px;
}

.weather-detail-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.weather-detail-item i {
    color: var(--primary-color);
    font-size: 12px;
}

.weather-refresh-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    font-size: 16px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.weather-refresh-btn:hover {
    color: var(--primary-color);
}

.weather-refresh-btn.spinning i {
    animation: fa-spin 1s ease-in-out infinite;
}


/* Night mode for weather icon */

[data-theme="dark"] .weather-icon {
    color: #fbbf24;
}


/* Responsive weather bar */

@media (max-width: 768px) {
    .weather-bar-content {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        padding: 8px 15px;
    }
    .weather-main {
        order: 1;
        width: 100%;
        justify-content: center;
    }
    .weather-details {
        order: 2;
        gap: 12px;
    }
    .weather-refresh {
        order: 3;
    }
    .weather-temp span:first-child {
        font-size: 20px;
    }
    .weather-icon {
        font-size: 24px;
    }
    .weather-detail-item {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .weather-details {
        gap: 8px;
    }
    .weather-detail-item span {
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
}

.logo i {
    color: var(--primary-color);
    font-size: 28px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
}

.logo span {
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    background-color: var(--bg-secondary);
}

.nav-toggle {
    display: none;
    font-size: 24px;
    cursor: pointer;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.theme-toggle:hover {
    background-color: var(--bg-secondary);
}

.language-selector select {
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    cursor: pointer;
}


/* Search Section */


/* Advanced Filters */

.advanced-filters-wrapper {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 95;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.advanced-filters-wrapper.show {
    max-height: 500px;
}

.advanced-filters {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.filter-group input,
.filter-group select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background-color: var(--bg-secondary);
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    transition: var(--transition);
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.filter-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}


/* Featured Article Section */

.featured-article {
    margin-bottom: 40px;
    animation: fadeIn 0.5s ease;
}

.featured-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    height: 400px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transition: var(--transition-smooth);
}

.featured-container:hover {
    box-shadow: 0 15px 40px rgba(79, 70, 229, 0.3);
}

.featured-image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
}

.featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.featured-container:hover .featured-image {
    transform: scale(1.03);
}

.featured-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
}

.featured-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    color: white;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.featured-category {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    width: fit-content;
}

.featured-title {
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-description {
    font-size: 16px;
    line-height: 1.5;
    opacity: 0.95;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.featured-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    opacity: 0.85;
}

.featured-source,
.featured-date {
    display: flex;
    align-items: center;
    gap: 6px;
}


/* Main Content */

.main {
    padding: 40px 0;
}


/* Loading & Error States */

.loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.loading p {
    color: var(--text-secondary);
    font-size: 18px;
}

.error-container {
    text-align: center;
    padding: 60px 20px;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin: 20px 0;
}

.error-icon {
    font-size: 64px;
    color: var(--danger-color);
    margin-bottom: 20px;
}

.error-container h3 {
    margin-bottom: 15px;
    color: var(--text-color);
}

#error-message {
    color: var(--text-secondary);
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}


/* Stats Bar */

.stats-bar {
    display: flex;
    justify-content: space-between;
    background-color: var(--bg-secondary);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.stats-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.stats-item i {
    color: var(--primary-color);
}

.stats-item span {
    color: var(--text-color);
    font-weight: 500;
}


/* News Grid */

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
    animation: fadeIn 0.5s ease;
}

.news-card {
    position: relative;
    overflow: hidden;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
    border-color: rgba(79, 70, 229, 0.3);
}

.news-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: var(--bg-secondary);
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.news-card:hover .news-image img {
    transform: scale(1.05);
}

.no-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), rgba(79, 70, 229, 0.6));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.no-image i {
    font-size: 48px;
}

.news-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.news-title {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    color: var(--text-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-description {
    font-size: 13px;
    margin: 0;
    opacity: 0.8;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.news-meta {
    font-size: 12px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--text-secondary);
    align-items: center;
}

.news-source {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.news-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.news-category {
    background-color: rgba(79, 70, 229, 0.2);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: auto;
}

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


/* Pagination */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin: 40px 0;
}

.page-info {
    font-weight: 500;
    color: var(--text-color);
}


/* Historical Section */

.historical-section {
    background-color: var(--bg-secondary);
    padding: 30px;
    border-radius: var(--border-radius);
    margin-top: 50px;
}

.historical-section h2 {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.historical-section p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.historical-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.historical-dates {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.date-group {
    flex: 1;
    min-width: 200px;
}

.date-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
}

#historical-search {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    background-color: var(--bg-color);
    color: var(--text-color);
}


/* Footer */

.footer {
    position: relative;
    background-color: var(--bg-secondary);
    padding: 20px 15px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

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

.disclaimer {
    font-size: 12px;
    margin-top: 10px;
    opacity: 0.7;
}


/* Modal */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    overflow-y: auto;
    padding: 20px;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 24px;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background-color: var(--bg-secondary);
    color: var(--text-color);
}

.modal-body {
    padding: 30px;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
    color: var(--text-secondary);
    font-size: 14px;
}

.modal-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-image-container {
    margin-bottom: 25px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.modal-image-container img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

.modal-description {
    margin-bottom: 30px;
}

.modal-description p {
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-color);
}

.modal-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.api-key-form {
    max-width: 500px;
    margin: 0 auto;
}

.api-key-form p {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.api-key-form a {
    color: var(--primary-color);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

#api-key-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.form-group label[for="save-key"] {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}


/* Toast Notifications */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.toast {
    padding: 15px 20px;
    border-radius: var(--border-radius-sm);
    background-color: var(--bg-color);
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.toast.success {
    border-left-color: var(--accent-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast-icon {
    font-size: 20px;
}

.toast.success .toast-icon {
    color: var(--accent-color);
}

.toast.error .toast-icon {
    color: var(--danger-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast-message {
    flex-grow: 1;
    font-size: 14px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
}

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


/* Responsive Design */


/* Tablet (768px - 1024px) */

@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    .main {
        margin-left: 200px;
        padding: 30px 16px;
    }
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .featured-article {
        margin-bottom: 30px;
    }
    .featured-container {
        height: 350px;
    }
    .featured-title {
        font-size: 24px;
    }
    .featured-description {
        font-size: 14px;
    }
}


/* Mobile (<768px) */

@media (max-width: 768px) {
     :root {
        --sidebar-width: 0;
        --mobile-search-height: 50px;
    }
    /* Show hamburger menu */
    .hamburger-menu {
        display: flex;
    }
    /* Hide sidebar by default, show as overlay when needed */
    .sidebar {
        position: fixed;
        left: 0;
        top: var(--header-height);
        width: 240px;
        height: calc(100vh - var(--header-height));
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 90;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .sidebar-overlay.show {
        display: block;
    }
    /* Adjust main content */
    .main {
        margin-left: 0;
        padding: 24px 16px;
    }
    /* Single column grid */
    .news-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    /* Featured article adjustments */
    .featured-container {
        height: 300px;
        border-radius: 8px;
    }
    .featured-content {
        padding: 20px;
    }
    .featured-title {
        font-size: 20px;
    }
    .featured-description {
        font-size: 13px;
    }
    .featured-meta {
        gap: 12px;
        font-size: 12px;
    }
    /* Adjust header - show search in header on mobile */
    .header-center {
        display: flex;
        position: static;
        max-width: none;
    }
    .header-left {
        flex: 0 0 auto;
        min-width: auto;
    }
    .header-right {
        order: 2;
        min-width: auto;
    }
    .search-box {
        position: static;
        width: auto;
        max-width: none;
        border-radius: 24px;
        border: 1px solid var(--border-color);
        background-color: var(--bg-secondary);
        padding: 8px 12px;
        flex: 1;
    }
    .search-box:focus-within {
        padding-left: 12px;
        padding-right: 12px;
    }
    .main {
        margin-top: var(--header-height);
    }
    /* Weather bar - position below header on mobile */
    .weather-bar {
        top: var(--header-height);
    }
    /* Advanced filters */
    .advanced-filters-wrapper {
        top: calc(var(--header-height) + 45px);
    }
    /* Filter adjustments */
    .filter-row {
        grid-template-columns: 1fr;
    }
    .filter-actions {
        flex-direction: column;
    }
    .filter-actions .btn {
        width: 100%;
    }
    /* Pagination adjustments */
    .pagination {
        flex-direction: column;
        gap: 12px;
        margin: 30px 0;
    }
    .pagination .btn {
        width: 100%;
    }
    /* Historical section */
    .historical-section {
        padding: 20px;
        margin-top: 30px;
    }
    .historical-form {
        gap: 12px;
    }
    .historical-dates {
        flex-direction: column;
    }
    .date-group {
        min-width: 100%;
    }
    /* Modal adjustments */
    .modal {
        padding: 10px;
    }
    .modal-content {
        margin: 0;
        max-height: calc(100vh - 20px);
        border-radius: 8px;
    }
    .modal-header {
        padding: 15px 20px;
    }
    .modal-body {
        padding: 20px;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }
    .modal-actions {
        flex-direction: column;
    }
    .modal-actions .btn {
        width: 100%;
    }
    /* News card adjustments */
    .news-image {
        height: 180px;
    }
    .news-content {
        padding: 12px;
        gap: 6px;
    }
    .news-title {
        font-size: 15px;
    }
    .news-description {
        font-size: 13px;
    }
    .news-meta {
        gap: 8px;
        font-size: 11px;
    }
    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    /* Footer */
    .footer {
        padding: 15px 16px;
        font-size: 11px;
    }
}


/* Small Mobile (<576px) */

@media (max-width: 576px) {
    .header-content {
        padding: 0 12px;
        gap: 12px;
    }
    .logo span {
        font-size: 16px;
    }
    .header-right {
        gap: 8px;
    }
    .icon-btn,
    .search-btn-icon,
    .theme-toggle {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    .main {
        padding: 16px 12px;
    }
    .main-inner {
        max-width: 100%;
    }
    .featured-container {
        height: 250px;
        border-radius: 8px;
    }
    .featured-content {
        padding: 16px;
    }
    .featured-title {
        font-size: 18px;
    }
    .featured-description {
        display: none;
    }
    .featured-image {
        height: 100%;
    }
    .news-card {
        border: 1px solid var(--border-color);
    }
    .news-image {
        height: 160px;
    }
    .news-title {
        font-size: 14px;
    }
    .news-meta {
        flex-direction: column;
        gap: 4px;
    }
    .news-category {
        align-self: flex-start;
        margin-left: 0;
    }
    /* Historical section */
    .historical-section {
        padding: 16px;
        margin-top: 20px;
    }
    .historical-section h2 {
        font-size: 18px;
    }
    #historical-search {
        padding: 10px 12px;
        font-size: 14px;
    }
    /* Download progress */
    #download-progress-container {
        padding: 12px 16px;
    }
    /* API modal adjustments */
    .api-key-form {
        max-width: 100%;
    }
    .steps {
        padding: 12px;
    }
    .steps h3 {
        font-size: 14px;
    }
    .steps ol {
        margin-left: 16px;
        font-size: 13px;
    }
}


/* Extra Small (<360px) */

@media (max-width: 360px) {
    .logo {
        gap: 6px;
    }
    .logo i {
        font-size: 18px;
    }
    .logo span {
        font-size: 14px;
        font-weight: 600;
    }
    .header-right {
        gap: 4px;
    }
    .main {
        padding: 12px;
    }
    .featured-container {
        height: 200px;
    }
    .featured-title {
        font-size: 16px;
    }
    .pagination {
        gap: 8px;
    }
    .historical-section {
        padding: 12px;
    }
}


/* Add to existing modal styles */

.steps {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
}

.steps h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

.steps ol {
    margin-left: 20px;
    color: var(--text-secondary);
}

.steps li {
    margin-bottom: 8px;
}

.privacy-note {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
}

.privacy-note i {
    color: var(--accent-color);
}


/* Online/Offline Status Indicator */

.online-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.online-status.online {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.online-status.offline {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}


/* Install App Button */

.install-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

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


/* Scroll to Top Button */

.scroll-top-btn {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 45px;
    height: 45px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 900;
}

.scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
}


/* Offline Article Badge */

.offline-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    z-index: 1;
}


/* Cache Status */

.cache-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
}

.cache-status i {
    color: var(--accent-color);
}


/* Add these styles to your existing styles.css */


/* Connection Status */

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 10px;
    transition: var(--transition);
}

.connection-status.online {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.connection-status.offline {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.connection-status .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.connection-status.online .status-dot {
    background-color: var(--accent-color);
    animation: pulse 2s infinite;
}

.connection-status.offline .status-dot {
    background-color: var(--danger-color);
}

.offline-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(239, 68, 68, 0.3);
}


/* Storage Status */

.storage-status {
    margin-top: 15px;
}

.storage-progress {
    height: 8px;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.storage-bar {
    height: 100%;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.storage-text {
    font-size: 12px;
    color: var(--text-secondary);
}


/* Offline Badge in Cards */

.offline-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, var(--accent-color), #059669);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}


/* Offline Library Modal */

.library-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.library-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.library-search {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

#library-search {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
}

.library-articles {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}


/* Offline Library Card */

.offline-library-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius-sm);
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.offline-library-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.offline-library-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.offline-library-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    flex: 1;
    margin-right: 10px;
}

.offline-library-card-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: var(--bg-secondary);
    color: var(--text-color);
}

.offline-library-card-body {
    font-size: 14px;
}

.offline-library-card-description {
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.5;
}

.offline-library-card-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-secondary);
}

.offline-library-card-date,
.offline-library-card-read {
    display: flex;
    align-items: center;
    gap: 4px;
}

.offline-library-card-read {
    color: var(--accent-color);
}

.offline-library-card-category {
    background-color: var(--bg-secondary);
    color: var(--text-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}


/* Reading Progress in Modal */

.reading-progress {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.progress-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--text-color);
}

.progress-bar {
    height: 6px;
    background-color: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    display: block;
}


/* Offline Mode Styles */

.offline-mode .news-card {
    border: 2px solid rgba(16, 185, 129, 0.2);
}

.offline-mode .search-box {
    background-color: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.offline-mode .stats-bar {
    background-color: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
}


/* Update Toast for Updates */

.update-toast {
    border-left-color: var(--warning-color);
    align-items: center;
}

.update-toast .toast-message {
    flex: 1;
}

.update-toast .toast-message strong {
    display: block;
    margin-bottom: 4px;
}

.update-toast .toast-message p {
    font-size: 13px;
    margin: 0;
    color: var(--text-secondary);
}

.toast-action {
    padding: 6px 12px !important;
    font-size: 13px !important;
    margin-left: 10px;
}


/* Active button states */

#offline-search-toggle.active {
    background-color: var(--accent-color);
    color: white;
}

#offline-search-toggle.active:hover {
    background-color: #059669;
}


/* Responsive adjustments for offline features */

@media (max-width: 768px) {
    .connection-status {
        display: none;
    }
    .library-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .library-controls {
        flex-direction: column;
    }
    .library-controls .btn {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .library-stats {
        grid-template-columns: 1fr;
    }
    .offline-library-card-header {
        flex-direction: column;
        gap: 10px;
    }
    .offline-library-card-actions {
        align-self: flex-end;
    }
}


/* PWA Metrics Panel */

.pwa-metrics-panel {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--card-hover-shadow);
    z-index: 2500;
    max-width: 350px;
    animation: slideInRight 0.3s ease;
    border: 1px solid var(--border-color);
}

.metrics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.metrics-header h3 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.metrics-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.metrics-close:hover {
    opacity: 1;
}

.metrics-content {
    padding: 15px 20px;
    max-height: 300px;
    overflow-y: auto;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

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

.metric-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-value {
    color: var(--text-color);
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.metric-value.online {
    color: var(--accent-color);
}

.metric-value.offline {
    color: var(--danger-color);
}

@media (max-width: 768px) {
    .pwa-metrics-panel {
        max-width: 280px;
        bottom: 80px;
        right: 10px;
    }
}


/* Download Progress Container */

#download-progress-container {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 15px 20px;
    margin: 20px 0;
    box-shadow: var(--card-shadow);
}

.progress-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: var(--text-color);
}

.progress-text {
    color: var(--text-secondary);
    font-size: 14px;
}

.progress-count {
    font-weight: 600;
    color: var(--primary-color);
}

.progress-bar {
    height: 8px;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
    transition: width 0.3s ease, background-color 0.3s ease;
    width: 0%;
}

.progress-bar-fill.success {
    background-color: var(--accent-color);
}

.progress-bar-fill.warning {
    background-color: var(--warning-color);
}

.progress-bar-fill.error {
    background-color: var(--danger-color);
}

@media (max-width: 768px) {
    #download-progress-container {
        margin: 15px 0;
        padding: 12px 15px;
    }
    .progress-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    .progress-count {
        align-self: flex-end;
    }
}


/* ===== MOBILE HEADER FIXES ===== */


/* Header layout for tablets and smaller screens */

@media (max-width: 992px) {
    .header .container {
        padding: 10px 12px;
        gap: 10px;
    }
    .logo {
        gap: 8px;
    }
    .logo h1 {
        font-size: 20px;
    }
    .logo i {
        font-size: 24px;
    }
    .nav-menu {
        gap: 10px;
    }
    .nav-link {
        padding: 6px 10px;
        font-size: 13px;
    }
    .nav-link i {
        display: none;
    }
    .header-controls {
        gap: 8px;
    }
    .language-selector select {
        padding: 6px 8px;
        font-size: 12px;
    }
    #download-offline-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    #download-offline-btn i {
        display: none;
    }
}


/* Header layout for mobile phones */

@media (max-width: 768px) {
    .header {
        padding: 0;
    }
    .header .container {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 10px;
        padding: 12px;
    }
    .logo {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
    }
    .logo h1 {
        font-size: 18px;
    }
    .logo i {
        font-size: 22px;
    }
    .connection-status {
        display: none;
    }
    .nav {
        grid-column: 1 / -1;
        grid-row: 2;
        order: 3;
        width: 100%;
    }
    .nav-toggle {
        display: block;
        padding: 8px 12px;
        background: var(--bg-secondary);
        border-radius: var(--border-radius-sm);
        color: var(--text-color);
    }
    .nav-menu {
        position: fixed;
        top: calc(var(--header-height) + 5px);
        left: 10px;
        right: 10px;
        background-color: var(--bg-color);
        flex-direction: column;
        padding: 15px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        border-radius: var(--border-radius);
        display: none;
        z-index: 9999;
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }
    .nav-menu.show {
        display: flex;
        animation: slideDown 0.2s ease;
    }
    .nav-link {
        padding: 12px 15px;
        font-size: 15px;
        border-radius: var(--border-radius-sm);
    }
    .nav-link i {
        display: inline-flex;
        width: 24px;
    }
    .header-controls {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        gap: 6px;
    }
    .offline-indicator {
        display: none !important;
    }
    .theme-toggle {
        padding: 6px;
        font-size: 18px;
    }
    .language-selector select {
        padding: 6px 8px;
        font-size: 12px;
        max-width: 80px;
    }
    #download-offline-btn {
        padding: 8px 10px;
        font-size: 11px;
        white-space: nowrap;
    }
    #download-offline-btn i {
        display: none;
    }
}


/* Header layout for very small screens */

@media (max-width: 480px) {
    .header .container {
        padding: 10px;
    }
    .logo h1 {
        font-size: 16px;
    }
    .logo span {
        font-size: 14px;
    }
    .header-controls {
        gap: 4px;
    }
    .theme-toggle {
        padding: 5px;
        font-size: 16px;
    }
    .language-selector {
        display: none;
    }
    #download-offline-btn {
        padding: 8px 8px;
        font-size: 10px;
    }
}


/* Ensure nav menu appears above other content */

.nav-menu.show {
    z-index: 9999;
    border: 1px solid var(--border-color);
}


/* Floating Bottom Navigation */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    z-index: 1000;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.12);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.bottom-nav::-webkit-scrollbar {
    display: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    width: 60px;
    height: 60px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 11px;
    gap: 2px;
    cursor: pointer;
    border: none;
    background: none;
}

.nav-item i {
    font-size: 20px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-color);
}

.nav-menu-more {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.nav-menu-more a,
.nav-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    width: 50px;
    height: 60px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 10px;
    gap: 2px;
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

.nav-menu-more a i {
    font-size: 16px;
}

.nav-menu-more a:hover {
    color: var(--primary-color);
}

.nav-select {
    width: auto;
    padding: 0 8px;
    color: var(--text-color);
}


/* Hide old navigation elements */

.stats-bar,
.nav-toggle,
.header-controls,
.connection-status,
.logo,
.nav {
    display: none !important;
}

body {
    padding-bottom: 60px;
}

main {
    padding-top: 0;
}

.container {
    width: 100%;
    max-width: var(--container-width);
    padding: 0;
    margin: 0 auto;
}


/* Responsive media queries */

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

@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: 1fr;
        margin-bottom: 80px;
    }
    .app-title {
        font-size: 18px;
    }
    .nav-item span {
        display: none;
    }
    .nav-item {
        width: 50px;
        min-width: 50px;
    }
    .nav-item i {
        font-size: 24px;
    }
}


/* ==================== VIDEO SECTION STYLING ==================== */

.api-key-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 100%;
}

.banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.banner-message {
    display: flex;
    gap: 15px;
    align-items: center;
    flex: 1;
}

.banner-message i {
    font-size: 2rem;
}

.banner-message h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
}

.banner-message p {
    margin: 0;
    opacity: 0.95;
    font-size: 14px;
}

.banner-input {
    display: flex;
    gap: 10px;
    min-width: 350px;
}

.banner-input input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-family: var(--font-family);
}

.banner-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.banner-close:hover {
    opacity: 1;
}


/* Video Section */

.video-section {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.video-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    max-height: 300px;
    overflow-y: auto;
}

.video-search-wrapper {
    margin-bottom: 15px;
}

.video-search-bar {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 15px;
    gap: 10px;
}

.video-search-bar i {
    color: var(--text-color-secondary);
}

.video-search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-color);
    font-family: var(--font-family);
}

.video-search-bar input::placeholder {
    color: var(--text-color-secondary);
}

.search-clear-btn {
    background: none;
    border: none;
    color: var(--text-color-secondary);
    cursor: pointer;
    padding: 0;
    font-size: 16px;
}


/* Trending Carousel */

.trending-carousel {
    margin-top: 15px;
}

.trending-carousel h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: var(--text-color);
}

.carousel-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0;
    scroll-behavior: smooth;
}

.carousel-scroll::-webkit-scrollbar {
    height: 6px;
}

.carousel-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.carousel-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.carousel-poster {
    flex: 0 0 100px;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
    position: relative;
}

.carousel-poster:hover {
    transform: scale(1.05);
}

.carousel-poster img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.carousel-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    padding: 8px 5px 5px;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Video Feed */

.video-feed {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scroll-behavior: smooth;
    transition: opacity 0.3s ease-in-out;
}

.video-feed::-webkit-scrollbar {
    width: 8px;
}

.video-feed::-webkit-scrollbar-track {
    background: transparent;
}

.video-feed::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.video-card {
    height: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    scroll-snap-align: start;
}

.video-card-wrapper {
    width: 100%;
    max-width: 600px;
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    height: 85vh;
    position: relative;
}

.video-player {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
}

.video-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s;
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    opacity: 0;
    transition: opacity 0.3s;
}

.video-card:hover .play-button {
    opacity: 1;
}

.video-info {
    padding: 20px;
    overflow-y: auto;
    flex: 0 0 auto;
    max-height: 30%;
}

.video-info::-webkit-scrollbar {
    width: 4px;
}

.video-info::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

.video-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    word-wrap: break-word;
}

.video-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 14px;
}

.video-type {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.video-rating {
    color: var(--text-color-secondary);
    font-weight: 500;
}

.video-plot {
    margin: 0;
    font-size: 14px;
    color: var(--text-color-secondary);
    line-height: 1.5;
    word-wrap: break-word;
}


/* Bookmark Button */

.bookmark-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    color: var(--primary-color);
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.bookmark-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.bookmark-btn.bookmarked i {
    color: var(--danger-color);
}


/* Video Loading & No Results */

.video-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: var(--text-color-secondary);
}

.video-loading .spinner i {
    font-size: 48px;
    animation: spin 1s linear infinite;
}

.video-no-results {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: var(--text-color-secondary);
    text-align: center;
    padding: 40px 20px;
}

.video-no-results i {
    font-size: 64px;
    opacity: 0.5;
}

#no-results-message {
    font-size: 16px;
    max-width: 300px;
}


/* Responsive Design */

@media (max-width: 768px) {
    .banner-content {
        flex-direction: column;
        align-items: flex-start;
    }
    .banner-input {
        width: 100%;
        min-width: auto;
        flex-direction: column;
    }
    .video-card-wrapper {
        max-width: 100%;
        height: auto;
        min-height: auto;
    }
    .video-info {
        max-height: auto;
    }
    .video-title {
        font-size: 18px;
    }
    .carousel-poster {
        flex: 0 0 80px;
    }
    .carousel-poster img {
        height: 120px;
    }
    .carousel-title {
        font-size: 10px;
    }
}


/* Ensure nav menu appears above other content */