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

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
}

.container {
    display: flex;
    height: 100vh;
    width: 100%;
    padding: 20px;
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

/* 响应式布局 */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        padding: 15px;
        gap: 15px;
    }
    
    .editor-section,
    .preview-section {
        flex: none;
        height: 50vh;
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
        gap: 10px;
    }
    
    .toolbar {
        padding: 10px 15px;
        flex-wrap: wrap;
    }
    
    .toolbar button {
        font-size: 13px;
        padding: 6px 12px;
    }
}

.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    transition: all 0.3s ease;
}

.editor-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

.preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    transition: all 0.3s ease;
}

.preview-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

.preview-toolbar {
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.device-simulator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.device-simulator select {
    padding: 8px 12px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.device-simulator select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.device-simulator input {
    padding: 8px 12px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    font-size: 14px;
    width: 100px;
    transition: all 0.3s ease;
}

.device-simulator input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.preview-controls {
    display: flex;
    gap: 10px;
}

.preview-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.preview-container.mobile {
    padding: 20px 40px;
}

.preview-container.tablet {
    padding: 20px 30px;
}

.toolbar {
    padding: 18px 24px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.toolbar-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 模板选择器样式已移除 */

.toolbar button {
    padding: 10px 20px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.toolbar button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

.toolbar button:hover::before {
    left: 100%;
}

.toolbar button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.toolbar button:active {
    transform: translateY(0) scale(0.98);
}

.toolbar button.secondary {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    color: #667eea;
    border: 2px solid rgba(102, 126, 234, 0.3);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.toolbar button.secondary:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25), rgba(118, 75, 162, 0.25));
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

#preview {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#preview.mobile {
    width: 375px;
    height: 667px;
    max-width: 100%;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#preview.tablet {
    width: 768px;
    height: 1024px;
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

#preview.custom {
    max-width: 100%;
    border-radius: 8px;
}

/* 预览区域全屏样式 */
.preview-section.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    max-width: none !important;
    margin: 0 !important;
}

.preview-section.fullscreen .preview-container {
    background: #1a1a1a;
}

.preview-section.fullscreen #preview {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.CodeMirror {
    height: 100% !important;
    font-family: "JetBrains Mono", "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 14px;
    line-height: 1.6;
    padding: 15px 0;
    border-radius: 0 0 16px 16px;
}

.CodeMirror-focused .CodeMirror-cursor {
    border-left: 2px solid #667eea;
    animation: cursor-blink 1s infinite;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 5px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

/* 提示框样式 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95), rgba(118, 75, 162, 0.95));
    color: white;
    padding: 16px 28px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* 全屏编辑样式 */
.editor-section.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.editor-section.fullscreen .CodeMirror {
    border-radius: 0 !important;
}

/* 改进的代码折叠样式 */
.CodeMirror-foldmarker {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.CodeMirror-foldmarker:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
    transform: scale(1.1);
}

/* 改进的括号匹配样式 */
.CodeMirror-matchingbracket {
    background: rgba(102, 126, 234, 0.2) !important;
    border-radius: 3px;
    border: 1px solid rgba(102, 126, 234, 0.4);
}

/* 双向同步编辑样式 */
.sync-highlight {
    background: rgba(255, 215, 0, 0.3) !important;
    border: 2px solid #ffd700 !important;
    border-radius: 4px !important;
    animation: pulse-highlight 2s ease-in-out;
    transition: all 0.3s ease !important;
}

@keyframes pulse-highlight {
    0%, 100% { 
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    50% { 
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
}

.editable-element {
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.editable-element:hover {
    background: rgba(102, 126, 234, 0.1) !important;
    outline: 2px dashed rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

.editable-element.editing {
    background: rgba(102, 126, 234, 0.2) !important;
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.editable-tooltip {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.editable-element:hover .editable-tooltip {
    opacity: 1;
}

/* 同步模式激活状态 */
.sync-active {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 193, 7, 0.15)) !important;
    border-color: #ffc107 !important;
}

/* 代码行高亮 */
.CodeMirror-line-highlight {
    background: rgba(255, 215, 0, 0.2) !important;
    border-left: 4px solid #ffd700;
    animation: slide-in 0.3s ease;
}

@keyframes slide-in {
    from {
        transform: translateX(-10px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 滚动截图进度条样式 */
.capture-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    z-index: 10000;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.progress-bar {
    height: 24px;
    background: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.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%); }
}

.progress-text {
    text-align: center;
    color: #666;
    font-weight: 500;
}

.progress-cancel {
    padding: 10px 24px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.progress-cancel:hover {
    background: #ff5252;
    transform: scale(1.05);
} 