/* 全局样式 */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #333;
    --light-text: #666;
    --background-color: #f9f9f9;
    --card-background: #fff;
    --border-color: #ddd;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    padding: 20px;
}

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

/* 标题区样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    color: var(--light-text);
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
}

/* 主内容区样式 */
.main-content {
    background-color: var(--card-background);
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--shadow);
}

/* 通用区块样式 */
section {
    margin-bottom: 30px;
}

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

.section-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
}

/* 输入区样式 */
.story-input {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 150px;
    transition: var(--transition);
}

.story-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.word-count {
    color: var(--light-text);
    font-size: 0.9rem;
}

/* 配置区样式 */
.config-section h2 {
    margin-bottom: 20px;
}

.config-group {
    margin-bottom: 25px;
}

.config-group h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.config-group h4 {
    color: var(--text-color);
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 500;
}

/* 维度选项样式 */
.dimension-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.dimension-category {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.sub-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

/* 片段时长滑块样式 */
.duration-slider-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.duration-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    outline: none;
    border-radius: 3px;
}

.duration-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--secondary-color);
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
}

.duration-slider::-webkit-slider-thumb:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.duration-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    text-align: center;
}

.dimension-description {
    font-size: 0.9rem;
    color: var(--light-text);
    margin-top: 5px;
}

/* 复选框和单选框样式 */
.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    user-select: none;
    padding: 5px 0;
}

.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"] {
    opacity: 0;
    position: absolute;
}

.checkmark, .radiomark {
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid #bbb;
    margin-right: 8px;
    transition: var(--transition);
}

.checkmark {
    border-radius: 4px;
}

.radiomark {
    border-radius: 50%;
}

.checkbox-label:hover input ~ .checkmark,
.radio-label:hover input ~ .radiomark {
    border-color: var(--secondary-color);
}

.checkbox-label input:checked ~ .checkmark,
.radio-label input:checked ~ .radiomark {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.checkmark:after {
    content: "";
    display: none;
    position: absolute;
    left: 9px;
    top: 5px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.radiomark:after {
    content: "";
    display: none;
    position: absolute;
    top: 7px;
    left: 7px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
}

.checkbox-label input:checked ~ .checkmark:after,
.radio-label input:checked ~ .radiomark:after {
    display: block;
}

/* 按钮样式 */
.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.generate-btn, .reset-btn, .help-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.generate-btn {
    background-color: var(--secondary-color);
    color: white;
    flex: 1;
    min-width: 200px;
}

.generate-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.generate-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.reset-btn {
    background-color: #ecf0f1;
    color: var(--text-color);
}

.reset-btn:hover {
    background-color: #bdc3c7;
}

.help-btn {
    background-color: transparent;
    color: var(--light-text);
    padding: 12px;
    min-width: auto;
}

.help-btn:hover {
    color: var(--secondary-color);
    background-color: rgba(52, 152, 219, 0.1);
}

/* 加载动画 */
.loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* 结果展示区样式 */
.result-section {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.result-content {
    position: relative;
}

.result-output {
    width: 100%;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 500px;
    overflow-y: auto;
}

.copy-btn {
    background-color: transparent;
    color: var(--light-text);
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.copy-btn:hover {
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.copy-success {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--success-color);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-color);
}

.close {
    color: var(--light-text);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: var(--accent-color);
}

.modal-body {
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-body h3 {
    color: var(--primary-color);
    margin-top: 20px;
    margin-bottom: 10px;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    margin-bottom: 15px;
}

.modal-body ol, .modal-body ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 5px;
}

.modal-body strong {
    color: var(--primary-color);
}

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

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 提示弹窗样式 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 1rem;
    z-index: 1001;
    animation: fadeInOut 2s ease;
}

/* 页脚样式 */
.footer {
    text-align: center;
    margin-top: 40px;
    color: var(--light-text);
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .dimension-options {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .generate-btn, .reset-btn {
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .sub-options {
        flex-direction: column;
        gap: 5px;
    }
    
    .detail-options {
        flex-direction: column;
        gap: 10px;
    }
}