* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #ffffff;
    color: #2c3e50;
    line-height: 1.6;
}

/* 验证加载遮罩 */
.auth-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.auth-loading-content {
    text-align: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e9ecef;
    border-top-color: #2c3e50;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.auth-loading-content p {
    color: #666;
    font-size: 15px;
}

.editor-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.editor-header {
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease;
}

.back-link {
    margin-bottom: 20px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    color: #666;
    text-decoration: none;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    color: #2c3e50;
    border-color: #2c3e50;
    transform: translateX(-3px);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-header h1 {
    font-size: 42px;
    font-weight: 300;
    letter-spacing: 2px;
    color: #1a1a1a;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 10px 20px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    color: #2c3e50;
}

.btn:hover {
    border-color: #2c3e50;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.btn-primary:hover:not(:disabled) {
    background: #1a252f;
    border-color: #1a252f;
}

.btn-secondary {
    background: white;
    color: #666;
}

.editor-content {
    flex: 1;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group .hint {
    font-weight: 400;
    color: #999;
    font-size: 12px;
}

.form-group input {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-group input:focus {
    outline: none;
    border-color: #2c3e50;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.05);
}

.editor-main {
    margin-bottom: 0;
}

.editor-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 400;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: #2c3e50;
}

.tab-btn.active {
    color: #2c3e50;
    border-bottom-color: #2c3e50;
}

.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

#content {
    width: 100%;
    min-height: 500px;
    padding: 16px 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.8;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    resize: vertical;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

#content:focus {
    outline: none;
    border-color: #2c3e50;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.05);
}

#preview {
    min-height: 500px;
    padding: 16px 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #f8f9fa;
}

.markdown-body {
    line-height: 1.8;
    color: #333;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
    color: #1a1a1a;
}

.markdown-body h1 {
    font-size: 28px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.markdown-body h2 {
    font-size: 24px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 6px;
}

.markdown-body h3 {
    font-size: 20px;
}

.markdown-body p {
    margin-bottom: 16px;
}

.markdown-body code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    color: #e83e8c;
}

.markdown-body pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.markdown-body pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 16px;
    padding-left: 28px;
}

.markdown-body li {
    margin-bottom: 8px;
}

.markdown-body blockquote {
    border-left: 4px solid #2c3e50;
    padding-left: 16px;
    margin: 16px 0;
    color: #666;
    font-style: italic;
}

.markdown-body a {
    color: #2c3e50;
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body strong {
    font-weight: 600;
    color: #1a1a1a;
}

.empty-hint {
    color: #999;
    text-align: center;
    padding: 40px;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 24px;
    background: #2c3e50;
    color: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    z-index: 1000;
    font-size: 14px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

/* 动画效果 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .editor-container {
        padding: 20px 15px;
    }

    .editor-header h1 {
        font-size: 32px;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    #content,
    #preview {
        min-height: 400px;
    }
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .auth-loading {
        background: #1a1a1a;
    }

    .loading-spinner {
        border-color: #333;
        border-top-color: #e0e0e0;
    }

    .auth-loading-content p {
        color: #999;
    }

    .back-btn {
        color: #999;
        border-color: #3c3c3c;
    }

    .back-btn:hover {
        color: #e0e0e0;
        border-color: #e0e0e0;
    }

    .editor-header h1 {
        color: #ffffff;
    }

    .editor-header p {
        color: #999;
    }

    /* 表单元素样式 */
    .form-group label {
        color: #e0e0e0;
    }

    .form-group .hint {
        color: #666;
    }

    .form-group input {
        background: #1a1a1a;
        color: #e0e0e0;
        border-color: #3c3c3c;
    }

    .form-group input::placeholder {
        color: #666;
    }

    .form-group input:focus {
        background: #1a1a1a;
        border-color: #e0e0e0;
        box-shadow: 0 0 0 3px rgba(224, 224, 224, 0.05);
    }

    /* 标签输入框 */
    #tags {
        background: #1a1a1a;
        color: #e0e0e0;
        border-color: #3c3c3c;
    }

    #tags::placeholder {
        color: #666;
    }

    #tags:focus {
        background: #1a1a1a;
        border-color: #e0e0e0;
        box-shadow: 0 0 0 3px rgba(224, 224, 224, 0.05);
    }

    /* 编辑器标签页 */
    .editor-tabs {
        border-bottom-color: #3c3c3c;
    }

    .tab-btn {
        color: #999;
    }

    .tab-btn:hover {
        color: #e0e0e0;
    }

    .tab-btn.active {
        color: #e0e0e0;
        border-bottom-color: #e0e0e0;
    }

    .btn {
        background: #2c2c2c;
        color: #e0e0e0;
        border-color: #3c3c3c;
    }

    .btn:hover {
        background: #333333;
        border-color: #e0e0e0;
        box-shadow: 0 2px 12px rgba(224, 224, 224, 0.08);
    }

    .btn.btn-primary {
        background: #0d6efd;
        border-color: #0d6efd;
    }

    .btn.btn-primary:hover {
        background: #0b5ed7;
        border-color: #0b5ed7;
    }

    .btn.btn-cancel {
        background: #2c2c2c;
        border-color: #3c3c3c;
    }

    .btn.btn-cancel:hover {
        background: #333333;
        border-color: #e0e0e0;
    }

    .editor-section {
        background: #2c2c2c;
        border-color: #3c3c3c;
    }

    .section-label {
        background: #2c2c2c;
        color: #999;
    }

    #title {
        background: #1a1a1a;
        color: #e0e0e0;
        border-color: #3c3c3c;
    }

    #title:focus {
        background: #1a1a1a;
        border-color: #e0e0e0;
        box-shadow: 0 0 0 3px rgba(224, 224, 224, 0.05);
    }

    #content {
        background: #1a1a1a;
        color: #e0e0e0;
        border-color: #3c3c3c;
    }

    #content::placeholder {
        color: #666;
    }

    #content:focus {
        background: #1a1a1a;
        border-color: #e0e0e0;
        box-shadow: 0 0 0 3px rgba(224, 224, 224, 0.05);
    }

    .editor-toolbar button {
        color: #999;
    }

    .editor-toolbar button:hover {
        color: #e0e0e0;
        background: #333333;
    }

    #preview {
        background: #1a1a1a;
        border-color: #3c3c3c;
    }

    .empty-hint {
        color: #666;
    }

    .markdown-body {
        color: #b0b0b0;
    }

    .markdown-body h1,
    .markdown-body h2,
    .markdown-body h3 {
        color: #ffffff;
    }

    .markdown-body h1 {
        border-bottom-color: #3c3c3c;
    }

    .markdown-body h2 {
        border-bottom-color: #3c3c3c;
    }

    #preview h1,
    #preview h2,
    #preview h3,
    #preview h4,
    #preview h5,
    #preview h6 {
        color: #ffffff;
    }

    #preview p,
    #preview li {
        color: #b0b0b0;
    }

    #preview code {
        background: #2c2c2c;
        color: #e0e0e0;
    }

    #preview pre {
        background: #2c2c2c;
        border-color: #3c3c3c;
    }

    #preview blockquote {
        border-left-color: #3c3c3c;
        color: #999;
    }

    #preview a {
        color: #58a6ff;
    }

    #preview a:hover {
        color: #79b8ff;
    }

    #preview table th {
        background: #2c2c2c;
        border-color: #3c3c3c;
    }

    #preview table td {
        border-color: #3c3c3c;
    }

    #preview hr {
        border-color: #3c3c3c;
    }

    .char-count {
        color: #666;
    }

    /* Toast 深色模式 */
    .toast {
        background: #2c2c2c;
        color: #e0e0e0;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    }

    .toast.success {
        background: #28a745;
    }

    .toast.error {
        background: #dc3545;
    }
}
