/* 工作台样式文件 */

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

body {
    font-family: 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    background: #f5f6fa;
    height: 100vh;
    overflow: hidden;
}

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

/* 顶部横幅 */
.top-banner {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 8px 0;
    text-align: center;
    font-size: 14px;
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.banner-icon {
    width: 20px;
    height: 20px;
}

.banner-close {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
}

/* 主要内容区域 */
.main-layout {
    flex: 1;
    display: flex;
    height: 100vh;  /* 修改为 100vh，因为没有顶部横幅了 */
}

/* 左侧边栏 */
.sidebar-container {
    width: 220px;
    background: white;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.sidebar-container.collapsed {
    width: 60px;
}

.sidebar-container.collapsed .logo span {
    display: none;
}

.sidebar-container.collapsed .sidebar-header {
    padding: 20px 5px;  /* 折叠时减少左右内边距 */
    flex-direction: column;  /* 垂直排列 */
    gap: 10px;  /* 垂直间距 */
}

.sidebar-container.collapsed .logo {
    margin-right: 0;  /* 移除右边距 */
}

.sidebar-container.collapsed .sidebar-toggle {
    width: 100%;  /* 折叠时按钮占满宽度 */
    display: flex;
    justify-content: center;
}

.sidebar-container.collapsed .sidebar-item-text {
    display: none;
}

.sidebar-container.collapsed .section-title {
    display: none;
}

.sidebar-container.collapsed .sidebar-footer {
    padding: 15px 10px;
}

.sidebar-container.collapsed .user-details {
    display: none;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;  /* 添加间距 */
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.logo-image {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    flex-shrink: 0;  /* 确保按钮不会被压缩 */
    min-width: 28px;  /* 确保按钮有最小宽度 */
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.sidebar-section {
    margin-bottom: 30px;
}

.section-title {
    padding: 10px 20px;
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-collapsed .section-title {
    display: none;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.sidebar-item:hover {
    background: #f8f9fa;
    color: #667eea;
}

.sidebar-item.active {
    background: #f0f4ff;
    color: #667eea;
    border-right: 3px solid #667eea;
}

.sidebar-item-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    font-size: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-collapsed .sidebar-item-icon {
    margin-right: 0;
}

.sidebar-item-text {
    flex: 1;
    font-size: 14px;
    transition: opacity 0.3s ease;
}

.sidebar-collapsed .sidebar-item-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-item-text-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.sidebar-item-text-wrapper .sidebar-item-text {
    flex: 0 0 auto;
}

.sidebar-item-badge {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.sidebar-collapsed .sidebar-item-badge {
    display: none;
}

/* 右侧内容区域 */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    height: 100%;  /* 确保占满父容器高度 */
}

/* 内容区域头部 */
.content-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e9ecef;
    background: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.search-container {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

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

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

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

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    text-decoration: none;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

/* 内容主体 */
.content-main {
    flex: 1;
    padding: 0;  /* 移除padding，让iframe占满空间 */
    overflow: hidden;  /* 防止出现滚动条 */
    position: relative;  /* 为绝对定位的子元素提供参考 */
}

.welcome-section {
    text-align: center;
    padding: 60px 20px;
}

.welcome-title {
    font-size: 32px;
    color: #333;
    margin-bottom: 12px;
}

.welcome-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 40px;
}

/* 功能卡片网格 */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.feature-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.feature-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 24px;
    color: white;
}

.feature-title {
    font-size: 18px;
    color: #333;
    margin-bottom: 8px;
}

.feature-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* 内容切换区域 */
.content-panel {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;  /* 绝对定位，占满父容器 */
    top: 0;
    left: 0;
    z-index: 1;  /* 非激活面板的层级 */
    animation: fadeIn 0.3s ease-in;
}

.content-panel.active {
    display: block !important;  /* 使用 !important 确保优先级 */
    z-index: 10;  /* 激活面板的层级更高 */
}

/* iframe 样式 */
.content-panel iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar-container {
        width: 60px;
    }
    
    .sidebar-container .sidebar-item-text {
        opacity: 0;
        width: 0;
        overflow: hidden;
    }
    
    .content-header {
        padding: 15px 20px;
    }
    
    .header-main {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-container {
        max-width: 100%;
        margin: 0;
    }
    
    .content-main {
        padding: 20px 15px;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    font-size: 14px;
    color: #666;
}

.loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: #f1f3f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 32px;
    color: #999;
}

.empty-title {
    font-size: 18px;
    color: #333;
    margin-bottom: 8px;
}

.empty-desc {
    font-size: 14px;
    color: #666;
}

/* 新面板通用样式 */
.input-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.input-section h3 {
    font-size: 16px;
    color: #333;
    margin: 20px 0 12px 0;
}

.input-section h3:first-child {
    margin-top: 0;
}

.form-select, .form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: all 0.3s ease;
}

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

.question-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.question-types, .card-types, .recite-modes, .solve-options, 
.recite-assists, .convert-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 12px 0;
}

.question-types label, .card-types label, .recite-modes label, 
.solve-options label, .recite-assists label, .convert-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.generate-btn, .save-btn, .solve-btn, .start-btn, .convert-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.generate-btn:hover, .save-btn:hover, .solve-btn:hover, 
.start-btn:hover, .convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

.result-section h3 {
    color: #333;
    margin-bottom: 16px;
    font-size: 16px;
}

/* 资源搜索样式 */
#resource-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.resource-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.resource-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.resource-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.resource-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 12px;
}

.resource-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
}

/* 知识卡网格样式 */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.knowledge-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.3s ease;
}

.knowledge-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.card-front, .card-back {
    padding: 12px 0;
}

.card-front {
    border-bottom: 1px solid #f1f3f5;
    font-weight: bold;
    color: #333;
}

.card-back {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

/* 背诵区域样式 */
.recite-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
}

#reciteContent {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    min-height: 200px;
    border: 2px dashed #e9ecef;
    font-size: 16px;
    line-height: 1.8;
}

.recite-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.hint-btn, .next-btn, .test-btn {
    padding: 8px 16px;
    border: 1px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hint-btn:hover, .next-btn:hover, .test-btn:hover {
    background: #667eea;
    color: white;
}

/* 进度条样式 */
.progress-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
}

#progressText {
    color: #666;
    font-size: 14px;
}

/* 转换结果样式 */
.converted-text {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.download-btn, .copy-btn {
    padding: 10px 20px;
    border: 1px solid #28a745;
    background: #28a745;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn:hover, .copy-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

/* ========== 侧边栏底部用户信息样式 ========== */
.sidebar-footer {
    border-top: 1px solid #f1f3f5;
    padding: 15px 20px;
    margin-top: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    font-size: 20px;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    transition: color 0.2s;
}

.logout-btn:hover {
    color: #dc3545;
}

.login-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
    width: 100%;
    justify-content: center;
}

.login-link:hover {
    background: #e9ecef;
}

/* 隐藏原来的顶部 header */
.content-header {
    display: none;
}

