/* AI News Daily - Magazine Style CSS */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
    --bg-primary: #faf9f7;
    --bg-secondary: #f5f4f2;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-meta: #9a9a9a;
    --accent-red: #c41e3a;
    --accent-blue: #1e40af;
    --accent-green: #047857;
    --accent-amber: #b45309;
    --border: #e5e5e5;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --primary-light: #eff6ff;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
}

/* Header - Economist Style */
header {
    background: var(--bg-card);
    border-bottom: 3px solid var(--text-primary);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo span {
    color: var(--accent-red);
}

.header-meta {
    font-size: 0.75rem;
    color: var(--text-meta);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text-primary);
}

/* Main Content */
main {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* Date Header - Morning Brew Style */
.date-header {
    text-align: center;
    padding: 2rem 0 2.5rem;
    border-bottom: 1px solid var(--border);
}

.date-header .date {
    font-family: 'Noto Serif SC', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.date-header .subtitle {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.date-header .emoji {
    font-size: 1.2rem;
}

/* Section */
.section {
    margin-top: 3rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.section-header .emoji {
    font-size: 1.3rem;
}

.section-header .title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-header .badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.red {
    background: #fef2f2;
    color: var(--accent-red);
}

.badge.blue {
    background: #eff6ff;
    color: var(--accent-blue);
}

.badge.green {
    background: #f0fdf4;
    color: var(--accent-green);
}

.badge.amber {
    background: #fffbeb;
    color: var(--accent-amber);
}

.badge.gray {
    background: #f5f5f5;
    color: var(--text-secondary);
}

/* News Card */
.news-card {
    background: var(--bg-card);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s;
}

.news-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.news-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.news-card-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.5;
    flex: 1;
}

.news-card-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.news-card-title a:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

/* Expand/Collapse Button */
.expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.expand-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

.news-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-meta);
}

.news-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.source-badge {
    padding: 0.1rem 0.4rem;
    background: var(--bg-primary);
    border-radius: 3px;
    font-weight: 500;
}

.news-card-summary {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    position: relative;
}

/* 收起状态下的省略号效果 */
.news-card.collapsed .news-card-summary::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 2em;
    height: 1.2em;
    background: linear-gradient(to right, transparent, var(--bg-card));
}

/* 展开时隐藏短摘要，显示完整内容 */
.news-card.expanded .news-card-summary {
    display: none;
}

/* News Details (Expandable) */
.news-details {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.news-card.expanded .news-details {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 2000px;
    }
}

.summary-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.news-summary-full strong {
    color: var(--text-primary);
    font-weight: 600;
}

.news-card.expanded .news-details {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

.news-summary-full {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.original-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    background: var(--primary-light);
    color: var(--accent-blue);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.original-link:hover {
    background: var(--accent-blue);
    color: white;
}

.news-meta-expanded {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-meta);
    margin-top: 0.75rem;
}

/* Archive Styles */
.archive-item {
    background: var(--bg-card);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    gap: 1.5rem;
    align-items: center;
    transition: box-shadow 0.2s;
}

.archive-item:hover {
    box-shadow: var(--shadow);
}

.archive-date {
    min-width: 120px;
    text-align: center;
}

.archive-date .date-text {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    font-weight: 600;
    display: block;
}

.archive-date .weekday-text {
    font-size: 0.75rem;
    color: var(--text-meta);
}

.archive-info {
    flex: 1;
}

.archive-count {
    font-size: 0.75rem;
    color: var(--text-meta);
    margin-bottom: 0.25rem;
}

.archive-top {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.archive-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.archive-group {
    background: var(--bg-card);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.archive-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.archive-group-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    font-weight: 600;
}

.archive-group-count {
    font-size: 0.8rem;
    color: var(--text-meta);
}

/* Archive Display (News Detail View) */
.archive-back-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    background: var(--border);
    transform: translateX(-2px);
}

.archive-date-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1.1rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-meta);
    font-size: 0.8rem;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 640px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-links {
        width: 100%;
        justify-content: flex-start;
    }

    .date-header .date {
        font-size: 1.8rem;
    }

    .news-card {
        padding: 1.25rem;
    }

    .news-card-title {
        font-size: 1rem;
    }

    .news-card-header {
        flex-direction: column;
    }

    .expand-btn {
        align-self: flex-start;
    }

    .archive-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .archive-date {
        min-width: auto;
        text-align: left;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2a2a2a;
        --bg-card: #242424;
        --text-primary: #f5f5f5;
        --text-secondary: #a0a0a0;
        --text-meta: #707070;
        --border: #333333;
        --shadow: 0 1px 3px rgba(0,0,0,0.3);
    }

    .badge.red {
        background: #3a1a1a;
        color: #fca5a5;
    }

    .badge.blue {
        background: #1a2a3a;
        color: #93c5fd;
    }

    .badge.green {
        background: #1a3a2a;
        color: #86efac;
    }

    .badge.amber {
        background: #3a2a1a;
        color: #fcd34d;
    }
}
