/* 全局重置与基础设置 */
* {
    margin: 0;  /* 补全你缺失的margin:0 */
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.7;
    color: #333;
    background-color: #f8fafc;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0 !important;  /* 强制消除body默认边距 */
    padding: 0 !important;
}

/* 容器与布局 - 核心修复：消除左右白边 */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;  /* 确保容器铺满宽度 */
}

/* 顶部导航栏 - 修复顶部/左右白边+优化浮动 */
.site-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100vw !important;  /* 导航栏铺满屏幕宽度，消除左右白边 */
    margin: 0 !important;     /* 消除导航栏默认边距 */
    left: 0;                  /* 强制对齐左侧 */
}

.site-header .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 800px;  /* 内容仍限制宽度，视觉居中 */
}

.site-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.site-header h1 a {
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.site-header h1 a:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.site-description {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;  /* 修复你缺失的字体权重值 */
    max-width: 600px;
}

/* 主要内容区域 - 修复导航遮挡 */
main.container {
    padding: 4rem 0 2.5rem;  /* 增加顶部内边距，避开浮动导航 */
    margin: 0 auto;
    width: 100%;
    max-width: 800px;
}

.welcome-section {
    text-align: center;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.welcome-section h2 {
    font-size: 2rem;
    color: #2d3748;
    margin-bottom: 1rem;
    font-weight: 600;
}

.welcome-section p {
    color: #718096;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* 文章列表样式 - 现代卡片设计 */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.post-summary {
    background: white;
    border-radius: 12px;
    padding: 1.8rem;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid #e2e8f0;
}

.post-summary:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
    border-color: #cbd5e0;
}

.post-summary h3 {
    margin-bottom: 0.6rem;
}

.post-summary h3 a {
    color: #2d3748;
    text-decoration: none; /* 移除标题链接下划线 */
    font-size: 1.5rem;
    font-weight: 600;
    transition: color 0.2s ease;
    display: inline-block;
}

.post-summary h3 a:hover {
    color: #4299e1;
}

/* 文章元信息 - 更精致的日期显示 */
.post-meta {
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-meta time {
    background: #edf2f7;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* 文章摘要 */
.post-excerpt {
    color: #4a5568;
    margin-bottom: 1.2rem;
    font-size: 1rem;
    line-height: 1.6;
}

/* 阅读全文链接 - 美化按钮样式 */
.read-more {
    display: inline-flex;
    align-items: center;
    color: #4299e1;
    text-decoration: none; /* 移除默认下划线 */
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.5rem 0;
    position: relative;
    transition: all 0.2s ease;
}

.read-more:after {
    content: '→';
    margin-left: 0.4rem;
    transition: transform 0.2s ease;
}

.read-more:hover {
    color: #3182ce;
}

.read-more:hover:after {
    transform: translateX(4px);
}

/* 悬停时的下划线效果 - 更优雅 */
.read-more::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #4299e1, #667eea);
    transition: width 0.3s ease;
}

.read-more:hover::before {
    width: 100%;
}

/* 无文章时的提示样式 */
.no-posts {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.no-posts p {
    color: #718096;
    font-size: 1.1rem;
}

/* 页脚样式 */
.site-footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
    color: #a0aec0;
    font-size: 0.9rem;
    border-top: 1px solid #e2e8f0;
    width: 100%;  /* 页脚铺满宽度 */
}

/* 移动端适配 */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .site-header {
        padding: 1.2rem 0;
        width: 100vw !important;  /* 移动端导航栏也铺满 */
    }
    
    .site-header h1 {
        font-size: 1.8rem;
    }
    
    /* 移动端内容区适配 */
    main.container {
        padding: 3rem 0 2.5rem;
    }
    
    .post-summary {
        padding: 1.4rem;
    }
    
    .welcome-section h2 {
        font-size: 1.6rem;
    }
}

/* 暗色模式支持（可选） */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a202c;
        color: #e2e8f0;
    }
    
    .post-summary, .no-posts {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .post-summary h3 a {
        color: #e2e8f0;
    }
    
    .post-excerpt {
        color: #cbd5e0;
    }
    
    .post-meta time {
        background: #4a5568;
        color: #cbd5e0;
    }
}

/* ======================
   文章详情页样式 - 核心修复
   ====================== */
.post-detail {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    margin-bottom: 3rem;
    margin-top: 1rem;  /* 增加顶部间距，防导航遮挡 */
}

.post-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1.5rem;
}

.post-header h1 {
    font-size: 2.2rem;
    color: #2d3748;
    margin-bottom: 1rem;
    line-height: 1.3;
}

/* 视频播放器适配 - 解决小屏显示不全 */
.video-container {
    margin: 2.5rem 0;
    text-align: center;
    position: relative;
    padding-top: 10px;
}

.video-container video {
    max-width: 100%;
    max-height: 75vh;  /* 限制视频最大高度，适配小屏 */
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #4a5568;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    margin: 1.8rem 0 1rem;
    color: #2d3748;
}

.post-content h2 {
    font-size: 1.8rem;
}

.post-content h3 {
    font-size: 1.5rem;
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
    margin: 1.5rem 0;
    padding-left: 1.8rem;
}

.post-content li {
    margin-bottom: 0.8rem;
}

.post-content blockquote {
    border-left: 4px solid #4299e1;
    background: #f8fafc;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #4a5568;
}

.post-content pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 1.2rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.post-content code {
    background: #edf2f7;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.back-to-home {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.back-to-home a {
    color: #4299e1;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s ease;
}

.back-to-home a:hover {
    color: #3182ce;
}

.back-to-home a::before {
    content: '←';
    margin-right: 0.5rem;
}

/* 移动端详情页适配 */
@media (max-width: 768px) {
    .post-detail {
        padding: 1.5rem;
        margin-top: 0.5rem;
    }
    
    .post-header h1 {
        font-size: 1.8rem;
    }
    
    .post-content {
        font-size: 1rem;
    }
    
    /* 移动端视频适配 */
    .video-container video {
        max-height: 60vh;
    }
}

/* 超小屏视频适配 */
@media (max-width: 480px) {
    .video-container video {
        max-height: 50vh;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .post-detail {
        background: #2d3748;
        box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    }
    
    .post-header {
        border-color: #4a5568;
    }
    
    .post-header h1 {
        color: #e2e8f0;
    }
    
    .post-content {
        color: #cbd5e0;
    }
    
    .post-content h2,
    .post-content h3,
    .post-content h4 {
        color: #e2e8f0;
    }
    
    .post-content blockquote {
        background: #1a202c;
        border-color: #667eea;
    }
    
    .post-content code {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .back-to-home {
        border-color: #4a5568;
    }
}

/* ======================
   用户认证页面样式（登录/注册）
   ====================== */
.auth-container {
    max-width: 400px;
    margin: 80px auto;
    padding: 2.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

.auth-container h2 {
    text-align: center;
    color: #2d3748;
    margin-bottom: 2rem;
    font-size: 1.8rem;
    font-weight: 600;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #4a5568;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.form-group input:focus {
    outline: none;
    border-color: #4299e1;
    background: white;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.auth-btn {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    color: #718096;
}

.auth-links a {
    color: #4299e1;
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* 消息提示样式 */
.auth-message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    text-align: center;
}

.auth-message.success {
    background: #f0fff4;
    color: #2d7d32;
    border: 1px solid #9ae6b4;
}

.auth-message.error {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #fc8181;
}

/* 移动端认证页面适配 */
@media (max-width: 768px) {
    .auth-container {
        margin: 40px auto;
        padding: 1.5rem;
        border-radius: 10px;
        border: none;
        box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    }
    
    .auth-container h2 {
        font-size: 1.5rem;
    }
}

/* ======================
   注册页面特定样式
   ====================== */
/* 表单提示文字样式 */
.form-hint {
    display: block;
    margin-top: 0.25rem;
    color: #718096;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* 密码强度指示器 */
.password-strength {
    margin-top: 0.5rem;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
}

.strength-weak {
    background: #e53e3e;
    width: 33%;
}

.strength-medium {
    background: #dd6b20;
    width: 66%;
}

.strength-strong {
    background: #38a169;
    width: 100%;
}

/* 表单验证状态 */
.form-group input:valid {
    border-color: #38a169;
}

.form-group input:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #e53e3e;
}

/* 注册页面特定布局 */
.register-features {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
}

.register-features h3 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.register-features ul {
    list-style: none;
    padding: 0;
}

.register-features li {
    padding: 0.5rem 0;
    color: #4a5568;
    display: flex;
    align-items: center;
}

.register-features li:before {
    content: "✓";
    color: #38a169;
    font-weight: bold;
    margin-right: 0.5rem;
}