/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #0a192f;
    --secondary: #112240;
    --accent: #64ffda;
    --text: #ccd6f6;
    --text-light: #a8b2d1;
    --card: #172a45;
    --highlight: #233554;
    --success: #06d6a0;
    --danger: #ef476f;
    --warning: #ffd166;
}

body {
    background-color: var(--primary);
    color: var(--text);
    background-image: radial-gradient(circle at 10% 20%, rgba(17, 34, 64, 0.8) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(17, 34, 64, 0.8) 0%, transparent 20%);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 电路板纹理 */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(25, 55, 109, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 55, 109, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: -1;
}

/* 导航栏 */
.navbar {
    background-color: rgba(10, 25, 47, 0.95);
    backdrop-filter: blur(10px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(100, 255, 218, 0.1);
    transition: padding 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo i {
    color: var(--accent);
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent);
}

.nav-link::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* 移动端导航菜单 */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    background: var(--accent);
    color: var(--primary);
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 1001;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(100, 255, 218, 0.3);
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: var(--primary);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: right 0.4s ease-in-out;
    padding: 6rem 2rem 2rem;
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mobile-nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 1.2rem;
    padding: 0.8rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: block;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    color: var(--accent);
    background: rgba(100, 255, 218, 0.1);
    transform: translateX(5px);
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 博客详情页 */
.blog-detail {
    padding-top: 7rem;
    padding-bottom: 5rem;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 2rem;
}

.blog-header {
    text-align: center;
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeInUp 0.8s ease;
}

.blog-header h1 {
    font-size: 2.8rem;
    margin-bottom: 1.5rem;
    color: var(--text);
    line-height: 1.3;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.blog-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 1rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(17, 34, 64, 0.8) 0%, rgba(35, 53, 84, 0.6) 100%);
    border-radius: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(100, 255, 218, 0.1);
}

.meta-item:hover {
    background: linear-gradient(135deg, rgba(100, 255, 218, 0.15) 0%, rgba(100, 255, 218, 0.05) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(100, 255, 218, 0.2);
}

.card-tag {
    background: linear-gradient(135deg, var(--accent) 0%, #52e8c7 100%);
    color: var(--primary);
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-block;
    animation: pulse 2s infinite;
    box-shadow: 0 4px 15px rgba(100, 255, 218, 0.3);
    border: none;
}

/* Markdown容器 - 重构样式 */
.markdown-container {
    animation: fadeIn 0.8s ease;
}

#md-view {
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

/* 文章内容区域 */
.article-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

/* Editor.md样式覆盖 - 优化显示效果 */
.editormd-html-preview, .editormd-preview-container {
    padding: 0 !important;
    background: transparent !important;
    color: var(--text-light) !important;
    font-size: 1.1rem;
    line-height: 1.8;
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.editormd-html-preview h1,
.editormd-html-preview h2,
.editormd-html-preview h3,
.editormd-html-preview h4,
.editormd-html-preview h5,
.editormd-html-preview h6 {
    color: var(--text) !important;
    border-color: rgba(100, 255, 218, 0.3) !important;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.editormd-html-preview h1 {
    font-size: 2.2rem !important;
    margin: 3rem 0 1.5rem !important;
    border-bottom: 2px solid rgba(100, 255, 218, 0.3) !important;
    padding-bottom: 0.8rem !important;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.editormd-html-preview h2 {
    font-size: 1.8rem !important;
    margin: 2.5rem 0 1.3rem !important;
    color: var(--accent) !important;
}

.editormd-html-preview h3 {
    font-size: 1.5rem !important;
    margin: 2rem 0 1.1rem !important;
}

.editormd-html-preview p {
    margin-bottom: 1.5rem !important;
    text-align: justify;
    font-size: 1.1rem;
    line-height: 1.8;
}

.editormd-html-preview img {
    max-width: 100%;
    border-radius: 12px;
    margin: 2.5rem auto;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(100, 255, 218, 0.2);
    transition: all 0.3s ease;
    display: block;
}

.editormd-html-preview img:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 50px rgba(100, 255, 218, 0.3);
    border-color: rgba(100, 255, 218, 0.4);
}

.editormd-html-preview blockquote {
    border-left: 4px solid var(--accent) !important;
    padding: 1.5rem 2rem !important;
    background: linear-gradient(135deg, rgba(100, 255, 218, 0.08) 0%, rgba(100, 255, 218, 0.02) 100%) !important;
    color: var(--text) !important;
    border-radius: 0 12px 12px 0;
    margin: 2rem 0 !important;
    font-style: italic;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(100, 255, 218, 0.1);
}

.editormd-html-preview pre {
    background: linear-gradient(135deg, var(--secondary) 0%, rgba(17, 34, 64, 0.8) 100%) !important;
    padding: 1.8rem !important;
    border-radius: 12px !important;
    border: 1px solid rgba(100, 255, 218, 0.15) !important;
    overflow-x: auto;
    margin: 2rem 0 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.editormd-html-preview code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace !important;
    background: linear-gradient(135deg, rgba(100, 255, 218, 0.15) 0%, rgba(100, 255, 218, 0.05) 100%) !important;
    color: var(--accent) !important;
    border-radius: 6px;
    padding: 0.3rem 0.6rem !important;
    font-size: 0.95rem;
    border: 1px solid rgba(100, 255, 218, 0.1);
}

.editormd-html-preview pre code {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

/* 表格样式优化 */
.editormd-html-preview table {
    overflow: hidden;
    margin: 2.5rem 0;
    border-collapse: collapse;
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(100, 255, 218, 0.15);
}

.editormd-html-preview table th {
    background: linear-gradient(135deg, rgba(100, 255, 218, 0.2) 0%, rgba(100, 255, 218, 0.1) 100%) !important;
    color: var(--secondary) !important;
    font-weight: 600;
    padding: 15px 20px;
    text-align: left;
    border-bottom: 2px solid rgba(100, 255, 218, 0.2);
}

.editormd-html-preview table td {
    padding: 15px 20px;
    color: var(--text-light);
    border: 1px solid rgba(100, 255, 218, 0.1);
    transition: all 0.3s ease;
}

.editormd-html-preview table tr {
    background: transparent;
    transition: all 0.3s ease;
}

.editormd-html-preview table tr:hover {
    background: linear-gradient(135deg, rgba(100, 255, 218, 0.1) 0%, rgba(100, 255, 218, 0.05) 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(100, 255, 218, 0.2);
}

.editormd-html-preview table tr:nth-child(even) {
    background: rgba(17, 34, 64, 0.2);
}

.table-container {
    overflow-x: auto;
    margin: 2.5rem 0;
    border-radius: 12px;
    border: 1px solid rgba(100, 255, 218, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* 列表样式优化 */
.editormd-html-preview ul,
.editormd-html-preview ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.editormd-html-preview li {
    margin-bottom: 0.8rem;
    line-height: 1.7;
}

.editormd-html-preview ul li::marker {
    color: var(--accent);
}

.editormd-html-preview ol li::marker {
    color: var(--accent);
    font-weight: 600;
}

/* 链接样式优化 */
.editormd-html-preview a {
    color: var(--accent) !important;
    text-decoration: none;
    border-bottom: 1px solid rgba(100, 255, 218, 0.3);
    transition: all 0.3s ease;
    padding-bottom: 0.1rem;
}

.editormd-html-preview a:hover {
    color: #52e8c7 !important;
    border-bottom-color: var(--accent);
    border-bottom-width: 2px;
}

/* 文章底部操作区域 */
.article-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(100, 255, 218, 0.1);
}

.action-btn {
    padding: 0.8rem 1.5rem;
    border: 1px solid rgba(100, 255, 218, 0.3);
    background: transparent;
    color: var(--text-light);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.action-btn:hover {
    background: rgba(100, 255, 218, 0.1);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(100, 255, 218, 0.2);
}

.action-btn.primary {
    background: var(--accent);
    color: var(--primary);
    border: none;
}

.action-btn.primary:hover {
    background: #52e8c7;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(100, 255, 218, 0.4);
}

/* 页脚 */
.footer {
    background: rgba(7, 20, 38, 0.95);
    padding: 4rem 0 2rem;
    border-top: 1px solid rgba(100, 255, 218, 0.1);
    backdrop-filter: blur(10px);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-column h3 {
    color: var(--accent);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-column h3::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--accent);
}

.footer-links a {
    display: block;
    color: var(--text-light);
    margin-bottom: 0.8rem;
    text-decoration: none;
    transition: color 0.3s ease;
    padding: 0.3rem 0;
}

.footer-link:hover,
.contact-link:hover {
    color: var(--accent);
    transform: translateX(5px);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card);
    color: var(--text-light);
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-link:hover {
    background: var(--accent);
    color: var(--primary);
    transform: translateY(-5px) scale(1.1);
}

.subscribe-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.subscribe-input {
    flex: 1;
    padding: 0.8rem;
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 4px;
    background: rgba(17, 34, 64, 0.5);
    color: var(--text);
    transition: all 0.3s ease;
}

.subscribe-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(100, 255, 218, 0.1);
}

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--accent);
    color: var(--primary);
}

.btn-primary:hover {
    background: #52e8c7;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(100, 255, 218, 0.3);
}

.copyright {
    text-align: center;
    padding-top: 3rem;
    color: var(--text-light);
    font-size: 0.9rem;
    border-top: 1px solid rgba(100, 255, 218, 0.1);
    margin-top: 3rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--accent);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 5px 15px rgba(100, 255, 218, 0.4);
    border: none;
}

.back-to-top.show {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 25px rgba(100, 255, 218, 0.5);
}

/* 加载指示器 */
.loading-indicator {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    background: rgba(17, 34, 64, 0.8);
    border-radius: 8px;
    margin: 2rem 0;
    border: 1px solid rgba(100, 255, 218, 0.2);
}

.loading-indicator i {
    margin-right: 10px;
    color: var(--accent);
}

.error-message {
    text-align: center;
    padding: 2rem;
    color: var(--danger);
    background: rgba(239, 71, 111, 0.1);
    border-radius: 8px;
    margin: 2rem 0;
    border: 1px solid rgba(239, 71, 111, 0.3);
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .blog-header h1 {
        font-size: 2.2rem;
    }

    .blog-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    .meta-item {
        width: fit-content;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .subscribe-form {
        flex-direction: column;
    }

    #md-view {
        padding: 0;
    }

    .editormd-html-preview h1 {
        font-size: 1.8rem !important;
    }

    .editormd-html-preview h2 {
        font-size: 1.5rem !important;
    }

    .editormd-html-preview h3 {
        font-size: 1.3rem !important;
    }

    .article-actions {
        flex-direction: column;
        gap: 0.8rem;
    }

    .action-btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .blog-header h1 {
        font-size: 1.8rem;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }

    .editormd-html-preview {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }

    .editormd-html-preview p {
        font-size: 1rem !important;
    }

    .editormd-html-preview img {
        margin: 1.5rem 0 !important;
    }
}