/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #007AFF;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333333;
    background: #f8f9fa;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    background: #ffffff;
    border-radius: 0;
    box-shadow: none;
    margin-top: 0;
    margin-bottom: 0;
    transition: none;
    border: none;
}

.container:hover {
    transform: none;
    box-shadow: none;
}

/* 主容器 */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

/* 导航栏 */
.navbar {
    background: var(--primary-color);
    color: white;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: none;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 56px;
}

.nav-brand h1 {
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
}

.nav-menu {
    margin-left: 2rem;
    display: flex;
    gap: 0;
}

.nav-item {
    background: none;
    border: none;
    color: white;
    padding: 18px 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 0;
    position: relative;
    opacity: 0.8;
}

.nav-item:hover {
    background-color: rgba(255,255,255,0.1);
    opacity: 1;
    transform: none;
}

.nav-item.active {
    background-color: rgba(255,255,255,0.15);
    opacity: 1;
    box-shadow: none;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: white;
}

/* 导航连接状态胶囊 */
#nav-connection-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    background-color: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 0.85rem;
}
#nav-connection-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
}
#nav-connection-status.local {
    background-color: rgba(255,255,255,0.15);
}
#nav-connection-status.cloud {
    background-color: rgba(46,204,113,0.25);
}
#nav-connection-status.syncing {
    background-color: rgba(52,152,219,0.3);
}
#nav-connection-status.local .dot {
    background: #d1d5db;
}
#nav-connection-status.cloud .dot {
    background: #2ecc71;
}
#nav-connection-status.syncing .dot {
    background: #3498db;
}
@keyframes navPulseBlue {
    0% { box-shadow: 0 0 0 0 rgba(52,152,219,0.8); }
    70% { box-shadow: 0 0 0 8px rgba(52,152,219,0); }
    100% { box-shadow: 0 0 0 0 rgba(52,152,219,0); }
}
@keyframes navPulseGreen {
    0% { box-shadow: 0 0 0 0 rgba(46,204,113,0.8); }
    70% { box-shadow: 0 0 0 8px rgba(46,204,113,0); }
    100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}
#nav-connection-status.syncing .dot { animation: navPulseBlue 1.2s ease-out infinite; }
#nav-connection-status.cloud .dot { animation: navPulseGreen 3s ease-out infinite; }
@keyframes navShimmer {
    0% { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}
#nav-connection-status.syncing {
    background-image: linear-gradient(90deg, rgba(52,152,219,0.15), rgba(52,152,219,0.35), rgba(52,152,219,0.15));
    background-size: 200% 100%;
    animation: navShimmer 1.5s linear infinite;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
}

/* 页面容器 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h2 {
    font-size: 1.75rem;
    color: #1a1a1a;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.page-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* 搜索筛选栏 */
.search-filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* 搜索框 */
.search-box input {
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    width: 280px;
    transition: all 0.2s ease;
    background: #ffffff;
    box-shadow: none;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.search-box input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* 筛选框 */
.filter-box select {
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.filter-box select:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
    box-shadow: none;
}

.btn::before {
    display: none;
}

.btn:hover::before {
    display: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: none;
}

.btn-primary:hover {
    background: var(--primary-color);
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    box-shadow: none;
}

.btn-secondary:hover {
    background: #e5e7eb;
    transform: none;
    box-shadow: none;
}

.btn-success {
    background: #10b981;
    color: white;
    box-shadow: none;
}

.btn-success:hover {
    background: #059669;
    transform: none;
    box-shadow: none;
}

.btn-danger {
    background: #ef4444;
    color: white;
    box-shadow: none;
}

.btn-danger:hover {
    background: #dc2626;
    transform: none;
    box-shadow: none;
}

.btn-small,
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* 网格布局 */
.projects-grid,
.templates-grid,
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 16px;
    /*min-height: 500px;*/
}

/* 空状态容器样式 */
.projects-grid.empty-container,
.templates-grid.empty-container,
.modules-grid.empty-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 卡片网格布局 */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
    /*min-height: 500px;*/
}

/* 当卡片网格包含空状态时的居中布局 */
.cards-grid.empty-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 卡片样式 */
.card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #f1f5f9;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover::before {
    opacity: 1;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: #e2e8f0;
}

/* 模板卡片特殊样式 */
.template-card {
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.template-card .card-header {
    margin-bottom: 16px;
    flex-shrink: 0;
}

.template-card .card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.template-card .card-subtitle {
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    background: #f8fafc;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 8px;
}

.template-card .card-body {
    flex: 1;
    margin-bottom: 16px;
}

.template-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 12px;
}

.template-preview .file-icon {
    font-size: 2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.template-preview .file-info {
    flex: 1;
    min-width: 0;
}

.template-preview .file-name {
    font-weight: 500;
    color: #1e293b;
    font-size: 0.9rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-preview .file-size {
    color: #64748b;
    font-size: 0.8rem;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 16px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.usage-count {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #059669;
    font-weight: 500;
}

.card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.card-actions .btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.card-actions .btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    color: white;
}

.card-actions .btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-1px);
}

.card-actions .btn-secondary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.card-actions .btn-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.card-actions .btn-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.card-actions .btn-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* Univer模板特殊样式 */
.univer-template-card {
    /*border-left: 4px solid #8b5cf6;*/
}

.univer-template-card .template-preview {
    background: linear-gradient(135deg, #f3e8ff, #faf5ff);
}

.univer-template-card .file-icon {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: white;
}

/* 状态标签 */
.status-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.synced {
    background-color: #dcfce7;
    color: #16a34a;
    border: none;
}

.status-badge.pending {
    background-color: #fef3c7;
    color: #d97706;
    border: none;
}

.status-badge.modified {
    background-color: #fee2e2;
    color: #dc2626;
    border: none;
}

.status-badge.unknown {
    background-color: #f3f4f6;
    color: #4b5563;
    border: none;
}

.status-badge.进行中 {
    background-color: #dcfce7;
    color: #16a34a;
    border: none;
}

.status-badge.已完成 {
    background-color: #dbeafe;
    color: #2563eb;
    border: none;
}

.status-badge.暂停 {
    background-color: #fef3c7;
    color: #d97706;
    border: none;
}

/* 文件列表 */
.files-list {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e1e5e9;
    transition: background-color 0.3s ease;
}

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

.file-item:hover {
    background-color: #f8f9fa;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
}

.file-meta {
    font-size: 0.85rem;
    color: #666;
}

.file-actions {
    display: flex;
    gap: 10px;
}

.file-actions .btn {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* 编辑器容器 */
.editor-container {
    background: white;
    border-radius: 12px;
    height: calc(100vh - 200px);
    min-height: 600px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255,255,255,0.9);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
}

.loading.show {
    display: flex;
}

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

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

/* 项目详情页面 */
.project-info-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.project-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-item label {
    font-weight: 500;
    color: #666;
    min-width: 80px;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-badge.status-进行中,
.status-badge.status-active {
    background: #e3f2fd;
    color: #1976d2;
}

.status-badge.status-已完成,
.status-badge.status-completed {
    background: #e8f5e8;
    color: #2e7d32;
}

.status-badge.status-暂停,
.status-badge.status-paused {
    background: #fff3e0;
    color: #f57c00;
}

/* 项目详情页头部优化样式 */
#project-detail-page .page-header .header-content {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}

#project-detail-page .project-info h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
}

#project-detail-page .project-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
    color: #6b7280;
}

#project-detail-page .project-meta .project-type,
#project-detail-page .project-meta .project-location {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.8rem;
}

#project-detail-page .project-description {
    margin-top: 10px;
    color: #4b5563;
    line-height: 1.5;
}

#project-detail-page .project-status.status-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
}

#project-detail-page #backToProjects.btn {
    align-self: start;
}

/* 模块网格 */
.modules-section {
    margin-top: 2rem;
}

.modules-section h3 {
    margin-bottom: 1.5rem;
    color: #333;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.module-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #e9ecef;
}

.module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.module-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.module-icon {
    font-size: 2rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.module-info {
    flex: 1;
}

.module-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.module-description {
    margin: 0;
    color: #666;
    font-size: 0.875rem;
    line-height: 1.4;
}

.module-stats {
    text-align: right;
    flex-shrink: 0;
}

.file-count {
    font-size: 0.875rem;
    color: #666;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
}

.module-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.btn-generate-file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    color: #495057;
    transition: all 0.2s ease;
}

.btn-generate-file:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.btn-generate-file .icon {
    font-size: 1rem;
}

/* 操作区栅格布局：更整齐的排列 */
.module-actions.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

/* 统一按钮规格（紧凑版） */
/* 统一按钮规格（与全局 .btn 保持一致） */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;      /* 与 .btn 相同 */
    border-radius: 8px;      /* 与 .btn 相同 */
    font-size: 0.9rem;       /* 与 .btn 相同 */
    height: auto;            /* 移除固定高度，按内容自适应 */
}

/* 图标尺寸统一（紧凑版） */
.action-btn .icon {
    font-size: 1rem;
}

/* 窄屏下单列显示 */
@media (max-width: 768px) {
    .module-actions.action-grid {
        grid-template-columns: 1fr;
    }
}

/* 文件管理页面样式 */
.file-controls {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-filter-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-box {
    position: relative;
    flex: none;
    max-width: 400px;
}

.search-box .form-input {
    padding-left: 2.5rem;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
}

.breadcrumb {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.25rem;
}

.breadcrumb .separator {
    margin: 0 0.5rem;
}

.module-info-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.module-header h2 {
    margin: 0 0 0.5rem 0;
    color: #333;
}

.module-header p {
    margin: 0;
    color: #666;
    line-height: 1.5;
}

/* 文件列表样式 */
.file-list-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.file-list-table {
    width: 100%;
    border-collapse: collapse;
}

.file-list-table th,
.file-list-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.file-list-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.file-list-table tbody tr:hover {
    background: #f8f9fa;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-icon {
    font-size: 1.25rem;
}

.file-name .name {
    font-weight: 500;
    color: #333;
}

.type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.type-badge.type-word {
    background: #e3f2fd;
    color: #1976d2;
}

.type-badge.type-excel {
    background: #e8f5e8;
    color: #388e3c;
}

.type-badge.type-ppt {
    background: #fff3e0;
    color: #f57c00;
}

.type-badge.type-pdf {
    background: #ffebee;
    color: #d32f2f;
}

.type-badge.type-image {
    background: #f3e5f5;
    color: #7b1fa2;
}

.type-badge.type-other {
    background: #f5f5f5;
    color: #616161;
}

/* 文件操作按钮图标（直立 SVG） */
.file-actions .btn .icon-svg {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
/* 保持按钮尺寸与间距一致 */
.file-actions {
    display: flex;
    gap: 0.5rem;
}
.file-actions .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.file-size,
.file-created,
.file-updated {
    color: #666;
    font-size: 0.875rem;
}

/* 空状态样式 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
    min-height: 400px;
    width: 100%;
}

.empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 0.5rem 0;
    color: #333;
}

.empty-state p {
    margin: 0 0 2rem 0;
    line-height: 1.5;
    max-width: 400px;
}

/* 文件编辑页面样式 */
.editor-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 200px);
    overflow: hidden;
}

.editor-actions {
    display: flex;
    gap: 1rem;
}

.page-title {
    flex: 1;
}

.page-title h1 {
    margin: 0 0 0.25rem 0;
}

.page-title span {
    color: #666;
    font-size: 0.9rem;
}

#fileEditor {
    height: 100%;
    border: none;
}

/* 文件编辑器样式 */
.file-editor {
    padding: 20px;
}

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

.editor-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.editor-container {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    min-height: 600px;
    position: relative;
}

.editor-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px;
    color: #666;
    font-size: 16px;
}

.editor-error {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 400px;
    color: #e74c3c;
    text-align: center;
}

.editor-error h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

.editor-error p {
    color: #666;
    margin-bottom: 20px;
}

.text-editor {
    width: 100%;
    height: 600px;
    border: none;
    padding: 20px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
}

.univer-container {
    width: 100%;
    height: 600px;
}

/* UniverJS 编辑器样式覆盖 */
.univer-container .univer-workbook {
    border: none !important;
}

.univer-container .univer-toolbar {
    border-bottom: 1px solid #e0e0e0 !important;
}

/* 加载动画 */


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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.slide-in {
    animation: slideIn 0.4s ease-out;
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* 页面过渡效果 */
.page {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.page.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: fadeIn 0.6s ease-out;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
        border-radius: 15px;
    }
    
    .container:hover {
        transform: none;
    }
    
    .search-box input {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .page-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .projects-grid,
    .templates-grid,
    .modules-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .card {
        padding: 20px;
    }
    
    .card:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .file-editor {
        padding: 15px;
    }
    
    .editor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .editor-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .editor-container {
        min-height: 400px;
    }
    
    .text-editor {
        height: 400px;
        padding: 15px;
        font-size: 16px;
    }
    
    .univer-container {
        height: 400px;
    }
    
    .project-meta {
        grid-template-columns: 1fr;
    }
    
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 10px 20px;
    }
    
    .nav-menu {
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .search-box input {
        width: 200px;
    }
    
    .projects-grid,
    .templates-grid,
    .modules-grid {
        grid-template-columns: 1fr;
    }
    
    .card-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .card-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .file-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .search-filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: none;
    }
    
    .file-list-table {
        font-size: 0.875rem;
    }
    
    .file-list-table th,
    .file-list-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .file-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 10px 15px;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .page-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .page-actions > * {
        width: 100%;
    }
}

/* 网络状态指示器 */
#network-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-left: 15px;
    position: relative;
}

#network-status.online {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.3);
}

#network-status.offline {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

#network-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

#network-status.online::before {
    background: rgba(255, 255, 255, 0.9);
}

#network-status.offline::before {
    background: rgba(255, 255, 255, 0.9);
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 弹出层样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    width: 98%;
    height: 98%;
    max-width: 98%;
    max-height: 98%;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.show .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.modal-actions .btn {
    padding: 6px 12px;
    font-size: 0.9rem;
    min-width: 60px;
}

.modal-actions .close {
    font-size: 18px;
    font-weight: bold;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
    padding: 6px 8px;
    border: none;
    background: none;
    border-radius: 4px;
    min-width: auto;
}

.modal-actions .close:hover {
    color: #1f2937;
    background-color: #f3f4f6;
}

.modal-content {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

.modal-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0 0 12px 12px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal-container {
        width: 98%;
        height: 95%;
        margin: 10px;
    }
    
    .modal-header {
        padding: 10px 12px;
        flex-direction: column;
        gap: 6px;
        align-items: stretch;
    }
    
    .modal-header h3 {
        font-size: 0.9rem;
    }
    
    .modal-actions {
        justify-content: center;
    }
    
    .modal-actions .btn {
        padding: 6px 10px;
        font-size: 0.85rem;
        flex: 1;
    }
    
    .settings-container {
        padding: 16px;
    }
    
    .settings-tabs {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .settings-tab {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .color-options {
        gap: 12px;
    }
}

/* 编辑器加载状态样式 */
.editor-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* 居中卡片样式，匹配模板加载视觉 */
.editor-loading .loading-box {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 220px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e3e3e3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.loading-text {
    color: #666;
    font-size: 1rem;
    font-weight: 500;
}

/* 编辑器iframe样式 */
#editor-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0 0 12px 12px;
}

/* 系统设置页面样式 */
.settings-container {
    width: 100%;
    margin: 0;
    padding: 5px;
}

.settings-tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 30px;
    gap: 0;
}

.settings-tab {
    padding: 12px 24px;
    border: none;
    background: none;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.settings-tab:hover {
    color: #374151;
    background-color: #f9fafb;
}

.settings-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: #f0f8ff;
}

.settings-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.settings-panel.active {
    display: block;
}

.settings-panel h3 {
    margin: 0 0 24px 0;
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 12px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group input {
    flex: 1;
}

.input-group button {
    flex-shrink: 0;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

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

.color-options {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.color-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.color-option:hover {
    background-color: #f3f4f6;
}

.color-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.color-option input[type="radio"]:checked + .color-preview {
    box-shadow: 0 0 0 3px var(--primary-color);
}

.color-preview {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #d1d5db;
    transition: box-shadow 0.2s ease;
}
