* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.2s;
}

:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --text: #333;
    --text-light: #555;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --theme-toggle-bg: #1e1e1e;
    --header-bg: #ffffff;
    --footer-bg: #f1f3f5;
    --border: #e9ecef;
    --shadow: rgba(0, 0, 0, 0.05);
}

.dark-mode {
    --primary: #4895ef;
    --primary-dark: #3a7bc8;
    --text: #e9ecef;
    --text-light: #adb5bd;
    --bg: #121212;
    --card-bg: #1e1e1e;
    --theme-toggle-bg: #ffffff;
    --header-bg: #1a1a1a;
    --footer-bg: #0d0d0d;
    --border: #2d2d2d;
    --shadow: rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

/* 头部样式 */
header {
    background-color: var(--header-bg);
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5px;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    position: relative;
}

.nav-links a:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: width 0.3s;
}

.nav-links a:hover:after {
    width: 100%;
}

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

.theme-toggle {
    background: var(--theme-toggle-bg);
    border: 1px solid var(--border);
    border-radius: 30px;
    width: 60px;
    height: 30px;
    position: relative;
    cursor: pointer;
}

.toggle-circle {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    transition: transform 0.3s;
}

.dark-mode .toggle-circle {
    transform: translateX(30px);
}

/* 幻灯片区域 */
.hero {
    padding: 80px 0;
    text-align: center;
    background: linear-gradient(135deg, var(--primary), #3a0ca3);
    color: white;
    border-radius: 20px;
}

.hero h1 {
    font-size: 2.8rem;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 30px;
    opacity: 0.9;
}

.btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s;
}

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

/* 博客文章网格 */
.blog-grid-title {
    padding-top: 10px;
    padding-bottom: 15px;
    width: 100%;
    display: flex;
    justify-content: space-between; /* 左右分布 */
}

.blog-grid-title a {
    text-decoration: none;
}

.blog-grid-title-text {
    color: var(--text);
}

.blog-grid-title-btn {
    color: var(--text-light);
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(345px, 1fr));
    gap: 30px;
    margin-bottom: 10px;
}

.blog-card {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px var(--shadow);
    transition: transform 0.3s;
}

.blog-card:hover {
    transform: translateY(-10px);
}

.card-img {
    width: 100%;
    height: 245px;
    object-fit: cover;
}

.card-content {
    padding: 25px;
}

.card-content h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.card-content .card-text {
    color: var(--text-light);
    margin-bottom: 20px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-light);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    padding-top: 15px;
}

.card-meta a {
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
}

.tag {
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-block;
    margin-bottom: 15px;
}

.card-title {
    display: -webkit-box; /* 设置为WebKit内核的弹性盒子模型 */
    -webkit-box-orient: vertical; /* 垂直排列 */
    -webkit-line-clamp: 1; /* 限制显示两行 */
    overflow: hidden; /* 隐藏超出范围的内容 */
    text-overflow: ellipsis;
}

.card-intro {
    display: -webkit-box; /* 设置为WebKit内核的弹性盒子模型 */
    -webkit-box-orient: vertical; /* 垂直排列 */
    -webkit-line-clamp: 2; /* 限制显示两行 */
    overflow: hidden; /* 隐藏超出范围的内容 */
    text-overflow: ellipsis;
    height: 3em;
}

/* 侧边栏 */
.sidebar {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px var(--shadow);
    margin-bottom: 30px;
}

.sidebar h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

.categories a {
    display: block;
    padding: 10px 0;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}

.categories a:hover {
    color: var(--primary);
}

.popular-posts .post {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.popular-posts img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 10px;
}

/* 页脚 */
footer {
    background: var(--footer-bg);
    padding: 50px 0 20px;
    margin-top: 10px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.footer-col h4 {
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.footer-links a {
    display: block;
    color: var(--text-light);
    text-decoration: none;
    margin-bottom: 10px;
}

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

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: transform 0.3s;
}

.social-links a:hover {
    transform: translateY(-5px);
}

.copyright {
    text-align: center;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: 0.9rem;
}

.copyright-fixed {
    width: 100%;
    position: fixed;
    bottom: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .theme-toggle-max {
        display: none;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .header-container {
        padding: 15px 8px;
    }
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
}

.mobile-nav {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background: var(--card-bg);
    z-index: 1000;
    padding: 20px;
    transition: right 0.3s;
    box-shadow: -5px 0 15px var(--shadow);
}

.mobile-nav.active {
    right: 0;
}

.close-menu {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    position: absolute;
    top: 20px;
    right: 20px;
    cursor: pointer;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.mobile-nav-links a {
    color: var(--text);
    text-decoration: none;
    font-size: 1.2rem;
    padding: 10px;
    border-radius: 5px;
}

.mobile-nav-links a:hover {
    background: var(--primary);
    color: white;
}

.form-input-text {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    margin-bottom: 10px;
}

.form-btn {
    width: 100%;
}

.cursor-pointer {
    cursor: pointer;
}

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

.spin-load {
    animation: spin 2s linear infinite;
}


.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    overflow: hidden;
    transform: translateY(50px);
    opacity: 0;
    transition: all 0.4s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
    opacity: 1;
}

.modal-header {
    padding: 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s;
    color: var(--text-light);
}

.close-btn:hover {
    color: var(--text);
}

.modal-body {
    padding: 20px;
    line-height: 1.6;
}

.modal-text {
    margin-bottom: 20px;
    color: var(--text);
    font-size: 1.1rem;
}

.modal-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.modal-btn-cancel {
    background: #e9ecef;
    color: #495057;
}

.modal-btn-cancel:hover {
    background: #dee2e6;
}

.modal-btn-confirm {
    background: #4361ee;
    color: white;
}

.modal-btn-confirm:hover {
    background: #3a56d4;
}