/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 菜单栏样式 */
.menu-bar {
    background: #2c3e50;
    display: flex;
    height: 48px;
    border-bottom: 1px solid #34495e;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0 20px;
    color: #ecf0f1;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 3px solid transparent;
    position: relative;
}

.menu-item:hover {
    background-color: #34495e;
}

.menu-item.active {
    background-color: #3498db;
    border-bottom-color: #2980b9;
}

.menu-item i {
    margin-right: 0px;
}

/* 工具栏样式 */
.toolbar {
    background: #ecf0f1;
    border-bottom: 1px solid #bdc3c7;
    padding: 8px 16px;
    min-height: 48px;
}

.toolbar-group {
    display: none;
    align-items: center;
    gap: 4px;
}

.toolbar-group.active {
    display: flex;
}

.toolbar-btn {
    background: none;
    border: 1px solid #bdc3c7;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    color: #2c3e50;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background-color: #d5dbdb;
    border-color: #95a5a6;
}

.toolbar-btn:active {
    background-color: #bdc3c7;
}

.toolbar-btn i {
    font-size: 14px;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background-color: #bdc3c7;
    margin: 0 8px;
}

.toolbar-description {
    color: #7f8c8d;
    font-size: 14px;
    padding: 4px 0;
    flex-grow: 1;
    text-align: center;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    display: none;
    padding: 20px;
}

.panel.active {
    display: block;
}

/* 编辑器样式 */
.editor-container {
    max-width: 800px;
    margin: 0 auto;
}

.question-list {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.question-item {
    border-bottom: 1px solid #ecf0f1;
    padding: 20px;
    position: relative;
}

.question-item:last-child {
    border-bottom: none;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.question-type {
    display: inline-flex;
    align-items: center;
    background: #3498db;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.question-type i {
    margin-right: 4px;
}

.question-actions {
    display: flex;
    gap: 8px;
}

.question-actions button {
    background: none;
    border: 1px solid #bdc3c7;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    color: #7f8c8d;
    transition: all 0.2s;
}

.question-actions button:hover {
    color: #2c3e50;
    border-color: #95a5a6;
}

.question-actions button:active {
    background-color: #bdc3c7;
}

.question-content {
    margin-bottom: 10px;
}

.question-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #2c3e50;
}

.question-description {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.question-preview {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 12px;
    margin-top: 10px;
}

.condition-indicator {
    display: inline-flex;
    align-items: center;
    background: #e74c3c;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin-left: 8px;
}

.condition-indicator i {
    margin-right: 3px;
}

.add-question-placeholder {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
    margin-top: 20px;
}

/* 预览样式 */
.preview-container {
    max-width: 600px;
    margin: 0 auto;
}

.preview-header {
    text-align: center;
    margin-bottom: 30px;
}

.preview-header h2 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.preview-description {
    font-size: 16px;
    color: #7f8c8d;
    margin-bottom: 20px;
}

.preview-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 30px;
    margin-bottom: 20px;
}

.preview-question {
    margin-bottom: 25px;
}

.preview-question:last-child {
    margin-bottom: 0;
}

.preview-question-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #2c3e50;
}

.preview-question-description {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 12px;
}

.preview-question-required {
    color: #e74c3c;
    margin-left: 4px;
}

.preview-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.page-indicator {
    color: #7f8c8d;
    font-size: 14px;
}

/* 设置面板样式 */
.settings-container {
    max-width: 600px;
    margin: 0 auto;
}

.settings-container h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

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

.setting-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 500;
}

.setting-group input,
.setting-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.setting-group input:focus,
.setting-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.setting-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* New styles for settings options */
.input-option-group {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px 15px;
    background: #fdfdfd;
}

.radio-option,
.checkbox-option {
    display: flex;
    flex-wrap: wrap; 
    align-items: flex-start; 
    margin-bottom: 15px; 
}

.radio-option:last-child,
.checkbox-option:last-child {
    margin-bottom: 0; 
}

.radio-option input[type="radio"],
.checkbox-option input[type="checkbox"] {
    width: auto; 
    margin-top: 4px; 
    margin-right: 10px;
    flex-shrink: 0; 
}

.radio-option label,
.checkbox-option label {
    margin-bottom: 0; 
    flex-grow: 1; 
    cursor: pointer;
}

.radio-option small,
.checkbox-option small {
    display: block; 
    flex-basis: 100%; 
    margin-left: 30px; 
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 5px; 
}

/* Adjust general checkbox-group if it's still used somewhere else and needs similar small text styling */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap; 
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    flex-shrink: 0; 
}

.checkbox-group small { 
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #7f8c8d;
    margin-left: 30px; 
    flex-basis: 100%; 
}

/* AI 面板样式 */
.ai-container {
    max-width: 600px;
    margin: 0 auto;
}

.ai-container h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.ai-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ai-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.ai-section textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 15px;
    resize: vertical;
}

.ai-section textarea:focus {
    outline: none;
    border-color: #3498db;
}

/* Cloud panel styles */
.cloud-container {
    max-width: 600px;
    margin: 0 auto;
}

.cloud-container h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.cloud-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cloud-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.current-survey-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 15px;
}

.current-survey-info span {
    font-weight: 500;
    color: #3498db;
}

/* Unsaved indicator */
.unsaved-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background-color: #e74c3c;
    border-radius: 50%;
    display: none;
}

.unsaved-indicator.show {
    display: block;
}

/* 按钮样式 */
.btn-primary {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #2c3e50;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: #ecf0f1;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #ecf0f1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* 选择题选项编辑 */
.choices-editor {
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    padding: 10px;
    background: #f8f9fa;
}

.choice-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.choice-item input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    padding: 4px;
}

.choice-item button {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.choice-item button:hover {
    background-color: #fdf2f2;
}

.add-choice-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
}

.add-choice-btn:hover {
    background-color: #2980b9;
}

/* 条件编辑器 */
.condition-editor {
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    padding: 15px;
    background: #f8f9fa;
}

.condition-group {
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.condition-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.condition-group-type {
    background: #3498db;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.condition-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.condition-item select,
.condition-item input {
    flex: 1;
    min-width: 120px;
}

.condition-item button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.condition-item button:hover {
    background-color: #c0392b;
}

.add-condition-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.add-condition-btn:hover {
    background-color: #229954;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .toolbar {
        padding: 4px 8px;
    }
    
    .toolbar-btn {
        padding: 6px 8px;
    }
    
    .toolbar-btn span {
        display: none;
    }
    
    .panel {
        padding: 10px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px auto;
    }
    
    .editor-container,
    .preview-container,
    .settings-container,
    .ai-container {
        max-width: 100%;
    }

    .toolbar-description {
        font-size: 12px; 
        padding: 2px 0;
    }
}

/* 预览表单样式 */
.preview-form-group {
    margin-bottom: 20px;
}

.preview-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 500;
}

.preview-form-group input,
.preview-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.preview-form-group input:focus,
.preview-form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.preview-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-choice {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-choice input {
    width: auto;
}

.preview-scale {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.preview-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 12px;
    color: #7f8c8d;
}

.preview-scale-input {
    display: flex;
    justify-content: space-around; 
    width: 100%; 
    gap: 5px; 
}

.preview-scale-input label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    flex-grow: 1; 
    justify-content: center; 
    padding: 5px 0; 
}

.preview-scale-input input {
    width: auto;
}

.preview-scale-stars {
    display: flex;
    justify-content: space-around;
    font-size: 24px;
    color: #ccc; 
    width: 100%;
}

.preview-scale-stars .star {
    cursor: pointer;
    transition: color 0.2s;
}

.preview-scale-stars .star.filled {
    color: #f39c12; 
}

.preview-divider {
    border-top: 2px solid #3498db;
    margin: 20px 0;
    padding-top: 20px;
}

.preview-divider h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}

/* 加载状态 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3498db;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000; 
    color: white;
    font-size: 1.2em;
    display: none; 
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

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

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #3498db; 
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}