/* ===== 物理竞赛博客 - 前端样式 ===== */

:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #818cf8;
    --accent: #06b6d4;
    --accent-dark: #0891b2;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
    --max-width: 1200px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 16px;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
    position: relative;
    overflow: hidden;
    margin-bottom: 30px;
}

.header-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #1e1b4b 0%, #4f46e5 50%, #06b6d4 100%);
}

.header-bg::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(6,182,212,0.15) 0%, transparent 50%);
}

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

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    gap: 20px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 20px;
    font-weight: 700;
}

.logo:hover { color: white; }

.logo-icon {
    font-size: 28px;
    display: inline-block;
    animation: spin 8s linear infinite;
}

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

.main-nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.main-nav a {
    color: rgba(255,255,255,0.85);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.main-nav a:hover, .main-nav a.active {
    color: white;
    background: rgba(255,255,255,0.15);
}

.search-form {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    padding: 4px 4px 4px 14px;
    backdrop-filter: blur(10px);
}

.search-form input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 14px;
    width: 180px;
}

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

.search-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

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

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: var(--transition);
}

/* ===== Main Content ===== */
.main-content { padding: 0 20px 40px; }

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    max-width: var(--max-width);
    margin: 0 auto;
}

.content-area { min-width: 0; }

/* ===== Section Title ===== */
.section-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary);
    display: inline-block;
}

/* ===== Featured ===== */
.featured-section { margin-bottom: 40px; }

.featured-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.featured-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.featured-card::before {
    content: '';
    position: absolute;
    top: -50%; right: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    transition: var(--transition);
}

.featured-card:hover::before {
    transform: scale(1.2);
}

.featured-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(79,70,229,0.3);
}

.featured-card h3 { font-size: 17px; margin: 10px 0; line-height: 1.4; }
.featured-card p { font-size: 13px; opacity: 0.85; line-height: 1.5; }
.featured-card .article-date { font-size: 12px; opacity: 0.7; }

.featured-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
}

/* ===== Article Cards ===== */
.article-list { display: flex; flex-direction: column; gap: 16px; }

.article-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}

.article-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.article-card-body { padding: 24px; }

.article-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.article-category-tag {
    background: rgba(79,70,229,0.1);
    color: var(--primary);
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.article-date, .article-views {
    font-size: 13px;
    color: var(--text-lighter);
}

.article-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
}

.article-title a { color: var(--text); }
.article-title a:hover { color: var(--primary); }

.article-excerpt {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.article-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.tag-link {
    background: var(--bg);
    color: var(--text-light);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    transition: var(--transition);
}

.tag-link:hover {
    background: var(--primary);
    color: white;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    transition: var(--transition);
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

/* ===== Single Article ===== */
.single-article {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-lighter);
    margin-bottom: 20px;
}

.breadcrumb .separator { color: var(--text-lighter); }
.breadcrumb a { color: var(--text-light); }

.article-h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 12px;
    line-height: 1.4;
}

.article-info {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--text-lighter);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.article-content {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text);
}

.article-content h1 { font-size: 26px; margin: 24px 0 12px; font-weight: 700; }
.article-content h2 { font-size: 22px; margin: 20px 0 10px; font-weight: 700; border-bottom: 2px solid var(--border); padding-bottom: 6px; }
.article-content h3 { font-size: 18px; margin: 16px 0 8px; font-weight: 600; color: var(--primary-dark); }
.article-content p { margin: 10px 0; }
.article-content ul, .article-content ol { margin: 10px 0; padding-left: 24px; }
.article-content li { margin: 4px 0; }
.article-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 10px 16px;
    margin: 16px 0;
    background: rgba(79,70,229,0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-light);
}
.article-content code {
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Fira Code', 'Consolas', monospace;
}
.article-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 12px 0;
}
.article-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}
.article-content th, .article-content td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}
.article-content th {
    background: var(--bg);
    font-weight: 600;
}
.article-content img { max-width: 100%; border-radius: var(--radius-sm); }
.article-content strong { font-weight: 700; }
.article-content a { color: var(--primary); text-decoration: underline; }

/* ===== Related ===== */
.related-articles { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.related-articles h3 { font-size: 20px; margin-bottom: 16px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.related-card {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    transition: var(--transition);
}
.related-card:hover { background: rgba(79,70,229,0.05); transform: translateY(-2px); }
.related-card h4 { font-size: 15px; margin-bottom: 6px; color: var(--text); }
.related-card p { font-size: 13px; color: var(--text-light); }

/* ===== Sidebar ===== */
.sidebar { display: flex; flex-direction: column; gap: 20px; }

.sidebar-widget {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.widget-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    color: var(--text);
}

.category-list { list-style: none; }
.category-list li { margin: 0; }
.category-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-size: 14px;
    transition: var(--transition);
}
.category-list a:hover {
    background: rgba(79,70,229,0.08);
    color: var(--primary);
    padding-left: 16px;
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud-item {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    background: var(--bg);
    color: var(--text-light);
    transition: var(--transition);
}
.tag-cloud-item:hover { background: var(--primary); color: white; }

.popular-list { list-style: none; }
.popular-list li { margin-bottom: 12px; }
.popular-list a { display: block; }
.popular-title {
    display: block;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 2px;
    line-height: 1.4;
}
.popular-views { font-size: 12px; color: var(--text-lighter); }

/* ===== Error Page ===== */
.error-page { text-align: center; padding: 60px 20px; }
.error-code { font-size: 80px; font-weight: 800; color: var(--primary); }
.error-page p { font-size: 18px; color: var(--text-light); margin: 10px 0 20px; }
.btn-back {
    display: inline-block;
    padding: 10px 28px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.btn-back:hover { background: var(--primary-dark); color: white; }

.empty-state { text-align: center; padding: 40px; color: var(--text-lighter); font-size: 16px; }

/* ===== Footer ===== */
.site-footer {
    background: #1e1b4b;
    color: rgba(255,255,255,0.7);
    padding: 30px 0;
    margin-top: 40px;
}

.site-footer p { text-align: center; font-size: 14px; margin-bottom: 8px; }

.footer-links { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: rgba(255,255,255,0.7); }
.footer-links a:hover { color: white; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .content-wrapper { grid-template-columns: 1fr; }
    .featured-grid { grid-template-columns: 1fr; }
    .related-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .main-nav {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: var(--primary-dark);
        flex-direction: column;
        padding: 10px;
        gap: 2px;
    }
    body.nav-open .main-nav { display: flex; }
    .search-form input { width: 120px; }
    .header-inner { padding: 12px 16px; }
    .single-article { padding: 20px; }
    .article-h1 { font-size: 22px; }
    .user-menu { order: -1; width: 100%; justify-content: flex-end; }
}

/* ===== User Menu ===== */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-menu-link {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.user-menu-link:hover { color: white; background: rgba(255,255,255,0.15); }

.user-menu-register {
    background: rgba(255,255,255,0.2);
    font-weight: 600;
}

.user-menu-user {
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    font-weight: 600;
    padding: 4px 10px;
    background: rgba(255,255,255,0.12);
    border-radius: var(--radius-sm);
}

/* ===== Article Actions (Like/Favorite) ===== */
.article-actions {
    display: flex;
    gap: 16px;
    margin: 28px 0;
    padding: 20px 0;
    border-top: 2px solid var(--border);
    border-bottom: 2px solid var(--border);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: 2px solid var(--border);
    border-radius: 30px;
    background: var(--bg-card);
    cursor: pointer;
    font-size: 15px;
    color: var(--text-light);
    transition: var(--transition);
}

.action-btn:hover { border-color: var(--primary); color: var(--primary); }

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

.action-btn.active .action-icon { transform: scale(1.2); }

.action-icon { font-size: 18px; transition: transform 0.2s; }
.action-count {
    background: rgba(0,0,0,0.08);
    padding: 1px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}
.action-btn.active .action-count { background: rgba(255,255,255,0.25); }

/* ===== Comments Section ===== */
.comments-section { margin-top: 32px; }

.comments-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

.comment-form-box {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
}

.comment-input {
    width: 100%;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    transition: var(--transition);
}

.comment-input:focus { outline: none; border-color: var(--primary); }

.comment-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.char-count { font-size: 12px; color: var(--text-lighter); }

.btn-comment-submit {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-comment-submit:hover { background: var(--primary-dark); }

.comment-login-hint {
    text-align: center;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius);
    color: var(--text-light);
    margin-bottom: 24px;
}

.comment-login-hint a { font-weight: 600; }

.comments-list { display: flex; flex-direction: column; gap: 16px; }

.comment-item {
    display: flex;
    gap: 12px;
}

.comment-item.reply { margin-top: 16px; }

.comment-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.comment-body {
    flex: 1;
    min-width: 0;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.comment-author { font-weight: 600; font-size: 14px; color: var(--text); }
.comment-time { font-size: 12px; color: var(--text-lighter); }
.comment-text { font-size: 14px; line-height: 1.6; color: var(--text); word-wrap: break-word; }

.comment-footer { display: flex; gap: 12px; margin-top: 8px; }

.comment-reply-btn, .comment-delete-btn {
    background: none;
    border: none;
    color: var(--text-lighter);
    font-size: 13px;
    cursor: pointer;
    padding: 2px 4px;
    transition: var(--transition);
}

.comment-reply-btn:hover { color: var(--primary); }
.comment-delete-btn:hover { color: #e53e3e; }

.comment-replies {
    margin-top: 12px;
    padding-left: 16px;
    border-left: 3px solid var(--border);
}

/* ===== Auth Pages (Register/Login) ===== */
.auth-page {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
}

.auth-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
}

.auth-form .form-group { margin-bottom: 16px; }

.auth-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.auth-form input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: var(--transition);
}

.auth-form input:focus { outline: none; border-color: var(--primary); }

.form-error {
    color: #e53e3e;
    font-size: 14px;
    min-height: 20px;
    margin-bottom: 8px;
}

.btn-auth {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-auth:hover { background: var(--primary-dark); }
.btn-auth:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-light);
}

.auth-separator { margin: 0 8px; color: var(--text-lighter); }

/* ===== Favorites Page ===== */
.favorite-meta {
    font-size: 12px;
    color: var(--text-lighter);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}
