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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8f9fa;
    color: #333;
    overflow: hidden;
    height: 100vh;
}

.app {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    color: #666;
}

.loading-spinner {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #333;
}

.loading-screen p {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Main Content */
.main-content {
    width: 100%;
    max-width: 900px;
    min-height: 600px;
    position: relative;
    background: white;
    border-radius: 20px;
    border: 2px solid #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #333;
    background: white;
    border-radius: 18px 18px 0 0;
}

.app-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    font-style: italic;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    padding: 0.5rem 2rem 0.5rem 0.8rem;
    border: 2px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
    width: 200px;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    width: 250px;
}

.clear-search {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.clear-search:hover {
    color: #666;
    background: #f0f0f0;
}

.clear-search.hidden {
    display: none;
}

.nav-counter {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

.dark-mode-toggle {
    background: none;
    border: 2px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #666;
}

.dark-mode-toggle:hover {
    border-color: #667eea;
    color: #667eea;
    transform: scale(1.1);
}

.settings-toggle {
    background: none;
    border: 2px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #666;
}

.settings-toggle:hover {
    border-color: #667eea;
    color: #667eea;
    transform: scale(1.1);
}

.settings-toggle.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.favorites-toggle {
    background: none;
    border: 2px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #666;
    position: relative;
}

.favorites-toggle:hover {
    border-color: #e74c3c;
    color: #e74c3c;
    transform: scale(1.1);
}

.favorites-toggle.active {
    background: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

.favorites-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    min-width: 20px;
}

.favorites-count:empty,
.favorites-count[data-count="0"] {
    display: none;
}

/* Category Filter */
.category-filter {
    padding: 0.5rem 1rem;
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    justify-content: center;
}

.category-btn {
    padding: 0.3rem 0.6rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 15px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    min-width: fit-content;
}

.category-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.category-btn.active {
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.category-count {
    background: rgba(255, 255, 255, 0.3);
    padding: 0.1rem 0.3rem;
    border-radius: 8px;
    font-size: 0.6rem;
    min-width: 18px;
    text-align: center;
}

/* News Container */
.news-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* News Card */
.news-card {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    transform: translateY(100%) scale(0.95);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    filter: blur(2px);
}

.news-card.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    filter: blur(0);
}

.news-card.prev {
    transform: translateY(-100%) scale(0.95);
    filter: blur(2px);
}

/* News Content Area */
.news-content-area {
    background: #f8f9fa;
    border: 2px solid #333;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    flex: 1;
    position: relative;
    border-left: 6px solid #333;
}

.news-content-area.category-colored {
    border-left-width: 6px;
}

/* News Header */
.news-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* Favorite Button */
.favorite-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    color: #ccc;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

.favorite-btn:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    transform: scale(1.1);
}

.favorite-btn.active {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.2);
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
}

.favorite-btn.active:hover {
    background: rgba(231, 76, 60, 0.3);
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.5);
}

.news-source {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
    text-align: center;
}

.news-title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.4;
    color: #333;
    text-align: center;
    margin-bottom: 1rem;
}

.news-summary {
    font-size: 1rem;
    line-height: 1.6;
    color: #555;
    text-align: center;
    margin-bottom: 1rem;
}

.news-category {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    justify-content: center;
}

/* Navigation Controls */
.nav-controls {
    position: absolute;
    right: -80px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.nav-arrows {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.arrow-label {
    font-size: 0.8rem;
    color: #666;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    max-width: 20px;
    text-align: center;
    line-height: 1.2;
}

.nav-arrow {
    width: 40px;
    height: 40px;
    border: 2px solid #333;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    color: #333;
}

.nav-arrow:hover {
    background: #333;
    color: white;
    transform: scale(1.1);
}

.nav-arrow:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-arrow:disabled:hover {
    background: white;
    color: #333;
    transform: none;
}

/* Read More Button */
.read-more-btn {
    background: #333;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    align-self: center;
}

.read-more-btn:hover {
    background: #555;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Refresh Button */
.refresh-btn {
    position: absolute;
    bottom: -20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #333;
    border: 2px solid #333;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
}

.refresh-btn:hover {
    background: white;
    color: #333;
    transform: scale(1.1);
}

.refresh-btn.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Search Results Highlight */
.search-highlight {
    background: #ffeb3b;
    color: #000;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.skeleton-title {
    height: 2rem;
    width: 80%;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.skeleton-text {
    height: 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.skeleton-text:last-child {
    width: 60%;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Favorites Panel */
.favorites-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorites-panel.open {
    opacity: 1;
    visibility: visible;
}

.favorites-modal {
    background: white;
    border: 2px solid #333;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.favorites-panel.open .favorites-modal {
    transform: scale(1);
}

.favorites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border-radius: 18px 18px 0 0;
}

.favorites-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.favorites-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.favorites-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.favorites-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    min-height: 200px;
}

.favorites-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.favorites-empty i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #ddd;
}

.favorites-empty p {
    font-size: 1.2rem;
    margin: 1rem 0 0.5rem 0;
    font-weight: 500;
}

.favorites-empty small {
    color: #999;
    line-height: 1.5;
}

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

.favorite-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.favorite-item:hover {
    border-color: #e74c3c;
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.favorite-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.favorite-summary {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.favorite-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: center;
}

.favorite-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.favorite-source {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.favorite-date {
    font-size: 0.7rem;
    color: #999;
}

.favorite-item-actions {
    display: flex;
    gap: 0.5rem;
}

.favorite-read-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.favorite-read-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.favorite-remove-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.favorite-remove-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-panel.open {
    opacity: 1;
    visibility: visible;
}

.settings-modal {
    background: white;
    border: 2px solid #333;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    transform: scale(0.8);
}

.settings-panel.open .settings-modal {
    transform: scale(1);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #333;
    background: white;
    border-radius: 18px 18px 0 0;
}

.settings-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.settings-close {
    background: none;
    border: 2px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.settings-close:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.settings-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    min-height: 0;
}

.settings-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #eee;
}

.save-settings-btn,
.reset-settings-btn {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid;
}

.save-settings-btn {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.save-settings-btn:hover {
    background: #5a6fd8;
    border-color: #5a6fd8;
    transform: translateY(-2px);
}

.reset-settings-btn {
    background: white;
    border-color: #e74c3c;
    color: #e74c3c;
}

.reset-settings-btn:hover {
    background: #e74c3c;
    color: white;
    transform: translateY(-2px);
}

.setting-group {
    margin-bottom: 2rem;
}

.setting-group label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.8rem;
}

.setting-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.font-size-btn,
.speed-btn,
.view-btn,
.theme-btn {
    padding: 0.7rem 1rem;
    border: 2px solid #ddd;
    background: white;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.font-size-btn:hover,
.speed-btn:hover,
.view-btn:hover,
.theme-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
}

.font-size-btn.active,
.speed-btn.active,
.view-btn.active,
.theme-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .nav-controls {
        right: -60px;
    }
    
    .category-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .app {
        padding: 1rem;
    }
    
    .main-content {
        max-width: 100%;
        height: 500px;
    }
    
    .header {
        padding: 1rem 1.5rem;
    }
    
    .app-title {
        font-size: 1.5rem;
    }
    
    .news-card {
        padding: 1.5rem;
    }
    
    .nav-controls {
        position: static;
        flex-direction: row;
        justify-content: center;
    padding: 1rem;
        gap: 1rem;
    }
    
    .arrow-label {
        writing-mode: horizontal-tb;
        text-orientation: mixed;
        max-width: none;
        font-size: 0.7rem;
    }
    
    .refresh-btn {
        bottom: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .main-content {
        height: 450px;
        border-radius: 15px;
    }
    
    .header {
        padding: 1rem;
        border-radius: 13px 13px 0 0;
    }
    
    .app-title {
        font-size: 1.3rem;
    }
    
    .news-card {
        padding: 1rem;
    }
    
    .news-content-area {
        padding: 1rem;
    }
    
    .news-title {
        font-size: 1.2rem;
    }
    
    .news-summary {
        font-size: 0.9rem;
    }
    
    .category-btn {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
        gap: 0.2rem;
    }
    
    .category-count {
        font-size: 0.5rem;
        padding: 0.05rem 0.2rem;
        min-width: 15px;
    }
    
    .nav-arrow {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
}

/* Mobile Settings Modal */
    .settings-modal {
        width: 95%;
        max-width: 95%;
        max-height: 85vh;
        border-radius: 15px;
    }
    
    .settings-panel.open .settings-modal {
        transform: scale(1);
    }
    
    .settings-header {
        padding: 1rem 1.5rem;
    }
    
    .favorites-modal {
        width: 95%;
        max-width: 95%;
        max-height: 85vh;
        border-radius: 15px;
    }
    
    .favorites-panel.open .favorites-modal {
        transform: scale(1);
    }
    
    .settings-content {
        padding: 1.5rem;
    }
    
    .font-size-btn,
    .speed-btn,
    .view-btn,
    .theme-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .save-settings-btn,
    .reset-settings-btn {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }
}