/* 博客页面样式 - 二次元风格 */

/* 樱花飘落效果 */
#sakura-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.sakura {
    position: absolute;
    top: -20px;
    animation: sakura-fall linear forwards;
}

@keyframes sakura-fall {
    0% {
        transform: translateY(0) rotate(0deg) translateX(0);
    }
    25% {
        transform: translateY(25vh) rotate(90deg) translateX(20px);
    }
    50% {
        transform: translateY(50vh) rotate(180deg) translateX(-20px);
    }
    75% {
        transform: translateY(75vh) rotate(270deg) translateX(20px);
    }
    100% {
        transform: translateY(110vh) rotate(360deg) translateX(-20px);
    }
}

/* 天体和星空效果 */
.sky-body {
    position: fixed;
    top: 10%;
    right: 20%;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    animation: move-body 10s infinite alternate ease-in-out;
    z-index: -1;
}

@keyframes move-body {
    0% { transform: translateX(-20px); }
    100% { transform: translateX(20px); }
}

.sun {
    background: radial-gradient(circle, #ffdd85 40%, #ffa726 90%);
    box-shadow: 0 0 30px 10px #ffc107, 0 0 60px 30px rgba(255, 223, 130, 0.6);
}

.moon {
    background: radial-gradient(circle, #fffae3 60%, #e6e6e6 100%);
    box-shadow: 0 0 15px #ffefa0, 0 0 30px #ffc107;
}

/* 星空背景 */
.star {
    position: absolute;
    background: #ffd700;
    border-radius: 50%;
    animation: twinkle 3s infinite ease-in-out;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

/* 博客头部 */
.blog-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(255, 107, 157, 0.15);
    border-bottom: 2px solid #ffd6e0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.blog-title {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #ff6b9d, #ff8fab);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.back-btn, .new-post-btn {
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
}

.new-post-btn {
    background: linear-gradient(135deg, #ff6b9d, #ff8fab);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
}

.new-post-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.4);
}

/* 主内容区 */
.blog-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px 20px 40px;
    min-height: 100vh;
}

/* 文章列表 */
.posts-list {
    animation: fadeIn 0.5s ease;
}

.posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
    position: relative;
    z-index: 10;
}

.posts-header h2 {
    font-size: 1.8rem;
    color: #ff6b9d;
    margin: 0;
}

.search-box {
    position: relative;
    width: 300px;
    z-index: 10;
}

.search-box input {
    width: 100%;
    padding: 12px 45px 12px 20px;
    border: 2px solid #ffd6e0;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.95);
}

.search-box input:focus {
    border-color: #ff6b9d;
    box-shadow: 0 0 15px rgba(255, 107, 157, 0.2);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

/* 文章卡片容器 */
.posts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    position: relative;
    z-index: 1;
}

/* 文章卡片 */
.post-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    border: 2px solid #ffd6e0;
    box-shadow: 0 8px 30px rgba(255, 107, 157, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b9d, #ff8fab, #ffc3d4);
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(255, 107, 157, 0.2);
    border-color: #ff6b9d;
}

.post-card-title {
    font-size: 1.4rem;
    color: #333;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.post-card-excerpt {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #888;
}

.post-card-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-card-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    background: linear-gradient(135deg, #fff0f3, #ffe0e6);
    color: #ff6b9d;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
}

/* 加载动画 */
.loading-anime {
    text-align: center;
    padding: 60px;
    color: #ff6b9d;
    font-size: 1.2rem;
}

.loading-dots span {
    animation: loadingDots 1.4s infinite;
    display: inline-block;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #888;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: #ff6b9d;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 20px;
}

/* 文章详情 */
.post-detail {
    animation: fadeIn 0.5s ease;
}

.post-detail.hidden,
.post-editor.hidden,
.modal.hidden {
    display: none;
}

.post-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 10px 20px;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.delete-btn {
    background: linear-gradient(135deg, #ff6b6b, #ff8787);
    color: white;
}

.delete-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
}

.save-btn {
    background: linear-gradient(135deg, #6bff9d, #8bffab);
    color: #1a5a3a;
}

.save-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(107, 255, 157, 0.3);
}

/* Markdown内容样式 */
.post-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    border: 2px solid #ffd6e0;
    box-shadow: 0 8px 30px rgba(255, 107, 157, 0.1);
    line-height: 1.8;
}

.post-content h1 {
    font-size: 2.2rem;
    color: #ff6b9d;
    border-bottom: 3px solid #ffd6e0;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.post-content h2 {
    font-size: 1.8rem;
    color: #ff8fab;
    margin-top: 35px;
    margin-bottom: 20px;
}

.post-content h3 {
    font-size: 1.4rem;
    color: #ffa8c0;
    margin-top: 25px;
    margin-bottom: 15px;
}

.post-content p {
    margin-bottom: 16px;
    color: #444;
}

.post-content a {
    color: #ff6b9d;
    text-decoration: none;
    border-bottom: 1px dashed #ff6b9d;
}

.post-content a:hover {
    border-bottom-style: solid;
}

.post-content code {
    background: #fff0f3;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    color: #e83e8c;
    font-size: 0.9em;
}

.post-content pre {
    background: #fafafa;
    border: 1px solid #ffd6e0;
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
}

.post-content pre code {
    background: none;
    padding: 0;
    color: #333;
}

.post-content blockquote {
    border-left: 4px solid #ff6b9d;
    margin: 20px 0;
    padding: 15px 20px;
    background: #fff8fa;
    border-radius: 0 12px 12px 0;
    color: #666;
}

.post-content ul, .post-content ol {
    margin: 15px 0;
    padding-left: 25px;
}

.post-content li {
    margin-bottom: 8px;
}

.post-content img {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.post-content th, .post-content td {
    border: 1px solid #ffd6e0;
    padding: 12px;
    text-align: left;
}

.post-content th {
    background: #fff0f3;
    color: #ff6b9d;
}

/* 文章元数据 */
.post-meta {
    margin-top: 30px;
    padding: 20px;
    background: #fff8fa;
    border-radius: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* 评论区 */
.comment-section {
    margin-top: 40px;
}

.comment-section h3 {
    font-size: 1.5rem;
    color: #ff6b9d;
    margin-bottom: 20px;
}

#gitalk-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    border: 2px solid #ffd6e0;
}

/* 文章编辑器 */
.post-editor {
    animation: fadeIn 0.5s ease;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.editor-header h2 {
    font-size: 1.8rem;
    color: #ff6b9d;
    margin: 0;
}

.editor-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.editor-form {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    border: 2px solid #ffd6e0;
    box-shadow: 0 8px 30px rgba(255, 107, 157, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 1rem;
    color: #ff6b9d;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 18px;
    border: 2px solid #ffd6e0;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: #ff6b9d;
    box-shadow: 0 0 15px rgba(255, 107, 157, 0.2);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 0.85rem;
}

.form-group small a {
    color: #ff6b9d;
}

.editor-container {
    display: flex;
    gap: 20px;
    min-height: 500px;
}

.editor-pane, .preview-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-pane label, .preview-pane label {
    font-size: 1rem;
    color: #ff6b9d;
    margin-bottom: 10px;
    font-weight: 500;
}

#markdown-editor {
    flex: 1;
    padding: 20px;
    border: 2px solid #ffd6e0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Consolas', monospace;
    resize: none;
    outline: none;
    line-height: 1.6;
    transition: all 0.3s ease;
}

#markdown-editor:focus {
    border-color: #ff6b9d;
    box-shadow: 0 0 15px rgba(255, 107, 157, 0.2);
}

#preview-content {
    flex: 1;
    padding: 20px;
    border: 2px solid #ffd6e0;
    border-radius: 12px;
    overflow-y: auto;
    background: #fafafa;
}

.preview-pane.hidden {
    display: none;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 25px;
    padding: 35px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(255, 107, 157, 0.3);
    border: 2px solid #ffd6e0;
}

.modal-content h2 {
    color: #ff6b9d;
    margin-bottom: 10px;
}

.modal-desc {
    color: #666;
    margin-bottom: 25px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 25px;
}

/* 设置按钮 */
.settings-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ff6b9d, #ff8fab);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 107, 157, 0.4);
    transition: all 0.3s ease;
    z-index: 99;
}

.settings-btn:hover {
    transform: rotate(90deg) scale(1.1);
}

/* 博客底部 */
.blog-footer {
    text-align: center;
    padding: 30px;
    color: #888;
    border-top: 2px solid #ffd6e0;
    margin-top: 60px;
}

/* 通知提示 */
.toast {
    position: fixed;
    top: 100px;
    right: 30px;
    padding: 15px 25px;
    border-radius: 15px;
    color: white;
    font-size: 1rem;
    z-index: 1001;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.toast.success {
    background: linear-gradient(135deg, #6bff9d, #4ecdc4);
}

.toast.error {
    background: linear-gradient(135deg, #ff6b6b, #ff8787);
}

.toast.info {
    background: linear-gradient(135deg, #6b9dff, #8fabff);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 夜间模式 */
body.night .blog-header {
    background: rgba(26, 26, 58, 0.95);
    border-bottom-color: #6a6aaa;
}

body.night .blog-title {
    background: linear-gradient(135deg, #a8a8ff, #c8c8ff);
    -webkit-background-clip: text;
    background-clip: text;
}

body.night .post-card,
body.night .post-content,
body.night .editor-form,
body.night #gitalk-container {
    background: rgba(26, 26, 58, 0.95);
    border-color: #6a6aaa;
}

body.night .post-card-title,
body.night .post-content h1,
body.night .post-content h2,
body.night .post-content h3 {
    color: #c8c8ff;
}

body.night .post-card-excerpt,
body.night .post-content p {
    color: #b0b0d0;
}

body.night .search-box input,
body.night .form-group input,
body.night #markdown-editor {
    background: rgba(42, 42, 74, 0.8);
    border-color: #6a6aaa;
    color: #e0e0ff;
}

body.night .posts-header h2,
body.night .editor-header h2,
body.night .comment-section h3,
body.night .form-group label {
    color: #a8a8ff;
}

body.night .tag {
    background: linear-gradient(135deg, #3a3a6a, #4a4a8a);
    color: #a8a8ff;
}

body.night .modal-content {
    background: #1a1a3a;
    border-color: #6a6aaa;
}

body.night .modal-content h2 {
    color: #a8a8ff;
}

body.night .modal-desc {
    color: #a0a0c0;
}

body.night #preview-content {
    background: #2a2a4a;
    border-color: #6a6aaa;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .blog-main {
        padding-top: 180px;
    }

    .posts-container {
        grid-template-columns: 1fr;
    }

    .editor-container {
        flex-direction: column;
    }

    .post-actions,
    .editor-actions {
        justify-content: center;
    }

    .search-box {
        width: 100%;
    }

    .post-content {
        padding: 20px;
    }
}
