* {
    box-sizing: border-box;
}

body, html {
    font-size: 16px;
    color: #1f2937;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    margin: 0;
    font-weight: 400;
    background: #f9fafb;
    -webkit-font-smoothing: antialiased;
}

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

.main-title {
    font-size: clamp(3rem, 10vw, 8rem);
    font-weight: 800;
    letter-spacing: 4px;
    margin: -10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.title::after {
    content: "News Scraper & Summarizer";
    display: block;
    font-size: clamp(0.9rem, 3vw, 1.25rem);
    font-weight: 400;
    color: hsl(218deg 5% 47%);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 16px;
}

.scraping-button {
    text-align: center;
    margin: 20px 0 30px;
}

#refresh-btn {
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgb(102 126 234 / 35%);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

#refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

#refresh-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgb(102 126 234 / 45%);
}

#refresh-btn:active:not(:disabled) {
    transform: translateY(0);
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.category-buttons.disabled {
    pointer-events: none;
    opacity: 0.4;
}

.other-btns {
    display: contents; /* Permet aux boutons enfants de s'aligner comme les autres */
}

.category-btn,
#all-btn {
    padding: 8px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    color: #4b5563;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-btn:hover,
#all-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
}

.category-btn.active,
#all-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgb(102 126 234 / 30%);
}

.main {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto 60px;
    padding: 0 20px;
}

.article {
    width: calc(33.333% - 16px);
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgb(0 0 0 / 4%);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

.article:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px rgb(0 0 0 / 10%);
    border-color: #667eea;
}

.article-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.article-date,
.article-source,
.article-category {
    margin: 0 18px;
    font-size: 0.8rem;
    color: #9ca3af;
}

.article-date {
    margin-top: 16px;
}

.article-source {
    font-weight: 600;
    color: #6b7280;
}

.article-category {
    display: inline-block;
    align-self: flex-start;
    padding: 3px 12px;
    background: #eef2ff;
    color: #4f46e5;
    border-radius: 999px;
    font-style: normal;
    font-weight: 600;
    margin: 6px 18px 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.article-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.35;
    color: #111827;
    margin: 12px 18px 8px;
    transition: color 0.2s ease;
}

.article:hover .article-title {
    color: #667eea;
}

.article p {
    margin: 0 18px 20px;
    font-size: 0.9rem;
    color: #6b7280;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.detail {
    display: none;
    max-width: 800px;
    margin: 40px auto;
    padding: 40px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgb(0 0 0 / 6%);
}

.detail.visible {
    display: block;
}

.detail p {
    text-align: justify;
    hyphens: auto;
    overflow-wrap: break-word;
    line-height: 1.7;
    color: #374151;
    font-size: 1rem;
}

#back-btn {
    padding: 10px 22px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    color: #4b5563;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    cursor: pointer;
    margin-bottom: 30px;
    transition: all 0.2s ease;
}

#back-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateX(-3px);
}

.article-title-detail {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.3;
    color: #111827;
    margin: 20px 0;
}

.article-date-detail {
    text-align: center;
    color: #9ca3af;
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.article-img-detail {
    display: block;
    margin: 0 auto 30px;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.article-summary {
    font-size: 1.2rem;
    font-weight: 700;
    color: #111827;
    margin: 30px 0 12px;
    padding-left: 12px;
    border-left: 4px solid #667eea;
}

.load-more {
    text-align: center;
    margin: 20px 0 30px;
}

#load-more-btn {
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: linear-gradient(135deg, #667eea, #764ba2);
    cursor: pointer;
    box-shadow: 0 4px 15px rgb(102 126 234 / 35%);
}

.footer {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-size: 0.875rem;
    border-top: 1px solid #e5e7eb;
    margin-top: 60px;
}

.hidden {
    display: none !important;
}

@media (width <= 768px) {
    .article {
        width: calc(50% - 12px);
    }
    
    .detail {
        margin: 20px;
        padding: 24px;
    }
    
    .article-title-detail {
        font-size: 1.4rem;
    }
}

@media (width <= 480px) {
    .article {
        width: 100%;
    }
    
    .title {
        padding: 40px 20px 10px;
    }
}