/* Reset et base */
* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    background: #f8fafc;
    color: #334155;
    display: flex;
    min-height: 100vh;
}

/* Barre latérale */
.sidebar {
    width: 300px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 25px 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid #334155;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon { font-size: 28px; }

.sidebar-section { margin-bottom: 30px; }

.section-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Liste des sources */
.sources-list { list-style: none; }

.source-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.source-item:hover { background: rgba(255, 255, 255, 0.1); }

.source-item.active {
    background: rgba(59, 130, 246, 0.2);
    border-left: 3px solid #3b82f6;
}

.source-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.source-count {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

/* Catégories à l'intérieur d'une source */
.source-categories {
    margin-top: 10px;
    padding-left: 15px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
}

.source-item.active .source-categories { display: block; }

.category-item {
    padding: 8px 12px;
    margin: 5px 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.8;
    transition: all 0.2s;
}

.category-item:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.category-item.active {
    background: #3b82f6;
    opacity: 1;
}

.category-count {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 5px;
}

/* Bouton recharger */
.reload-btn {
    width: 100%;
    padding: 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.reload-btn:hover { background: #2563eb; }

/* Contenu principal */
.main-content {
    flex: 1;
    margin-left: 300px;
    padding: 30px;
    max-width: calc(100% - 300px);
}

/* En-tête */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.current-source-title {
    font-size: 28px;
    font-weight: 800;
    color: #1e293b;
}

.current-category {
    display: inline-block;
    padding: 6px 15px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 10px;
}

.stats { display: flex; gap: 20px; }

.stat-box {
    padding: 15px 25px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
}

.stat-label {
    font-size: 14px;
    color: #64748b;
    margin-top: 5px;
}

/* Sélection de catégorie */
.category-selection {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

.category-selection h3 {
    color: #475569;
    margin-bottom: 20px;
}

.categories-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.category-card {
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
}

.category-card:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
}

.category-card.active {
    background: #dbeafe;
    border-color: #3b82f6;
}

.category-card-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 5px;
}

.category-card-count {
    font-size: 12px;
    color: #64748b;
}

.category-card-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 5px;
}

/* Barre d'actions */
.action-bar {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selection-info {
    font-size: 16px;
    color: #475569;
    font-weight: 500;
}

.action-buttons { display: flex; gap: 12px; }

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.btn-secondary:hover { background: #cbd5e1; }

/* Articles */
.articles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
}

.article-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.article-header { padding: 20px; }

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

.article-category {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.category-official {
    background: #dbeafe;
    color: #1d4ed8;
}

.category-unofficial {
    background: #f3e8ff;
    color: #7c3aed;
}

.reading-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
}

.article-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-input {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
}

.article-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    line-height: 1.4;
}

.article-date {
    font-size: 13px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 15px;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 15px 0;
}

.tag {
    padding: 4px 10px;
    background: #f8fafc;
    color: #475569;
    border-radius: 6px;
    font-size: 12px;
    border: 1px solid #e2e8f0;
}

.article-summary {
    padding: 15px;
    background: #f8fafc;
    border-left: 4px solid #cbd5e1;
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
    margin: 0 20px 15px;
    border-radius: 0 8px 8px 0;
}

.article-footer { padding: 20px; }

.toggle-btn {
    width: 100%;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.toggle-btn:hover { background: #f1f5f9; }

.article-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.article-content.open { max-height: 1000px; }

.content-inner { padding: 20px; }

.article-source-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    margin-top: 15px;
    transition: background 0.2s;
}

.article-source-link:hover { background: #2563eb; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    padding: 20px;
}

.page-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.page-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* États */
.hidden { display: none !important; }

.loading {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 250px; }
    .main-content {
        margin-left: 250px;
        max-width: calc(100% - 250px);
    }
    .articles-container {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    body { flex-direction: column; }
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        max-height: 400px;
    }
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 20px;
    }
    .articles-container { grid-template-columns: 1fr; }
    .header { flex-direction: column; align-items: flex-start; gap: 15px; }
    .stats { width: 100%; justify-content: space-between; }
}
