/* 基础重置和全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2980b9;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --gray-color: #95a5a6;
    --error-color: #e74c3c;
    --success-color: #2ecc71;
    --font-main: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    --font-code: 'Consolas', 'Source Code Pro', monospace;
    --transition-speed: 0.3s;
    --border-radius: 4px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --header-height: 60px;
}

html, body {
    height: 100%;
    font-family: var(--font-main);
    font-size: 16px;
    color: var(--dark-color);
    background-color: var(--light-color);
}

/* 应用容器 */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* 头部导航 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--dark-color);
    color: white;
    padding: 0 20px;
    height: var(--header-height);
    box-shadow: var(--shadow);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
}

.logo i {
    font-size: 1.8rem;
    margin-right: 10px;
    color: var(--primary-color);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

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

.toolbar button {
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    padding: 8px;
    cursor: pointer;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    transition: background-color var(--transition-speed);
}

.toolbar button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.toolbar button span {
    margin-left: 5px;
}

/* 主要内容区域 */
.content {
    display: flex;
    flex-direction: column;
    padding: 10px;
    flex: 1;
    overflow: hidden;
}

.editor-area {
    display: flex;
    flex-direction: column;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: white;
    box-shadow: var(--shadow);
    flex: 1;
}

/* 隐藏预览区域 */
.preview-area {
    display: none;
}

.editor-header, .preview-header {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background-color: var(--dark-color);
    color: white;
    font-weight: 500;
}

.editor-actions, .preview-actions {
    display: flex;
    gap: 5px;
}

.editor-actions button, .preview-actions button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: var(--border-radius);
    padding: 2px 5px;
    transition: background-color var(--transition-speed);
}

.editor-actions button:hover, .preview-actions button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.preview-status {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--gray-color);
}

#status-indicator {
    display: flex;
    align-items: center;
}

#status-indicator.running:before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--success-color);
    border-radius: 50%;
    margin-right: 5px;
    animation: pulse 1.5s infinite;
}

#status-indicator.error:before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--error-color);
    border-radius: 50%;
    margin-right: 5px;
}

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

/* 编辑器 */
#editor {
    flex: 1;
    overflow: auto;
    font-family: var(--font-code);
    height: calc(100vh - var(--header-height) - 60px);
}

/* 预览区域 */
.preview-container {
    flex: 1;
    overflow: auto;
    background-color: white;
}

#preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background-color: white;
}

/* 模板面板 */
.templates-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: var(--dark-color);
    color: white;
}

.templates-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

.templates-list {
    padding: 15px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    max-height: 60vh;
}

.template-item {
    padding: 15px;
    border: 1px solid var(--gray-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
}

.template-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.template-item h4 {
    margin-bottom: 5px;
    color: var(--dark-color);
}

.template-item p {
    font-size: 0.85rem;
    color: var(--gray-color);
}

/* 设置面板 */
.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 500px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: var(--dark-color);
    color: white;
}

.settings-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

.settings-content {
    padding: 20px;
    overflow-y: auto;
    max-height: 70vh;
}

.settings-group {
    margin-bottom: 20px;
}

.settings-group h4 {
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--gray-color);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.setting-item label {
    flex: 1;
}

.setting-item select, .setting-item input[type="number"] {
    padding: 5px 10px;
    border: 1px solid var(--gray-color);
    border-radius: var(--border-radius);
    width: 120px;
}

/* 首次使用引导 */
.guide {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.guide-content {
    background-color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
}

.guide-content h2 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.guide-content p {
    margin-bottom: 20px;
}

.guide-content ol {
    margin-left: 20px;
    margin-bottom: 25px;
}

.guide-content li {
    margin-bottom: 10px;
}

.guide-actions {
    display: flex;
    justify-content: flex-end;
}

.guide-actions button {
    padding: 8px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

.guide-actions button:hover {
    background-color: var(--secondary-color);
}

/* 错误显示面板 */
.error-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 50;
    border-left: 4px solid var(--error-color);
}

.error-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: rgba(231, 76, 60, 0.1);
}

.error-title {
    font-weight: 500;
    color: var(--error-color);
}

.error-header button {
    background: none;
    border: none;
    color: var(--dark-color);
    cursor: pointer;
}

.error-content {
    padding: 15px;
}

.error-content p {
    margin-bottom: 10px;
}

#error-location {
    font-family: var(--font-code);
    font-size: 0.9rem;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 8px;
    border-radius: var(--border-radius);
}

/* 辅助类 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }
    
    .toolbar {
        overflow-x: auto;
        padding-bottom: 5px;
    }
    
    .templates-list {
        grid-template-columns: 1fr;
    }
    
    .logo h1 {
        font-size: 1.2rem;
    }
    
    .error-panel {
        width: calc(100% - 40px);
    }
} 