:root {
    --primary-color: #1893cc;
    --primary-dark: #3293b9;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --bg-white: #ffffff;
    --bg-gray: #f8fafc;
    --bg-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    
    --text-solid: rgba(15, 23, 42, 1.0);
    --text-muted-solid: rgba(100, 116, 139, 1.0);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gray);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 14px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 登录页面样式 */
.login-box {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 32px;
    color: var(--text-color);
    font-weight: 600;
    font-size: 24px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #374151;
    font-size: 15px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    font-size: 14px;
    transition: border-color 0.15s ease-in-out;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 按钮样式 */
.btn-primary {
    width: 100%;
    padding: 12px 20px;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-secondary {
    padding: 10px 16px;
    background: var(--bg-white);
    color: #374151;
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.btn-secondary:hover {
    background: var(--bg-light);
    border-color: #9ca3af;
}

.btn-small {
    padding: 6px 12px;
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.btn-small:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #334155;
}

/* 错误消息 */
.error-message {
    padding: 16px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    margin-bottom: 24px;
    text-align: center;
    font-weight: 500;
}

.activation-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease-in-out;
}

.activation-link:hover {
    border-bottom-color: #2563eb;
}

/* 成功消息 */
.success-message {
    padding: 16px 20px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    margin-bottom: 24px;
    text-align: center;
    font-weight: 500;
}

/* 页脚链接 */
.footer-links {
    text-align: center;
    margin-top: 36px;
}

.footer-links a {
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: all 0.15s ease-in-out;
}

.footer-links a:hover {
    color: #475569;
    border-bottom-color: #475569;
}

/* 编辑器页面样式 */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

/* 用户头像样式 */
.user-avatar {
    width: 40px;
    height: 40px;
    position: relative;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 14px;
    font-weight: 500;
}

.quota-info {
    color: #64748b;
    font-weight: 500;
}

.main-container {
    display: flex;
    height: calc(100vh - 88px);
}

.sidebar {
    width: 320px;
    background: rgba(255, 255, 255, 0.62);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-gray);
}

.sidebar-header h3 {
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.025em;
}

.toolbar {
    display: flex;
    gap: 12px;
}

.file-tree {
    flex: 1;
    padding: 16px 24px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.62);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.67);
}

.content-header {
    background: var(--bg-gray);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
}

.tabs {
    display: flex;
}

.tab-btn {
    padding: 16px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #64748b;
    transition: all 0.15s ease-in-out;
}

.tab-btn:hover {
    color: #334155;
    background: #f1f5f9;
}

.tab-btn.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--bg-white);
    font-weight: 600;
}

.content-area {
    flex: 1;
    position: relative;
}

.tab-content {
    display: none;
    height: 100%;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.editor-header {
    background: var(--bg-light);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
}

#currentFile {
    color: rgba(71, 85, 105, 1.0);
}

#codeEditor {
    flex: 1;
    border: none;
    padding: 24px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    background: rgba(255, 255, 255, 0.67);
    color: var(--text-color);
}

#previewFrame {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    padding: 32px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    min-width: 440px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.modal-content h3 {
    margin-bottom: 24px;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.025em;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* 文件树样式 */
.file-item {
    padding: 6px 0;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s ease-in-out;
}

.file-item:hover {
    background: var(--bg-light);
    border-left-color: var(--primary-color);
}

.file-item.selected {
    border-left-color: var(--primary-color);
    background: #eff6ff;
}

.file-item.directory {
    font-weight: 600;
}

.file-item.protected {
    color: #9ca3af;
    opacity: 0.7;
}

.file-item .file-name {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(15, 23, 42, 1.0);
}

.file-item .file-icon {
    font-size: 16px;
    width: 16px;
    text-align: center;
}

.file-item .file-info {
    font-size: 12px;
    color: #64748b;
    margin-left: 34px;
    margin-top: -2px;
    font-weight: 400;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        padding: 0 16px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .header-left {
        gap: 12px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
    }
    
    .avatar-placeholder {
        font-size: 14px;
    }
    
    .main-container {
        flex-direction: column;
        height: calc(100vh - 80px);
    }
    
    .sidebar {
        width: 100%;
        height: 280px;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .sidebar-header {
        padding: 16px;
    }
    
    .file-tree {
        padding: 12px 16px;
    }
    
    .user-info {
        flex-direction: column;
        gap: 8px;
        align-items: flex-end;
        font-size: 13px;
    }
    
    .tab-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .modal-content {
        min-width: 320px;
        margin: 20px;
        padding: 24px;
    }
    
    .login-box {
        margin: 60px auto;
        padding: 32px 24px;
    }
}

/* 加载动效 */
.loading-skeleton {
    background: #e2e8f0;
    animation: loading-pulse 1.5s infinite;
}

@keyframes loading-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-text {
    height: 20px;
    width: 70%;
    margin: 8px 0;
}

.loading-item {
    height: 16px;
    width: 100%;
    margin: 6px 0;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #6a8dd8;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* 上传进度条 */
.upload-progress {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    overflow: hidden;
    margin: 12px 0;
}

.upload-progress-bar {
    height: 100%;
    background: #25bdeb;
    transition: width 0.3s ease;
    width: 0%;
}

.upload-status {
    font-size: 12px;
    color: #64748b;
    margin-top: 8px;
    text-align: center;
}

/* 背景可见性样式 */
body.has-custom-background .header {
    background: rgba(255, 255, 255, 0.9) !important;
}

body.has-custom-background .sidebar {
    background: rgba(255, 255, 255, 0.62) !important;
}

body.has-custom-background .main-content {
    background: rgba(255, 255, 255, 0.67) !important;
}

body.has-custom-background .file-tree {
    background: rgba(255, 255, 255, 0.62) !important;
}

body.has-custom-background #codeEditor {
    background: rgba(255, 255, 255, 0.67) !important;
}

body.has-custom-background .login-box {
    background: rgba(255, 255, 255, 0.9) !important;
}