/*
 * 小朋友知识卡片 - 主样式文件
 * 版本: v1.1.0 - 移动端UI布局优化
 * 更新时间: 2025-08-18
 * 主要更新: 移动端操作按钮移至卡片内容下方
 */

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

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    display: flex;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
}

/* 左侧边栏样式 */
.sidebar {
    flex: 0 0 400px;
    padding: 30px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
}

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

.logo h1 {
    font-size: 24px;
    color: #495057;
    margin-bottom: 8px;
}

.subtitle {
    color: #6c757d;
    font-size: 14px;
}

.input-section h2 {
    font-size: 18px;
    color: #495057;
    margin-bottom: 15px;
}

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

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#questionInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

#questionInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.generate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.preset-topics {
    margin-top: 25px;
}

.preset-topics h3 {
    font-size: 16px;
    color: #495057;
    margin-bottom: 15px;
}

.topic-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.topic-btn {
    background: white;
    border: 2px solid #e9ecef;
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.topic-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateX(5px);
}

/* 右侧内容区样式 */
.content-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.welcome-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
}

.welcome-card {
    text-align: center;
    max-width: 500px;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.welcome-card h2 {
    font-size: 24px;
    color: #495057;
    margin-bottom: 15px;
}

.welcome-card p {
    color: #6c757d;
    margin-bottom: 15px;
    font-size: 16px;
}

.features {
    display: flex;
    justify-content: space-around;
    margin-top: 30px;
    gap: 20px;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.feature-icon {
    font-size: 24px;
}

/* 加载状态样式 */
.loading-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
}

.loading-card {
    text-align: center;
    max-width: 400px;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.loading-animation {
    margin-bottom: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

.loading-card h3 {
    color: #495057;
    margin-bottom: 10px;
}

.loading-card p {
    color: #6c757d;
}

/* 卡片内容样式 */
.card-content {
    display: flex;
    flex-direction: column;
}

.card-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    order: 1; /* PC端：按钮在上方 */
}

.knowledge-card {
    order: 2; /* PC端：卡片内容在下方 */
}

.action-btn {
    background: white;
    border: 2px solid #e9ecef;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.knowledge-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    line-height: 1.8;
    font-size: 16px;
}

/* 知识卡片内容样式 */
.card-title {
    font-size: 28px;
    color: #495057;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 700;
}

.card-intro {
    font-size: 18px;
    color: #6c757d;
    margin-bottom: 30px;
    text-align: center;
    background: linear-gradient(135deg, #f8f9ff 0%, #e3f2fd 100%);
    padding: 20px;
    border-radius: 15px;
    border-left: 4px solid #667eea;
}

.knowledge-points {
    margin-bottom: 30px;
}

.knowledge-point {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #28a745;
    transition: all 0.3s ease;
}

.knowledge-point:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.point-title {
    font-size: 20px;
    color: #495057;
    margin-bottom: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.point-content {
    color: #6c757d;
    line-height: 1.7;
    font-size: 16px;
}

.card-summary {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    border: 2px solid #ffc107;
    margin-top: 30px;
}

.summary-icon {
    font-size: 32px;
    margin-bottom: 15px;
    display: block;
}

.summary-text {
    font-size: 18px;
    color: #856404;
    font-weight: 600;
    line-height: 1.6;
}

/* 关键词高亮样式 */
.highlight {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    color: #856404;
}

/* 消息提示样式 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 1000;
    max-width: 300px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.message-success {
    background: #28a745;
}

.message-error {
    background: #dc3545;
}

.message-warning {
    background: #ffc107;
    color: #212529;
}

.message-info {
    background: #17a2b8;
}

/* 响应式设计 - 移动端 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        margin: 0;
        min-height: 100vh;
    }
    
    .sidebar {
        flex: none;
        padding: 20px;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .content-area {
        flex: 1;
        padding: 20px;
    }
    
    .topic-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .topic-btn {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
    
    .features {
        flex-direction: column;
        gap: 15px;
    }
    
    .card-actions {
        justify-content: center;
        order: 3; /* 移动端：按钮组移到卡片内容下方 */
        margin-top: 20px;
        margin-bottom: 0;
        padding-top: 20px;
        border-top: 2px dashed #e9ecef;
    }

    .knowledge-card {
        order: 2; /* 移动端：卡片内容在按钮组上方 */
        margin-bottom: 0;
    }

    .action-btn {
        flex: 1;
        min-width: 80px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .sidebar {
        padding: 15px;
    }
    
    .content-area {
        padding: 15px;
    }
    
    .welcome-card,
    .loading-card {
        padding: 25px;
    }
    
    .knowledge-card {
        padding: 20px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .topic-buttons {
        flex-direction: column;
    }
    
    .card-actions {
        flex-direction: column;
        order: 3; /* 小屏移动端：按钮组在卡片内容下方 */
        margin-top: 25px;
    }

    .knowledge-card {
        order: 2; /* 小屏移动端：卡片内容在按钮组上方 */
    }
}
