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

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-title h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header-title .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

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

.github-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.github-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.github-link i {
    font-size: 1.2rem;
}

.github-text {
    font-size: 0.9rem;
}

/* Sections */
section {
    background: var(--card-background);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

section h2 i {
    color: var(--primary-color);
}

/* Status Panel */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.status-item {
    padding: 16px;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.status-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}


/* Topic Management */
.topic-controls {
    margin-bottom: 24px;
}

.add-topic {
    display: flex;
    gap: 12px;
}

#topic-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

#topic-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

button {
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

button:hover {
    background: #1d4ed8;
}

button:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
}


button.danger {
    background: var(--error-color);
}

button.danger:hover {
    background: #dc2626;
}

.topics-list h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
}

.topic-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.topic-card {
    padding: 16px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.2s;
}

.topic-card:hover {
    box-shadow: var(--shadow);
}

.topic-info h3 {
    margin-bottom: 4px;
    color: var(--primary-color);
}


.topic-actions {
    display: flex;
    gap: 8px;
}

.topic-actions button {
    padding: 8px 12px;
    font-size: 0.875rem;
}

.topic-actions button.subscribed {
    background: var(--error-color);
}

.topic-actions button.subscribed:hover {
    background: #dc2626;
}

/* News Feed */
.feed-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#topic-filter {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
}

.news-container {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-color);
}

.news-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    animation: slideIn 0.3s ease-out;
}

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

.news-item:hover {
    background: white;
}

.news-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.news-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
    flex: 1;
}

.news-time {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.news-topic {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.news-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.news-link:hover {
    text-decoration: underline;
}

.news-snippet {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.no-news,
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Logs Panel */
.logs-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-color);
}

.log-entry {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.success {
    border-left: 4px solid var(--success-color);
}

.log-entry.error {
    border-left: 4px solid var(--error-color);
}

.log-time {
    color: var(--text-secondary);
    margin-right: 12px;
}

.log-topic {
    font-weight: 600;
    margin-right: 12px;
    color: var(--primary-color);
}

.log-message {
    color: var(--text-primary);
}


/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.fa-spin {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 20px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .header-title h1 {
        font-size: 2rem;
    }

    .header-title .subtitle {
        font-size: 1rem;
    }

    .github-text {
        display: none;
        /* Hide text on mobile, show only icon */
    }

    .github-link {
        padding: 8px 12px;
    }

    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .add-topic {
        flex-direction: column;
    }

    .feed-controls {
        flex-direction: column;
    }

    .topic-cards {
        grid-template-columns: 1fr;
    }

    .news-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .news-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

}