/* ==========================================
   Cassian Theme - Deep Optimized CSS
========================================== */

:root {
    /* 颜色系统 */
    --bg-color: #f0f2f5;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --accent-color: #3498db;
    --accent-hover: #2980b9;
    
    /* 边框与阴影 */
    --border-radius: 16px;
    --shadow-light: 0 8px 30px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 15px 35px rgba(52, 152, 219, 0.12);
    
    /* 动画 */
    --transition-fast: all 0.3s ease;
    --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 基础重置 */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

html {
    scroll-behavior: smooth; 
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a { 
    text-decoration: none; 
    color: var(--accent-color); 
    transition: var(--transition-fast); 
}
a:hover, a:focus { 
    color: var(--accent-hover); 
    outline: none;
}

/* 自定义滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-color); }

/* ================= 整体布局 ================= */
.container {
    display: flex;
    max-width: 1200px;
    margin: 50px auto;
    padding: 0 20px;
    gap: 30px;
    min-height: 85vh;
}

/* ================= 左侧边栏 ================= */
.sidebar { 
    width: 300px; 
    flex-shrink: 0; 
}

.profile-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
    position: sticky;
    top: 50px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.profile-banner { 
    height: 120px; 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
}

.profile-avatar { 
    width: 90px; 
    height: 90px; 
    border-radius: 50%; 
    margin: -45px auto 15px; 
    background: #fff; 
    border: 4px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    background-size: cover;
    background-position: center;
}

.profile-info { padding: 0 25px 25px; text-align: center; }
.profile-name { font-size: 1.6em; font-weight: 700; color: #1a252f; margin-bottom: 5px; }
.profile-bio { font-size: 0.9em; color: var(--text-muted); margin-bottom: 20px; }

/* 状态与功能模块 */
.status-box {
    background: rgba(52, 152, 219, 0.05);
    border-left: 3px solid var(--accent-color);
    padding: 12px;
    border-radius: 4px 8px 8px 4px;
    font-size: 0.85em;
    text-align: left;
    margin-bottom: 20px;
    color: #555;
    line-height: 1.6;
}

.tags-container { 
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px;
}
.tag {
    background: #f8f9fa; padding: 6px 14px; border-radius: 20px;
    font-size: 0.8em; color: var(--text-main); border: 1px solid #e9ecef;
    transition: var(--transition-fast);
}
.tag:hover { 
    background: var(--accent-color); color: #fff; border-color: var(--accent-color); transform: translateY(-2px);
}

/* 分类小工具 */
.categories-widget { padding: 0 25px 25px 25px; text-align: left; }
.widget-title {
    font-size: 1.1em; color: var(--text-main); margin-bottom: 15px;
    padding-bottom: 10px; border-bottom: 1px solid #eef2f5; font-weight: 600;
}
.widget-title i { color: var(--accent-color); margin-right: 8px; }
.category-list { list-style: none; }
.category-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px dashed #eef2f5; transition: var(--transition-fast);
}
.category-item:last-child { border-bottom: none; }
.category-item a { color: var(--text-main); font-size: 0.95em; }
.category-item a:hover { color: var(--accent-color); padding-left: 6px; }
.category-count {
    background: #f0f2f5; padding: 2px 8px; border-radius: 12px;
    font-size: 0.8em; color: var(--text-muted);
}

/* ================= 搜索框 UI 优化 ================= */
.search-form {
    position: relative;
    margin: 25px 0;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 42px; 
    font-size: 0.95em;
    color: var(--text-main);
    background: rgba(240, 242, 245, 0.7); 
    border: 1.5px solid transparent; 
    border-radius: 24px; 
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
}

.search-input:hover {
    background: rgba(240, 242, 245, 0.9);
}

.search-input:focus {
    background: #ffffff;
    border-color: var(--accent-color); 
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15); 
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%); 
    color: #a0aec0;
    font-size: 1em;
    pointer-events: none; 
    transition: all 0.3s ease;
}

.search-input:focus + .search-icon {
    color: var(--accent-color);
}

/* ================= 右侧内容区 ================= */
.main-content { 
    flex-grow: 1; 
    width: calc(100% - 330px); 
}

.post-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    margin-bottom: 30px;
    transition: var(--transition-bounce);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    max-width: 100%;
    overflow: hidden;
}
.post-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }

.post-title { font-size: 1.9em; margin-bottom: 15px; font-weight: 700; line-height: 1.4; word-wrap: break-word;}
.post-title a { color: #2c3e50; }
.post-title a:hover { color: var(--accent-color); }

.post-meta { 
    color: var(--text-muted); font-size: 0.9em; margin-bottom: 20px; 
    display: flex; gap: 15px; flex-wrap: wrap;
}
.post-meta i { margin-right: 5px; color: var(--accent-color); }

/* ================= 文章内部排版 ================= */
.post-content { 
    font-size: 1.05em; 
    color: #334155; 
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.post-content img, .post-content video, .post-content iframe { 
    max-width: 100%; height: auto; border-radius: 8px; margin: 15px 0; display: block;
}

.post-content p { 
    margin-bottom: 18px; 
    text-indent: 2em; 
    line-height: 1.8; 
}

/* ================= 代码块与引用 ================= */
.post-content pre {
    background: #f1f5f9;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto; 
    margin: 15px 0;
    max-width: 100%;
}
.post-content code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #e83e8c;
    word-break: break-all; 
}
.post-content pre code {
    word-break: normal;
    white-space: pre;
    padding: 0;
}
.post-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding: 10px 15px; background: #f8fafc; color: #64748b; margin: 20px 0; border-radius: 0 8px 8px 0;
}

/* ================= 底部与悬浮控件 ================= */
.footer { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 0.9em; }
.admin-link {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 15px; padding: 10px 24px;
    background: #2c3e50; color: #fff !important; border-radius: 30px; font-weight: 600;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.2);
}
.admin-link:hover { background: var(--accent-color); transform: scale(1.05); }

.back-to-top {
    position: fixed; bottom: 30px; right: 30px; width: 45px; height: 45px;
    background: var(--accent-color); color: white; border-radius: 50%; display: flex; 
    justify-content: center; align-items: center; cursor: pointer; opacity: 0; 
    visibility: hidden; transition: var(--transition-fast); box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3); z-index: 99;
}
.back-to-top.show { opacity: 1; visibility: visible; }
.back-to-top:hover { background: #2980b9; transform: translateY(-5px); }

.back-home-btn {
    display: block; padding: 12px 20px; background: var(--accent-color); color: #fff !important;
    text-align: center; border-radius: var(--border-radius); font-weight: bold; 
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3); transition: var(--transition-fast);
}
.back-home-btn:hover { background: var(--accent-hover); transform: translateY(-3px); box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4); }

/* ================= 沉浸式阅读模式 ================= */
body.reading-mode .container {
    position: relative;
    display: flex;
    justify-content: center; 
}

body.reading-mode .main-content {
    width: 100%;
    max-width: 960px; 
    margin: 0 auto;
}

body.reading-mode .sidebar {
    width: auto; position: absolute; left: 0; top: 50px; z-index: 10;
}

body.reading-mode .profile-card {
    background: transparent; box-shadow: none; padding: 0;
    backdrop-filter: none; -webkit-backdrop-filter: none;
}

.back-home-btn.mini-btn {
    display: flex; align-items: center; gap: 8px; padding: 12px 20px;
    background: var(--card-bg); color: var(--text-main) !important;
    border-radius: 30px; box-shadow: var(--shadow-light); border: 1px solid #eef2f5;
}
.back-home-btn.mini-btn:hover { background: var(--accent-color); color: #fff !important; transform: translateX(-5px); }


/* ================= 响应式媒体查询 (移动端) ================= */
@media (max-width: 1100px) {
    body.reading-mode .sidebar { left: 10px; }
    body.reading-mode .btn-text { display: none; }
    .back-home-btn.mini-btn { padding: 15px; border-radius: 50%; }
}

@media (max-width: 850px) {
    .container { flex-direction: column; margin-top: 15px; padding: 0 15px; gap: 15px; }
    .sidebar, .main-content { width: 100%; }
    
    .profile-card { position: static; margin-bottom: 10px; }
    .search-form { margin: 15px 0; } /* 移动端紧凑化 */
    
    .post-card { padding: 20px; }
    .post-title { font-size: 1.5em; }
    
    body.reading-mode .sidebar { position: static; margin-bottom: 15px; }
    body.reading-mode .btn-text { display: inline; }
    .back-home-btn.mini-btn { padding: 10px 20px; border-radius: 30px; display: inline-flex; font-size: 0.9em; }
    
    .back-to-top { right: 15px; bottom: 15px; width: 40px; height: 40px; }
    .post-meta { gap: 10px; font-size: 0.85em; }
}