/* styles.css - 所有样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #fafafa;
    --text-primary: #222222;
    --text-secondary: #888888;
    --text-placeholder: #b3b3b3;
    --border-color: #000000;
    --link-color: #2481cc;
}

body {
    font-family: Georgia, 'Times New Roman', Times, serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    overflow-y: scroll;
}

.page-wrapper {
    min-height: 100vh;
    position: relative;
    opacity: 0;
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Header */
.header {
    position: fixed;
    top: 90px;
    right: 50%;
    transform: translateX(390px);
    z-index: 100;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn {
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--border-color);
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
}

.action-btn:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--border-color);
    transform: translate(-50%, -50%);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.action-btn:hover::before {
    width: 300px;
    height: 300px;
}

.action-btn:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.action-btn:active {
    transform: translateY(-1px);
    transition: all 0.1s ease;
}

/* Mobile Action Buttons */
.mobile-publish-btn,
.mobile-edit-btn {
    display: none;
    margin-top: 40px;
    margin-bottom: 20px;
}

/* Editor Container */
.editor-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 80px 50px 120px;
    transform: translateY(20px);
    opacity: 1;
    animation: slideUp 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.editor-row {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-start;
    position: relative;
}

.editor-row.content-row {
    margin-bottom: 0;
}

.editor-label {
    min-width: 100px;
    padding-top: 10px;
    font-size: 16px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--text-secondary);
    font-weight: 400;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.editor-label.visible {
    opacity: 1;
    transform: translateX(0);
}

.editor-input-wrapper {
    flex: 1;
    position: relative;
}

.title-input,
.author-input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    padding: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.title-input {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.title-input::placeholder {
    color: var(--text-placeholder);
    font-weight: 700;
}

.author-input {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
    padding: 8px 0;
    letter-spacing: -0.01em;
}

.author-input::placeholder {
    color: var(--text-placeholder);
}

/* Content Editable */
.content-editable {
    font-size: 20px;
    line-height: 1.8;
    color: var(--text-primary);
    min-height: 400px;
    outline: none;
    font-family: Georgia, 'Times New Roman', Times, serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
}

.content-editable p {
    margin: 0 0 1.5em 0;
    line-height: 1.8;
}

.content-editable:empty:before {
    content: attr(data-placeholder);
    color: var(--text-placeholder);
    cursor: text;
}

/* Article View */
.article-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 100px 40px 120px;
    transform: translateY(20px);
    opacity: 1;
    animation: slideUp 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.article-header {
    margin-bottom: 48px;
}

.article-title {
    font-size: 44px;
    font-weight: 700;
    line-height: 1.2;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    margin-bottom: 24px;
    animation: fadeInUp 0.9s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.025em;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 400;
    color: var(--text-secondary);
    animation: fadeIn 1.1s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
    letter-spacing: -0.01em;
}

.meta-separator {
    width: 4px;
    height: 4px;
    background: var(--text-secondary);
    border-radius: 50%;
    opacity: 0.4;
}

.article-content {
    font-size: 20px;
    line-height: 1.8;
    font-family: Georgia, 'Times New Roman', Times, serif;
    color: var(--text-primary);
    animation: fadeIn 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.4s both;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    letter-spacing: 0.01em;
}

.article-content p {
    margin: 0 0 1.5em 0;
    line-height: 1.8;
}

.article-content h2,
.article-content h3,
.content-editable h2,
.content-editable h3 {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 700;
    margin: 2em 0 0.8em 0;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.article-content h2,
.content-editable h2 {
    font-size: 32px;
    margin-top: 2.5em;
}

.article-content h2:first-child {
    margin-top: 0;
}

.article-content h3,
.content-editable h3 {
    font-size: 24px;
    margin-top: 2em;
}

.article-content blockquote,
.content-editable blockquote {
    border-left: 4px solid #e0e0e0;
    padding-left: 24px;
    margin: 1.8em 0;
    color: var(--text-secondary);
    font-style: italic;
    transition: border-color 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.75;
    font-size: 19px;
}

.article-content blockquote:hover,
.content-editable blockquote:hover {
    border-left-color: var(--text-secondary);
}

.article-content a,
.content-editable a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px solid rgba(36, 129, 204, 0.3);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: 1px;
}

.article-content a:hover,
.content-editable a:hover {
    border-bottom-color: var(--link-color);
    color: #1a6aa8;
}

.article-content ul,
.article-content ol,
.content-editable ul,
.content-editable ol {
    margin: 1.8em 0;
    padding-left: 2.2em;
    line-height: 1.8;
}

.article-content li,
.content-editable li {
    margin: 0.8em 0;
    line-height: 1.8;
}

.article-content li p,
.content-editable li p {
    margin: 0.5em 0;
}

.article-content img,
.content-editable img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2.5em auto;
    border-radius: 6px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: imageSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes imageSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.article-content img:hover,
.content-editable img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* 视频和音频样式 */
.content-editable video,
.article-content video {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2.5em auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: videoSlideIn 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes videoSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.content-editable audio,
.article-content audio {
    width: 100%;
    max-width: 500px;
    display: block;
    margin: 2em auto;
    animation: audioSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes audioSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 代码块样式优化 */
.article-content code,
.content-editable code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.article-content pre,
.content-editable pre {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.8em 0;
    line-height: 1.6;
}

.article-content pre code,
.content-editable pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* ============================================ */
/* 文件上传样式（行内卡片） */
/* ============================================ */

.file-input {
    display: none;
}

/* 拖拽上传区域 */
.drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drag-overlay.active {
    display: flex;
    opacity: 1;
}

.drag-content {
    text-align: center;
    color: white;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drag-overlay.active .drag-content {
    transform: scale(1);
}

.drag-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    opacity: 0.9;
}

.drag-text {
    font-size: 24px;
    font-weight: 600;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* 上传卡片 - 行内显示 */
.upload-card {
    display: inline-block;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 16px 0;
    min-width: 280px;
    max-width: 100%;
    box-sizing: border-box;
    animation: cardSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.upload-card.uploading {
    border-color: #007bff;
    background: #e7f3ff;
}

.upload-card.success {
    border-color: #28a745;
    background: #d4edda;
    animation: successPulse 0.5s ease;
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.upload-card.error {
    border-color: #dc3545;
    background: #f8d7da;
}

.upload-card-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.upload-info {
    flex: 1;
    min-width: 0;
}

.upload-filename {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-status {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.upload-progress-bar {
    width: 100%;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
    position: relative;
    overflow: hidden;
}

.upload-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.upload-card.success .upload-progress-fill {
    background: linear-gradient(90deg, #28a745, #1e7e34);
}

.upload-card.error .upload-progress-fill {
    background: linear-gradient(90deg, #dc3545, #bd2130);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    transition: background 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 16px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    opacity: 0;
    animation: modalSlideIn 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes modalSlideIn {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-title {
    font-size: 22px;
    font-weight: 500;
    margin-bottom: 24px;
    color: var(--text-primary);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    margin-bottom: 24px;
    font-family: inherit;
    outline: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-input:focus {
    border-color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 11px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.modal-btn-primary {
    background: var(--text-primary);
    color: white;
}

.modal-btn-primary:hover {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modal-btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.modal-btn-secondary:hover {
    background: #e8e8e8;
    transform: translateY(-2px);
}

.modal-btn:active {
    transform: translateY(-1px) scale(0.98);
    transition: all 0.1s ease;
}

/* Hidden Class */
.hidden {
    display: none !important;
}

/* Selection */
::selection {
    background: rgba(0, 0, 0, 0.1);
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .header {
        padding: 16px 20px;
        top: 16px;
        right: 20px;
        transform: none;
    }

    #publishBtn,
    #editModeBtn {
        display: none !important;
    }

    .mobile-publish-btn,
    .mobile-edit-btn {
        display: none;
    }

    .mobile-publish-btn:not(.hidden),
    .mobile-edit-btn:not(.hidden) {
        display: block !important;
    }

    .editor-container,
    .article-container {
        padding: 60px 24px 80px;
    }

    .editor-row {
        flex-direction: column;
        margin-bottom: 16px;
    }

    .editor-label {
        min-width: auto;
        margin-bottom: 8px;
        padding-top: 0;
        font-size: 15px;
    }

    .mobile-publish-btn,
    .mobile-edit-btn {
        margin-top: 32px;
        margin-bottom: 16px;
    }

    .title-input {
        font-size: 28px;
        line-height: 1.25;
    }

    .author-input {
        font-size: 15px;
    }

    .content-editable {
        font-size: 18px;
        line-height: 1.75;
        min-height: 300px;
        letter-spacing: 0.005em;
    }

    .content-editable p {
        margin: 0 0 1.4em 0;
        line-height: 1.75;
    }

    .article-title {
        font-size: 30px;
        font-weight: 700;
        line-height: 1.25;
        margin-bottom: 16px;
    }

    .article-meta {
        font-size: 14px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .meta-separator {
        width: 3px;
        height: 3px;
    }

    .article-content {
        font-size: 18px;
        line-height: 1.75;
        letter-spacing: 0.005em;
    }

    .article-content p {
        margin: 0 0 1.4em 0;
        line-height: 1.75;
    }

    .article-content h2,
    .content-editable h2 {
        font-size: 26px;
        margin-top: 2em;
        margin-bottom: 0.6em;
        line-height: 1.3;
    }

    .article-content h2:first-child {
        margin-top: 0;
    }

    .article-content h3,
    .content-editable h3 {
        font-size: 21px;
        margin-top: 1.8em;
        margin-bottom: 0.6em;
        line-height: 1.35;
    }

    .article-content blockquote,
    .content-editable blockquote {
        border-left-width: 3px;
        padding-left: 18px;
        margin: 1.6em 0;
        font-size: 17px;
        line-height: 1.7;
    }

    .article-content ul,
    .article-content ol,
    .content-editable ul,
    .content-editable ol {
        margin: 1.6em 0;
        padding-left: 1.8em;
    }

    .article-content li,
    .content-editable li {
        margin: 0.7em 0;
        line-height: 1.75;
    }

    .article-content img,
    .content-editable img {
        margin: 2em auto;
        border-radius: 4px;
    }

    .article-content a,
    .content-editable a {
        padding-bottom: 2px;
        word-break: break-word;
    }

    .article-content code,
    .content-editable code {
        font-size: 0.88em;
        word-break: break-word;
    }

    .article-content pre,
    .content-editable pre {
        padding: 12px;
        margin: 1.6em -12px;
        border-radius: 4px;
        font-size: 14px;
    }

    .upload-card {
        min-width: 240px;
        padding: 12px 16px;
        margin: 12px 0;
    }

    .upload-card-content {
        gap: 10px;
    }

    .upload-icon {
        width: 20px;
        height: 20px;
    }

    .upload-filename {
        font-size: 13px;
    }

    .upload-status {
        font-size: 11px;
    }
    
    .drag-text {
        font-size: 20px;
    }
}

/* 平板适配 */
@media (min-width: 769px) and (max-width: 1024px) {
    .header {
        top: 90px;
        transform: translateX(340px);
    }

    .editor-container,
    .article-container {
        padding: 80px 40px 100px;
    }

    .article-content {
        font-size: 19px;
        line-height: 1.78;
    }

    .content-editable {
        font-size: 19px;
        line-height: 1.78;
    }
}

/* 大屏优化 */
@media (min-width: 1440px) {
    .editor-container {
        max-width: 900px;
        padding: 100px 60px 140px;
    }

    .article-container {
        max-width: 800px;
        padding: 120px 50px 140px;
    }

    .header {
        top: 90px;
        transform: translateX(430px);
    }

    .article-content {
        font-size: 21px;
        line-height: 1.82;
    }

    .content-editable {
        font-size: 21px;
        line-height: 1.82;
    }

    .article-content h2,
    .content-editable h2 {
        font-size: 36px;
    }

    .article-content h3,
    .content-editable h3 {
        font-size: 26px;
    }
}