/* Animated Starfield - Enhanced visibility */
.starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
    animation: twinkle 3s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

/* Shooting Stars */
.shooting-star {
    position: fixed;
    width: 3px;
    height: 3px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 15px 3px rgba(255, 255, 255, 0.9);
    animation: shoot 2s linear;
    pointer-events: none;
    z-index: 2;
}

@keyframes shoot {
    0% {
        transform: translateX(0) translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateX(300px) translateY(300px);
        opacity: 0;
    }
}

/* Top Controls Bar - Horizontal Layout */
.top-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 15px;
    z-index: 10000;
    align-items: center;
}

.theme-toggle,
.bookmarks-toggle {
    position: relative;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
    border: 2px solid rgba(135, 206, 250, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5em;
    box-shadow: 0 5px 20px rgba(135, 206, 250, 0.4);
    transition: all 0.3s;
}

.bookmarks-toggle {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.9), rgba(255, 165, 0, 0.9));
    border: 2px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.theme-toggle:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 8px 30px rgba(135, 206, 250, 0.6);
}

.bookmarks-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.6);
}

.bookmark-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    font-weight: bold;
}

/* Remove Sound Toggle */
.sound-toggle {
    display: none !important;
}

/* Search Bar */
.search-container {
    margin: 15px 0;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 20px;
    background: rgba(28, 36, 71, 0.8);
    border: 2px solid rgba(135, 206, 250, 0.3);
    border-radius: 25px;
    color: #a8dadc;
    font-size: 1em;
    outline: none;
    transition: all 0.3s;
}

.search-input:focus {
    border-color: rgba(135, 206, 250, 0.6);
    box-shadow: 0 0 20px rgba(135, 206, 250, 0.3);
}

.search-input::placeholder {
    color: #6c7b8a;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    color: #87ceeb;
    pointer-events: none;
}

/* Bookmark Button */
.bookmark-btn {
    background: none;
    border: none;
    color: #6c7b8a;
    cursor: pointer;
    font-size: 1.2em;
    padding: 0 8px;
    transition: all 0.3s;
    margin-left: 8px;
}

.bookmark-btn:hover {
    color: #87ceeb;
    transform: scale(1.2);
}

.bookmark-btn.bookmarked {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

/* Share Buttons */
.share-btns {
    display: inline-flex;
    gap: 8px;
    margin-left: 8px;
}

.share-btn {
    background: rgba(102, 126, 234, 0.3);
    border: 1px solid rgba(135, 206, 250, 0.3);
    color: #87ceeb;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s;
}

.share-btn:hover {
    background: rgba(102, 126, 234, 0.6);
    border-color: rgba(135, 206, 250, 0.6);
    transform: translateY(-2px);
}

/* Reading Time Badge */
.reading-time {
    display: inline-block;
    background: rgba(135, 206, 250, 0.2);
    color: #87ceeb;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    margin-left: 8px;
    border: 1px solid rgba(135, 206, 250, 0.3);
}

/* Category Badge Animations */
.badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 5px rgba(135, 206, 250, 0.5); }
    50% { box-shadow: 0 0 15px rgba(135, 206, 250, 0.8); }
}

/* Article Preview Tooltip */
.article-preview {
    position: absolute;
    background: linear-gradient(135deg, rgba(28, 36, 71, 0.98), rgba(10, 18, 40, 0.98));
    border: 2px solid rgba(135, 206, 250, 0.4);
    border-radius: 10px;
    padding: 15px;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 5000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.article-preview.visible {
    opacity: 1;
}

.article-preview-title {
    color: #87ceeb;
    font-weight: bold;
    margin-bottom: 8px;
}

.article-preview-text {
    color: #a8dadc;
    font-size: 0.9em;
    line-height: 1.5;
}

/* Bookmarks Panel */
.bookmarks-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: linear-gradient(135deg, rgba(28, 36, 71, 0.98), rgba(10, 18, 40, 0.98));
    border-left: 2px solid rgba(135, 206, 250, 0.3);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 10001;
    transition: right 0.3s;
    overflow-y: auto;
    padding: 20px;
}

.bookmarks-panel.open {
    right: 0;
}

.bookmarks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(135, 206, 250, 0.3);
}

.bookmarks-title {
    color: #87ceeb;
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(135, 206, 250, 0.6);
}

.close-bookmarks {
    background: none;
    border: none;
    color: #87ceeb;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px 10px;
    transition: all 0.3s;
}

.close-bookmarks:hover {
    transform: rotate(90deg);
    color: #ff6b6b;
}

.bookmark-item {
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(135, 206, 250, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.bookmark-item:hover {
    background: rgba(102, 126, 234, 0.3);
    transform: translateX(-5px);
}

.bookmark-item a {
    color: #a8dadc;
    text-decoration: none;
    display: block;
    margin-bottom: 5px;
}

.bookmark-item a:hover {
    color: #87ceeb;
}

/* Light Mode Theme - Space-themed */
body.light-mode {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #2d5a7b 100%);
    background-image: 
        radial-gradient(ellipse at top, #3b82f6 0%, transparent 50%),
        radial-gradient(ellipse at bottom, #1e40af 0%, transparent 50%),
        linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #2d5a7b 100%);
}

body.light-mode .starfield {
    opacity: 0.7;
}

body.light-mode header {
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.95), rgba(15, 23, 42, 0.95));
    border: 2px solid rgba(96, 165, 250, 0.3);
    box-shadow: 0 10px 40px rgba(59, 130, 246, 0.3);
}

body.light-mode h1 {
    color: #93c5fd;
    text-shadow: 0 0 20px rgba(96, 165, 250, 0.6);
}

body.light-mode .status-info {
    color: #93c5fd;
}

body.light-mode .tab {
    background: rgba(30, 58, 95, 0.7);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

body.light-mode .tab:hover {
    background: rgba(30, 58, 95, 0.9);
    border-color: rgba(96, 165, 250, 0.5);
}

body.light-mode .tab.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.6);
}

body.light-mode .nav-index {
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.95), rgba(15, 23, 42, 0.95));
    border: 2px solid rgba(96, 165, 250, 0.3);
}

body.light-mode .nav-index-title {
    color: #60a5fa;
}

body.light-mode .nav-index a {
    color: #93c5fd;
}

body.light-mode .nav-index a:hover {
    background: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

body.light-mode .source-group,
body.light-mode .topic-section {
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.8), rgba(15, 23, 42, 0.8));
    border: 1px solid rgba(96, 165, 250, 0.2);
}

body.light-mode .source-name,
body.light-mode .topic-title {
    color: #60a5fa;
    border-bottom: 2px solid rgba(96, 165, 250, 0.3);
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
}

body.light-mode .article {
    border-bottom: 1px solid rgba(96, 165, 250, 0.2);
}

body.light-mode .article-title a {
    color: #93c5fd;
}

body.light-mode .article-title a:hover {
    color: #60a5fa;
}

body.light-mode .article-meta {
    color: #64748b;
}

body.light-mode .loading {
    color: #60a5fa;
}

body.light-mode .search-input {
    background: rgba(30, 58, 95, 0.8);
    border: 2px solid rgba(96, 165, 250, 0.3);
    color: #93c5fd;
}

body.light-mode .search-input::placeholder {
    color: #64748b;
}

body.light-mode .progress-bar {
    background: linear-gradient(90deg, #3b82f6, #60a5fa, #2563eb);
}

/* Update bookmarks-toggle to work as history-toggle */
.bookmarks-toggle {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.9), rgba(109, 40, 217, 0.9)) !important;
    border: 2px solid rgba(167, 139, 250, 0.4) !important;
    box-shadow: 0 5px 20px rgba(139, 92, 246, 0.4) !important;
}

.bookmarks-toggle:hover {
    transform: scale(1.1) rotate(-15deg) !important;
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.6) !important;
}

/* History panel styles (reuse bookmarks panel) */
#historyPanel {
    /* Inherits from .bookmarks-panel */
}

/* History button - purple theme */
.bookmarks-toggle {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.9), rgba(109, 40, 217, 0.9)) !important;
    border: 2px solid rgba(167, 139, 250, 0.4) !important;
    box-shadow: 0 5px 20px rgba(139, 92, 246, 0.4) !important;
}

.bookmarks-toggle:hover {
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.6) !important;
}
