/* ===== CSS Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red: #c41e3a;
    --deep-red: #8b0000;
    --gold: #d4a574;
    --gold-light: #e8c89e;
    --ink-black: #1a1a1a;
    --paper: #faf6f0;
    --paper-dark: #f0ebe3;
    --text-dark: #2d2d2d;
    --text-light: #666;
    --border-gold: #c9a86c;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: var(--paper);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== Password Screen ===== */
.password-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--deep-red) 0%, var(--primary-red) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.password-box {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
}

.password-logo {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.password-box h2 {
    font-family: 'Noto Serif SC', serif;
    color: var(--ink-black);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.password-input-wrapper {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.password-input-wrapper input {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-gold);
    border-radius: 6px;
    font-size: 1rem;
    width: 200px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}

.password-input-wrapper input:focus {
    border-color: var(--primary-red);
}

.password-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-red);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
    font-family: inherit;
}

.password-btn:hover {
    background: var(--deep-red);
}

.password-error {
    color: var(--primary-red);
    margin-top: 1rem;
    font-size: 0.9rem;
    display: none;
}

/* ===== Header ===== */
.site-header {
    background: linear-gradient(135deg, var(--deep-red) 0%, var(--primary-red) 100%);
    color: white;
    padding: 2rem 1rem 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.site-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.3;
}

.header-content {
    position: relative;
    z-index: 1;
}

.logo {
    font-family: 'Noto Serif SC', serif;
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: 0.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.logo-char {
    display: inline-block;
    animation: fadeInDown 0.8s ease-out;
}

.logo-char:nth-child(2) {
    animation-delay: 0.2s;
    margin-left: 0.5rem;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    letter-spacing: 0.3rem;
    margin-bottom: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.update-time {
    font-size: 0.85rem;
    opacity: 0.8;
}

.update-icon {
    margin-right: 0.3rem;
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.refresh-btn:hover {
    background: rgba(255,255,255,0.3);
}

.refresh-icon {
    font-size: 1.1rem;
    transition: transform 0.5s;
}

.refresh-btn.loading .refresh-icon {
    animation: spin 1s linear infinite;
}

.header-decoration {
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 30px;
    background: var(--paper);
    clip-path: polygon(0 100%, 100% 100%, 100% 0, 0 0);
}

/* ===== Category Tabs ===== */
.category-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: var(--paper-dark);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-gold);
    background: white;
    color: var(--text-dark);
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tab-btn:hover {
    border-color: var(--primary-red);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(196,30,58,0.2);
}

.tab-btn.active {
    background: var(--primary-red);
    color: white;
    border-color: var(--primary-red);
}

/* ===== News Container ===== */
.news-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 60vh;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* ===== News Card ===== */
.news-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(201,168,108,0.3);
    position: relative;
}

.news-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-red), var(--gold));
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(196,30,58,0.15);
}

.news-card-content {
    padding: 1.25rem;
}

.news-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--paper-dark);
    color: var(--primary-red);
    font-size: 0.75rem;
    border-radius: 2px;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.news-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ink-black);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-summary {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--paper-dark);
}

.news-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.news-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    background: var(--primary-red);
    color: white;
    text-decoration: none;
    font-size: 0.8rem;
    border-radius: 4px;
    transition: background 0.3s;
}

.news-link:hover {
    background: var(--deep-red);
}

/* ===== Loading ===== */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 3px solid var(--paper-dark);
    border-top-color: var(--primary-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== Footer ===== */
.site-footer {
    background: var(--ink-black);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
}

.footer-content p {
    margin-bottom: 0.5rem;
}

.footer-note {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ===== Animations ===== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-card {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .logo {
        font-size: 3rem;
    }
    .category-tabs {
        gap: 0.3rem;
    }
    .tab-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    .news-grid {
        grid-template-columns: 1fr;
    }
    .header-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
}

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

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}
.empty-hint { font-size: 0.9rem; margin-top: 0.5rem; color: #888; }

/* 密码页面按钮美化 */
#passwordBtn {
    background: linear-gradient(135deg, #c23a3a 0%, #8b2525 100%);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(139, 37, 37, 0.3);
}

#passwordBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 37, 37, 0.4);
}

#passwordBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(139, 37, 37, 0.3);
}

.password-input-wrapper input {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

.password-input-wrapper input:focus {
    border-color: #c23a3a;
}

/* ===== Search Box ===== */
.search-box {
    display: inline-flex;
    align-items: center;
    gap: 0;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 20px;
    padding: 0.25rem 0.5rem 0.25rem 1rem;
    transition: all 0.3s;
}

.search-box:focus-within {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.6);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 0.9rem;
    width: 160px;
    font-family: inherit;
    placeholder-color: rgba(255,255,255,0.6);
}

.search-box input::placeholder {
    color: rgba(255,255,255,0.6);
}

.search-box button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.3rem 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
}

.search-box button:hover {
    background: rgba(255,255,255,0.2);
}

/* ===== Search Result Header ===== */
.search-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #2d2d4a 0%, #1a1a2e 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.search-result-header span {
    flex: 1;
}

.back-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
    margin-left: 1rem;
}

.back-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* ===== Mobile Responsive for Search ===== */
@media (max-width: 768px) {
    .search-box input {
        width: 120px;
    }
    .search-result-header {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    .back-btn {
        margin-left: 0;
    }
}
