/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

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

/* Header Styles */
.header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav {
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand .brand-link {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #2563eb;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.3s ease;
}

.search-btn:hover {
    color: #2563eb;
}

.icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

/* Search Section */
.search-section {
    background: #f8fafc;
    padding: 2rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
}

.search-form {
    display: flex;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 1rem;
    border: none;
    font-size: 1rem;
    outline: none;
}

.search-submit {
    background: #2563eb;
    border: none;
    padding: 1rem;
    cursor: pointer;
    color: white;
    transition: background 0.3s ease;
}

.search-submit:hover {
    background: #1d4ed8;
}

.search-submit svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Main Layout */
.main {
    padding: 2rem 0;
    min-height: 60vh;
}

.articles-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.sidebar-section {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.category-list,
.archive-list {
    list-style: none;
}

.category-link,
.archive-link {
    display: block;
    padding: 0.5rem 0;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 0.875rem;
}

.category-link:hover,
.category-link.active,
.archive-link:hover {
    color: #2563eb;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 1rem;
    text-decoration: none;
    font-size: 0.75rem;
    transition: all 0.3s ease;
}

.tag:hover {
    background: #2563eb;
    color: white;
}

/* Content Header */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-info h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.results-count {
    color: #6b7280;
    font-size: 0.875rem;
}

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

.sort-dropdown select {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background: white;
    font-size: 0.875rem;
    cursor: pointer;
}

.view-toggle {
    display: flex;
    background: #f3f4f6;
    border-radius: 0.375rem;
    padding: 0.25rem;
}

.view-btn {
    padding: 0.5rem;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.3s ease;
}

.view-btn.active {
    background: white;
    color: #2563eb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.view-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Articles Grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.article-card {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.article-card__image {
    position: relative;
    height: 200px;
}

.article-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-card__category {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: #2563eb;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.article-card__content {
    padding: 1.5rem;
}

.article-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.article-author {
    font-weight: 500;
}

.article-date {
    color: #9ca3af;
}

.article-read-time {
    color: #9ca3af;
}

.article-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #1f2937;
    line-height: 1.4;
}

.article-excerpt {
    color: #6b7280;
    margin-bottom: 1rem;
    line-height: 1.5;
    font-size: 0.875rem;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
}

.article-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name {
    font-size: 0.875rem;
    color: #6b7280;
}

.article-stats {
    display: flex;
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.stat-item svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Articles List */
.articles-list {
    margin-bottom: 3rem;
}

.article-list-item {
    display: flex;
    gap: 1.5rem;
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.article-list__image {
    flex-shrink: 0;
    width: 150px;
    height: 100px;
    border-radius: 0.375rem;
    overflow: hidden;
}

.article-list__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-list__content {
    flex: 1;
}

.article-list__content .article-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.article-list__content .article-excerpt {
    margin-bottom: 1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    background: white;
    color: #6b7280;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.pagination-btn:hover:not(:disabled),
.pagination-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 0.5rem 0.75rem;
    color: #6b7280;
}

/* Footer */
.footer {
    background: #1f2937;
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: white;
}

.footer-description {
    color: #9ca3af;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: background 0.3s ease;
}

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

.footer-heading {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: white;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 1rem;
    text-align: center;
    color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .articles-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .sidebar-section {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-wrap: wrap;
    }
    
    .nav-menu {
        order: 3;
        width: 100%;
        flex-direction: column;
        gap: 1rem;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid #e5e7eb;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .layout-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .article-list-item {
        flex-direction: column;
    }
    
    .article-list__image {
        width: 100%;
        height: 200px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .results-info h1 {
        font-size: 1.5rem;
    }
    
    .layout-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .sort-dropdown select {
        width: 100%;
    }
    
    .article-meta {
        font-size: 0.625rem;
    }
    
    .article-title {
        font-size: 1rem;
    }
    
    .article-excerpt {
        font-size: 0.8rem;
    }
}
