/**
 * @file main.css
 * @description 博客网站的简约风格全局样式
 */

/* 全局样式 */
:root {
    --primary-color: #4a90e2;
    --primary-dark: #357abd;
    --text-color: #333;
    --text-secondary: #666;
    --bg-primary: #fff;
    --bg-secondary: #f5f5f5;
    --border-color: #e0e0e0;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 暗色主题 */
.dark-mode {
    --text-color: #e0e0e0;
    --text-secondary: #a0a0a0;
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --border-color: #404040;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-primary);
}

/* 导航栏样式 */
.navbar {
    background: var(--bg-primary);
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.logo:hover {
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.3rem;
    transition: all 0.3s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: all 0.3s;
    transform: translateX(-50%);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 80%;
}

.nav-links a:hover {
    color: var(--primary-color);
    background: var(--bg-secondary);
}

.nav-links a.active {
    color: var(--primary-color);
}

/* 导航下拉菜单样式 */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-primary);
    min-width: 160px;
    box-shadow: var(--shadow);
    border-radius: 0.3rem;
    z-index: 1000;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
}

.nav-dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-content a {
    color: var(--text-color);
    padding: 0.8rem 1rem;
    text-decoration: none;
    display: block;
    transition: all 0.3s;
}

.dropdown-content a:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.dropdown-content a.active {
    background: var(--primary-color);
    color: white;
}

/* 主题切换按钮样式 */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 0.3rem;
    transition: all 0.3s;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* 响应式导航栏 */
@media (max-width: 768px) {
    .navbar .container {
        padding: 1rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        box-shadow: var(--shadow);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        width: 100%;
        text-align: center;
    }

    .dropdown-content {
        position: static;
        box-shadow: none;
        margin-top: 0.5rem;
    }

    .nav-dropdown:hover .dropdown-content {
        display: none;
    }

    .nav-dropdown.active .dropdown-content {
        display: block;
    }
}

/* 页面切换动画 */
.page-transition {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 留言标签页样式 */
.message-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.message-tab {
    padding: 0.5rem 1rem;
    border-radius: 0.3rem;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
}

.message-tab.active {
    background: var(--primary-color);
    color: white;
}

.message-tab:hover:not(.active) {
    background: var(--bg-secondary);
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 80px auto 0;
    padding: 2rem;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

/* 卡片样式 */
.card {
    background: var(--bg-primary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

/* 文章列表样式 */
.article-list {
    display: grid;
    gap: 2rem;
}

.article-item {
    background: var(--bg-primary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.article-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.article-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* 标签样式 */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    background: var(--bg-secondary);
    color: var(--text-color);
    padding: 0.3rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.9rem;
}

/* 页脚样式 */
.footer {
    background: var(--bg-secondary);
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary-color);
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow);
    display: none;
}

.back-to-top:hover {
    background: var(--primary-dark);
}

/* 链接样式 */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #0051a8;
}

/* 卡片样式 */
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* 文章列表 */
.article-list .card {
  margin-bottom: 1.5em;
}

.article-list h2 {
  margin-top: 0;
  margin-bottom: 0.5em;
}

.article-content {
  line-height: 1.8;
}

.article-content h2 {
  margin-top: 2em;
  margin-bottom: 1em;
  font-size: 1.5em;
}

.article-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.8em;
  font-size: 1.2em;
}

.article-content p {
  margin-bottom: 1.2em;
}

.article-content pre {
  background: #f6f8fa;
  padding: 1em;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1em 0;
}

.article-content code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
  font-size: 0.9em;
}

/* 评论区样式 */
.comment-form {
  margin-bottom: 2em;
}

.comment-form textarea {
  width: 100%;
  min-height: 100px;
  padding: 1em;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 1em;
  resize: vertical;
}

.comment {
  border-bottom: 1px solid var(--border-color);
  padding: 1em 0;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5em;
}

.comment-author {
  font-weight: 500;
}

.comment-date {
  color: var(--text-secondary);
  font-size: 0.9em;
}

/* 按钮样式 */
button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5em 1em;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

button:hover {
  background: #0051a8;
}

.btn-like, .btn-share {
  margin-right: 1em;
}

/* 关于页面样式 */
.about-section {
  margin-bottom: 2em;
}

.about-section h3 {
  margin-bottom: 1em;
  color: var(--text-color);
}

.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2em;
}

.skill-category h4 {
  margin-bottom: 0.8em;
  color: var(--text-color);
}

.contact-list {
  list-style: none;
  padding: 0;
}

.contact-list li {
  margin-bottom: 0.8em;
}

/* 归档页面样式 */
.archive-list {
  margin-top: 1em;
}

.archive-item {
  display: flex;
  align-items: center;
  padding: 0.8em 0;
  border-bottom: 1px solid var(--border-color);
}

.archive-date {
  color: var(--text-secondary);
  margin-right: 1em;
  min-width: 60px;
}

.archive-category {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 0.9em;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  
  aside {
    min-width: 100%;
  }
  
  nav {
    padding: 1em;
  }
  
  nav a {
    font-size: 1em;
  }

  .skills {
    grid-template-columns: 1fr;
  }
}

/* 工具类 */
.text-center { text-align: center; }
.mt-1 { margin-top: 1em; }
.mb-1 { margin-bottom: 1em; }
.mb-2 { margin-bottom: 2em; } 