/* HN AI Insights - 移动端优先样式 */

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

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --text: #333;
    --text-light: #666;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.98);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.2);
    --radius: 12px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-gradient);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
}

/* Header - 移动端优化 */
header {
    text-align: center;
    padding: 25px 15px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

h1 {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 700;
}

.subtitle {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 15px;
    line-height: 1.4;
}

.meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    color: #888;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.source-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* Report Cards - 移动端优化 */
.reports {
    display: grid;
    gap: 15px;
}

.report-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.report-card:active {
    transform: scale(0.98);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.report-date {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.report-time {
    background: var(--bg-gradient);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.report-summary {
    color: var(--text-light);
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-list {
    list-style: none;
    margin-bottom: 15px;
}

.article-item {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.article-item:last-child {
    border-bottom: none;
}

.article-title {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    display: block;
    margin-bottom: 6px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.article-title:active {
    opacity: 0.7;
}

.article-meta {
    font-size: 0.8rem;
    color: #888;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hot-score {
    background: #fff3cd;
    color: #856404;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.75rem;
}

.view-btn {
    display: block;
    text-align: center;
    padding: 12px 20px;
    background: var(--bg-gradient);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: opacity 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.view-btn:active {
    opacity: 0.8;
}

/* Footer */
footer {
    text-align: center;
    padding: 25px 15px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 30px;
    font-size: 0.85rem;
}

footer a {
    color: white;
    font-weight: 500;
}

/* Pagination - 分页控件 */
.pagination {
    margin-top: 20px;
    text-align: center;
}

.page-info {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    margin-bottom: 15px;
    font-weight: 500;
}

.page-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    -webkit-tap-highlight-color: transparent;
}

.page-btn:active {
    transform: scale(0.95);
    background: white;
}

.page-btn.active {
    background: var(--bg-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.page-ellipsis {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    padding: 0 5px;
}

/* 桌面端分页优化 */
@media (min-width: 768px) {
    .page-btn {
        min-width: 48px;
        height: 48px;
        font-size: 1rem;
    }
}

/* Loading & Error States */
.loading {
    text-align: center;
    padding: 50px 20px;
    color: white;
    font-size: 1rem;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.error {
    background: rgba(255, 255, 255, 0.95);
    color: #721c24;
    padding: 20px;
    border-radius: var(--radius);
    margin: 20px 0;
    text-align: center;
}

.error h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

/* Report Viewer - 移动端优化 */
.report-wrapper {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.back-nav {
    margin-bottom: 15px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--card-bg);
    color: var(--primary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    -webkit-tap-highlight-color: transparent;
}

.back-btn:active {
    transform: scale(0.96);
}

.markdown-body {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px 15px;
    box-shadow: var(--shadow);
    font-size: 15px;
    overflow-x: hidden;
}

/* Markdown 内容移动端优化 */
.markdown-body h1 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
    word-wrap: break-word;
}

.markdown-body h2 {
    font-size: 1.25rem;
    margin-top: 25px;
    margin-bottom: 12px;
    color: var(--primary-dark);
    word-wrap: break-word;
}

.markdown-body h3 {
    font-size: 1.05rem;
    margin-top: 20px;
    margin-bottom: 10px;
    word-wrap: break-word;
}

.markdown-body p {
    margin-bottom: 12px;
    line-height: 1.7;
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: 12px;
    padding-left: 20px;
}

.markdown-body li {
    margin-bottom: 6px;
    line-height: 1.6;
}

.markdown-body a {
    color: var(--primary);
    word-break: break-word;
}

.markdown-body table {
    width: 100%;
    font-size: 0.85rem;
    margin: 15px 0;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.markdown-body th {
    background: var(--bg-gradient);
    color: white;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.markdown-body td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.markdown-body tr:nth-child(even) {
    background-color: #f8f9ff;
}

.markdown-body blockquote {
    border-left: 3px solid var(--primary);
    margin: 15px 0;
    padding: 12px 15px;
    background: #f8f9ff;
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
}

.markdown-body code {
    background: #f4f4f4;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.85em;
    word-break: break-word;
}

.markdown-body pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 15px 0;
    font-size: 0.8rem;
}

.markdown-body pre code {
    background: none;
    padding: 0;
    word-break: normal;
}

/* Meta Card - 移动端优化 */
.meta-card {
    background: var(--bg-gradient);
    color: white;
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.meta-card .meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 140px;
}

.meta-card .meta-icon {
    font-size: 1.2rem;
}

.meta-card .meta-label {
    opacity: 0.9;
    font-size: 0.75rem;
}

.meta-card .meta-value {
    font-weight: 600;
    font-size: 0.85rem;
}

/* 表格滚动提示 */
.table-scroll-hint {
    font-size: 0.75rem;
    color: #888;
    text-align: right;
    margin-top: 5px;
    font-style: italic;
}

/* 桌面端适配 */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
        padding: 20px;
    }

    h1 {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1.05rem;
    }

    .report-card {
        padding: 25px;
    }

    .report-date {
        font-size: 1.3rem;
    }

    .markdown-body {
        padding: 35px;
        font-size: 16px;
    }

    .markdown-body h1 {
        font-size: 1.8rem;
    }

    .markdown-body h2 {
        font-size: 1.4rem;
    }

    .markdown-body table {
        font-size: 0.9rem;
        display: table;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 900px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --text: #e0e0e0;
        --text-light: #a0a0a0;
        --card-bg: rgba(30, 30, 30, 0.95);
        --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .markdown-body td {
        border-bottom: 1px solid #444;
    }

    .markdown-body tr:nth-child(even) {
        background-color: rgba(255, 255, 255, 0.05);
    }

    .markdown-body code {
        background: #3a3a3a;
    }
}
