/* ========================================
   人民网中日对译语料库 - 样式表
   黑白极简 + 暗色主题
   ======================================== */

/* --- CSS 变量（亮色主题） --- */
:root {
    --bg: #fafafa;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-footer: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: #f5f5f5;
    --bg-stat: #f7f7f7;
    --border: #e5e5e5;
    --border-focus: #1a1a1a;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #888888;
    --text-link: #1a1a1a;
    --accent: #1a1a1a;
    --accent-light: #333333;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* --- 暗色主题 --- */
[data-theme="dark"] {
    --bg: #111111;
    --bg-card: #1a1a1a;
    --bg-header: #1a1a1a;
    --bg-footer: #1a1a1a;
    --bg-input: #222222;
    --bg-hover: #252525;
    --bg-stat: #1e1e1e;
    --border: #333333;
    --border-focus: #ffffff;
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --text-muted: #777777;
    --text-link: #e0e0e0;
    --accent: #ffffff;
    --accent-light: #cccccc;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
}

/* --- 全局样式 --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    line-height: 1.7;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent);
}

/* --- 头部 --- */
header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background var(--transition), border-color var(--transition);
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

header h1 i {
    margin-right: 8px;
    font-size: 1.1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header-actions a {
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: color var(--transition);
}

.header-actions a:hover {
    color: var(--text-primary);
}

/* 主题切换按钮 */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: all var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* --- 主内容区 --- */
main {
    padding: 32px 0 48px;
}

/* --- 搜索框 --- */
.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.search-box input[type="text"] {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all var(--transition);
    outline: none;
}

.search-box input[type="text"]:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

[data-theme="dark"] .search-box input[type="text"]:focus {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
}

.search-box input[type="text"]::placeholder {
    color: var(--text-muted);
}

.search-box button {
    padding: 12px 24px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.search-box button:hover {
    background: var(--accent-light);
    opacity: 0.9;
}

/* --- 统计信息 --- */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    transition: all var(--transition);
}

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

.stat-item .stat-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-item .number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-item .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- 语句列表 --- */
.sentence-list {
    margin-bottom: 32px;
}

.sentence-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 12px;
    transition: all var(--transition);
    animation: fadeIn 0.3s ease forwards;
    opacity: 0;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.sentence-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--text-muted);
}

.sentence-chinese {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.6;
}

.sentence-japanese {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    padding-left: 16px;
    border-left: 2px solid var(--border);
    margin-bottom: 12px;
}

.sentence-item:hover .sentence-japanese {
    border-left-color: var(--text-muted);
}

.source {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.source a {
    color: var(--text-muted);
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 2px;
    transition: all var(--transition);
}

.source a:hover {
    color: var(--text-primary);
    text-decoration-color: var(--text-primary);
}

/* --- 分页 --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 16px 0;
}

.pagination button {
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-sans);
    color: var(--text-primary);
    transition: all var(--transition);
    min-width: 90px;
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#page-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 8px 16px;
    font-variant-numeric: tabular-nums;
}

.pagination-select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
}

.pagination-select:hover {
    border-color: var(--text-muted);
}

/* --- 加载动画 --- */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- 无结果提示 --- */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results i {
    font-size: 2.5rem;
    margin-bottom: 16px;
    display: block;
    opacity: 0.5;
}

.no-results p {
    font-size: 1rem;
}

/* --- 搜索高亮 --- */
.highlight {
    background: var(--text-primary);
    color: var(--bg);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* --- 页脚 --- */
.footer {
    background: var(--bg-footer);
    border-top: 1px solid var(--border);
    padding: 28px 0 24px;
    transition: background var(--transition), border-color var(--transition);
}

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

.footer-info {
    flex: 1;
    min-width: 280px;
}

.footer-info .copyright {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0 0 4px 0;
}

.footer-info .data-source {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.footer-info .data-source a {
    color: var(--text-muted);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.footer-info .data-source a:hover {
    color: var(--text-primary);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
}

.footer-links a {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color var(--transition);
}

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

.footer-links .separator {
    color: var(--border);
}

.footer-bottom {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.footer-bottom p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
}

/* --- 按钮图标间距 --- */
button i {
    margin-right: 4px;
}

button i.fa-chevron-left {
    margin-right: 6px;
}

button i.fa-chevron-right {
    margin-left: 6px;
    margin-right: 0;
}

/* ========================================
   响应式设计
   ======================================== */

/* 平板 */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    header h1 {
        font-size: 1.1rem;
    }

    .stats {
        gap: 10px;
    }

    .stat-item {
        padding: 16px 12px;
    }

    .stat-item .number {
        font-size: 1.4rem;
    }

    .stat-item .label {
        font-size: 0.7rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box button {
        width: 100%;
    }

    .sentence-item {
        padding: 16px 18px;
    }

    .sentence-chinese {
        font-size: 1rem;
    }

    .sentence-japanese {
        font-size: 0.95rem;
    }

    .footer-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .footer-info {
        min-width: 100%;
    }
}

/* 手机 */
@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    .container {
        padding: 0 12px;
    }

    header {
        padding: 14px 0;
    }

    header h1 {
        font-size: 1rem;
    }

    header h1 i {
        display: none;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-item {
        padding: 12px 8px;
    }

    .stat-item .number {
        font-size: 1.2rem;
    }

    .stat-item .label {
        font-size: 0.65rem;
    }

    .stat-item .stat-icon {
        font-size: 1rem;
        margin-bottom: 4px;
    }

    .sentence-item {
        padding: 14px 14px;
        margin-bottom: 8px;
    }

    .sentence-chinese {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }

    .sentence-japanese {
        font-size: 0.9rem;
        padding-left: 12px;
        margin-bottom: 10px;
    }

    .pagination {
        gap: 6px;
    }

    .pagination button {
        padding: 8px 14px;
        min-width: 75px;
        font-size: 0.85rem;
    }

    #page-info {
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    .footer {
        padding: 20px 0 16px;
    }

    .footer-info .copyright {
        font-size: 0.8rem;
    }

    .footer-info .data-source {
        font-size: 0.75rem;
    }

    .footer-bottom p {
        font-size: 0.7rem;
    }
}

/* 超小屏幕 */
@media (max-width: 360px) {
    .stats {
        grid-template-columns: 1fr;
    }

    .pagination {
        flex-direction: column;
        align-items: center;
    }
}

/* --- 触摸设备优化 --- */
@media (hover: none) {
    .sentence-item:hover {
        transform: none;
        box-shadow: none;
        border-color: var(--border);
    }

    .stat-item:hover {
        box-shadow: none;
    }

    .sentence-item:active {
        background: var(--bg-hover);
    }
}

/* --- 减少动画 --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .sentence-item {
        opacity: 1;
    }
}

/* --- 系统暗色模式自动适配 --- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #111111;
        --bg-card: #1a1a1a;
        --bg-header: #1a1a1a;
        --bg-footer: #1a1a1a;
        --bg-input: #222222;
        --bg-hover: #252525;
        --bg-stat: #1e1e1e;
        --border: #333333;
        --border-focus: #ffffff;
        --text-primary: #f0f0f0;
        --text-secondary: #b0b0b0;
        --text-muted: #777777;
        --text-link: #e0e0e0;
        --accent: #ffffff;
        --accent-light: #cccccc;
        --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
        --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
        --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
    }
}
