/* ========================================
   AI Model News - Main Stylesheet
   Mobile-First Responsive Design
   ======================================== */

/* CSS Variables */
:root {
    --primary: #1e3a8a;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary: #06b6d4;
    --secondary-light: #22d3ee;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition: all 0.3s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ========================================
   Typography
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-dark);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

/* ========================================
   Header
   ======================================== */

.header {
    background: var(--bg-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
}

.nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    flex-direction: column;
    padding: 16px;
    gap: 8px;
    box-shadow: var(--shadow-md);
}

.nav-menu.active {
    display: flex;
}

.nav-link {
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: var(--radius);
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background: var(--bg-light);
    color: var(--primary);
}

.menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-dark);
    transition: var(--transition);
}

/* Desktop Navigation */
@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }

    .nav-menu {
        display: flex;
        position: static;
        flex-direction: row;
        gap: 8px;
        padding: 0;
        box-shadow: none;
        background: transparent;
    }

    .nav-link {
        padding: 8px 16px;
    }
}

/* ========================================
   Hero Section
   ======================================== */

.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 48px 0;
    text-align: center;
}

.hero-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: white;
}

.hero-subtitle {
    font-size: 0.9375rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto 24px;
    color: rgba(255, 255, 255, 0.9);
}

.hero-btn {
    display: inline-block;
    padding: 12px 32px;
    background: white;
    color: var(--primary);
    font-weight: 600;
    border-radius: var(--radius);
    transition: var(--transition);
}

.hero-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

@media (min-width: 768px) {
    .hero {
        padding: 80px 0;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }
}

/* ========================================
   Section Styles
   ======================================== */

.section {
    padding: 48px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 32px;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* ========================================
   Category Cards
   ======================================== */

.categories-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.category-card {
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    text-align: center;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.category-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.category-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.category-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.category-link {
    display: inline-block;
    padding: 8px 20px;
    background: var(--bg-light);
    color: var(--primary);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

.category-link:hover {
    background: var(--primary);
    color: white;
}

@media (max-width: 639px) {
    .index-page .categories-grid .category-card:nth-child(n+2) {
        display: none;
    }
}

@media (min-width: 640px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   Article Cards
   ======================================== */

.articles-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.article-card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
}

.article-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(59, 130, 246, 0.2);
}

.article-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.article-card:hover .article-image {
    transform: scale(1.03);
}

.article-content {
    padding: 24px;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.category-tag {
    padding: 5px 14px;
    background: var(--bg-light);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.category-tag.open-source {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.category-tag.research {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    color: #be185d;
}

.category-tag.industry {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
}

.category-tag.tools {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.article-date {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 400;
}

.article-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.4;
    color: var(--text-dark);
    transition: color 0.2s ease;
}

.article-card:hover .article-title {
    color: var(--primary);
}

.article-excerpt {
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.7;
    margin-bottom: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-muted);
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}

@media (max-width: 639px) {
    .index-page .articles-grid .article-card:nth-child(n+2) {
        display: none;
    }
}

@media (min-width: 640px) {
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .articles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   Featured Article
   ======================================== */

.featured-article {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.featured-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
}

.featured-content {
    padding: 24px;
}

.featured-label {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    margin-bottom: 16px;
}

.featured-title {
    font-size: 1.5rem;
    margin-bottom: 12px;
    line-height: 1.3;
}

.featured-excerpt {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 20px;
}

@media (max-width: 767px) {
    .index-page .featured-image {
        height: 20vh;
    }
    .index-page .featured-label{
        display: none;
    }

    .index-page .featured-title {
        font-size: 1.125rem;
    }

    .index-page #featured-title {
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .index-page .featured-excerpt {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

@media (min-width: 768px) {
    .featured-article {
        grid-template-columns: 1fr 1fr;
    }

    .featured-image {
        height: 100%;
        min-height: 400px;
    }
}

/* ========================================
   Filters
   ======================================== */

.filters {
    background: var(--bg-white);
    padding: 28px 24px;
    margin-bottom: 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.filter-buttons {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.filter-btn {
    padding: 11px 22px;
    border: 2px solid var(--border);
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
    letter-spacing: 0.4px;
    line-height: 1.4;
    min-width: 90px;
    text-align: center;
}

.filter-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: rgba(59, 130, 246, 0.06);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
    transform: translateY(-2px);
}

/* ========================================
   Pagination
   ======================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
}

.page-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--bg-white);
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover:not(.active) {
    background: var(--bg-light);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   Detail Page
   ======================================== */

.article-detail {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.detail-header {
    margin-bottom: 32px;
}

.detail-title {
    font-size: 1.5rem;
    margin-bottom: 16px;
    line-height: 1.3;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.detail-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 32px;
}

.detail-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-dark);
}

.detail-content p {
    margin-bottom: 20px;
    color: var(--text-dark);
}

.related-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.related-title {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.related-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.related-card {
    padding: 16px;
    background: var(--bg-light);
    border-radius: var(--radius);
    transition: var(--transition);
    cursor: pointer;
}

.related-card:hover {
    background: var(--border);
}

.related-card-title {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 8px;
}

.related-card-date {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

@media (min-width: 640px) {
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .article-detail {
        padding: 40px;
    }

    .detail-title {
        font-size: 2rem;
    }
}

/* ========================================
   Static Pages
   ======================================== */

.page-content {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.page-header {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

.content-section {
    margin-bottom: 32px;
}

.content-section h3 {
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.content-section p {
    color: var(--text-dark);
    line-height: 1.7;
}

.content-section ul {
    list-style: disc;
    padding-left: 24px;
    margin-bottom: 16px;
}

.content-section li {
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.6;
}

@media (min-width: 768px) {
    .page-content {
        padding: 40px;
    }

    .page-title {
        font-size: 2rem;
    }
}

/* ========================================
   Contact Form
   ======================================== */

.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

.contact-form {
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    min-height: 150px;
    resize: vertical;
}

.submit-btn {
    width: 100%;
    padding: 14px 32px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.submit-btn:hover {
    background: var(--primary-dark);
}

.contact-info {
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.info-item {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.info-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.info-content h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.info-content p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

@media (min-width: 768px) {
    .contact-grid {
        grid-template-columns: 1.5fr 1fr;
    }

    .contact-form,
    .contact-info {
        padding: 32px;
    }
}

/* ========================================
   Footer
   ======================================== */

.footer {
    background: var(--text-dark);
    color: white;
    padding: 40px 0 20px;
    margin-top: 48px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

.footer-section h4 {
    color: white;
    font-size: 1rem;
    margin-bottom: 16px;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-link {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9375rem;
    transition: var(--transition);
}

.footer-link:hover {
    color: white;
}

.footer-bottom {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.footer-copyright {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
}

.social-links {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
}

.social-link {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: var(--transition);
}

.social-link:hover {
    background: var(--primary);
}

@media (min-width: 768px) {
    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .footer-bottom {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .social-links {
        margin-top: 0;
    }
}

/* ========================================
   Utility Classes
   ======================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.hidden { display: none; }

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }
}
