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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.subtitle {
    color: #bdc3c7;
    font-size: 1rem;
}

/* 标签导航 */
.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.tab {
    padding: 12px 24px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: #ecf0f1;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.tab:hover {
    background: rgba(255,255,255,0.2);
}

.tab.active {
    background: #3498db;
    color: white;
}

/* 内容区域 */
.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 生成器布局 */
.generator-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 30px;
}

@media (max-width: 1000px) {
    .generator-layout {
        grid-template-columns: 1fr;
    }
}

/* 选择面板 */
.selection-panel {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 12px;
}

.selection-panel h2 {
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.theme-selector select {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

.theme-selector select:focus {
    border-color: #3498db;
    outline: none;
}

/* 槽位选择器 */
.slot-selectors {
    margin-top: 20px;
}

.slot-group {
    margin-bottom: 15px;
}

.slot-group label {
    display: block;
    font-weight: 600;
    color: #34495e;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.slot-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
}

.slot-group select:focus {
    border-color: #3498db;
    outline: none;
}

/* 模板选择器 */
.template-selector {
    margin-top: 20px;
}

.template-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.template-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-options label:hover {
    border-color: #3498db;
}

.template-options input[type="radio"]:checked + span {
    color: #3498db;
    font-weight: 600;
}

/* 按钮 */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    padding: 10px 20px;
    background: #ecf0f1;
    color: #34495e;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #d5dbdb;
}

/* 结果面板 */
.result-panel {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.result-header h2 {
    color: #2c3e50;
    font-size: 1.1rem;
}

.result-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.word-count {
    background: #3498db;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.essay-result {
    padding: 24px;
    line-height: 1.8;
    font-size: 1rem;
    color: #333;
    max-height: 600px;
    overflow-y: auto;
}

.essay-result .placeholder {
    color: #999;
    text-align: center;
    padding: 40px;
}

.essay-result .paragraph {
    margin-bottom: 20px;
}

.essay-result .paragraph-label {
    display: inline-block;
    background: #e8f4fd;
    color: #2980b9;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.essay-result .highlight-slot {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

.essay-result .highlight-connector {
    color: #27ae60;
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* 词语库页面 */
.words-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.word-section {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 12px;
}

.word-section h2 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.section-desc {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.word-card {
    background: white;
    padding: 14px 18px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
}

.word-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}

.word-card.required {
    border-left-color: #e74c3c;
}

.word-card .word-id {
    font-size: 0.75rem;
    color: #95a5a6;
    margin-bottom: 4px;
}

.word-card .word-en {
    font-size: 1.05rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.word-card .word-cn {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.word-card .word-usage {
    font-size: 0.8rem;
    color: #3498db;
    margin-top: 6px;
    font-style: italic;
}

/* 主题词库标签 */
.theme-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.theme-tab {
    padding: 10px 16px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.theme-tab:hover {
    border-color: #3498db;
}

.theme-tab.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.theme-words-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
}

.theme-category {
    margin-bottom: 20px;
}

.theme-category h4 {
    color: #34495e;
    font-size: 0.95rem;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

.theme-category .words-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* 句子库页面 */
.sentences-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sentences-info {
    background: linear-gradient(135deg, #e8f4fd 0%, #d4e9f7 100%);
    padding: 20px;
    border-radius: 10px;
}

.sentences-info h2 {
    color: #2c3e50;
    margin-bottom: 8px;
}

.sentences-info p {
    color: #5d6d7e;
}

.legend {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    font-size: 0.9rem;
}

.slot-legend {
    background: #fff3cd;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
}

.sentences-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sentence-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.sentence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.sentence-id {
    background: #3498db;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.sentence-id.tier-b {
    background: #9b59b6;
}

.sentence-name {
    font-weight: 600;
    color: #2c3e50;
}

.sentence-usage {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.sentence-body {
    padding: 18px;
}

.sentence-template {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #333;
    margin-bottom: 12px;
}

.sentence-template .slot {
    background: #fff3cd;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    color: #856404;
}

.sentence-template .connector {
    color: #27ae60;
    font-weight: 600;
}

.sentence-template .universal {
    color: #8e44ad;
    font-weight: 500;
}

.sentence-structure {
    font-size: 0.9rem;
    color: #7f8c8d;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-family: monospace;
}

/* 段落模板页面 */
.paragraphs-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.paragraphs-info {
    background: linear-gradient(135deg, #fef5e7 0%, #fdebd0 100%);
    padding: 20px;
    border-radius: 10px;
}

.paragraphs-info h2 {
    color: #2c3e50;
    margin-bottom: 8px;
}

.paragraphs-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.paragraph-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.paragraph-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    color: white;
}

.paragraph-header h3 {
    font-size: 1.1rem;
}

.paragraph-templates {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.template-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e0e0e0;
}

.template-card h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.template-id {
    background: #e74c3c;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.template-desc {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 12px;
}

.template-sentences {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-sentence {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #3498db;
    font-size: 0.95rem;
    line-height: 1.6;
}

.template-sentence .sentence-ref {
    display: inline-block;
    background: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    margin-right: 8px;
}

.template-sentence.bonus {
    border-left-color: #9b59b6;
}

.template-sentence.bonus .sentence-ref {
    background: #9b59b6;
}

/* 推荐组合 */
.combinations-section {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 12px;
}

.combinations-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.combinations-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.combination-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #ddd;
    transition: all 0.2s ease;
}

.combination-card:hover {
    border-color: #3498db;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.2);
}

.combination-card h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.combination-card .templates-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.combination-card .template-badge {
    background: #e8f4fd;
    color: #2980b9;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.combination-card .sentence-count {
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* 背诵练习页面 */
.practice-layout {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.practice-layout h2 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.practice-layout > p {
    color: #7f8c8d;
    margin-bottom: 30px;
}

.practice-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}

.practice-btn {
    padding: 14px 28px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.practice-btn:hover {
    background: #3498db;
    color: white;
}

.practice-area {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
}

.practice-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.practice-question {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 20px;
    line-height: 1.6;
}

.practice-question .blank {
    display: inline-block;
    min-width: 150px;
    border-bottom: 3px solid #3498db;
    margin: 0 5px;
}

.practice-input {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.practice-input:focus {
    border-color: #3498db;
    outline: none;
}

.practice-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.practice-answer {
    padding: 16px;
    background: #d4edda;
    border-radius: 8px;
    color: #155724;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.practice-progress {
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* 添加表单 */
.add-section {
    background: #fff;
    border: 2px dashed #ddd;
    padding: 24px;
    border-radius: 12px;
}

.add-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.add-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.add-form select,
.add-form input,
.add-form textarea {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

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

.add-form input {
    flex: 1;
    min-width: 150px;
}

.add-form textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
}

.add-form .btn-primary {
    width: auto;
    padding: 12px 30px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .tabs {
        gap: 6px;
    }

    .tab {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .tab-content {
        padding: 20px;
    }

    .words-grid {
        grid-template-columns: 1fr;
    }

    .paragraph-templates {
        grid-template-columns: 1fr;
    }

    .add-form {
        flex-direction: column;
    }

    .add-form input,
    .add-form select {
        width: 100%;
    }
}

/* 跳转高亮动画 */
@keyframes highlightFlash {
    0% { background-color: #fff3cd; transform: scale(1); }
    50% { background-color: #ffc107; transform: scale(1.02); }
    100% { background-color: #fff3cd; transform: scale(1); }
}

.highlight-flash {
    animation: highlightFlash 0.5s ease 3;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.5) !important;
}

/* 可点击的句子标号 */
.sentence-ref.clickable,
.sentence-tag {
    cursor: pointer;
    transition: all 0.2s ease;
}

.sentence-ref.clickable:hover,
.sentence-tag:hover {
    background: #2980b9 !important;
    transform: scale(1.1);
}

/* 词语链接样式 */
.word-link {
    color: #27ae60;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.word-link:hover {
    background: #27ae60;
    color: white;
}

/* 生成作文中的句子标签 */
.essay-sentence {
    display: inline;
}

.sentence-tag {
    display: inline-block;
    background: #3498db;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    margin-right: 4px;
    vertical-align: middle;
}

.sentence-tag:hover {
    background: #2980b9;
}

/* 填充后的槽位样式 */
.filled-slot {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    color: #155724;
}

/* 段落内容样式 */
.paragraph-content {
    line-height: 1.9;
    font-size: 1rem;
}

/* 打印样式 */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
    }

    .tabs,
    .btn-primary,
    .btn-secondary,
    .add-section {
        display: none;
    }

    .sentence-tag {
        display: none;
    }
}
