* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 120px);
}

/* 导航栏 */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    padding: 15px 0;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 20px;
    align-items: center;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 15px 10px;
    display: block;
    transition: background-color 0.3s;
}

.nav-menu a:hover {
    background-color: #34495e;
}

.username {
    color: #ecf0f1;
    padding: 15px 10px;
}

/* 认证页面 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    margin-bottom: 30px;
    text-align: center;
    color: #2c3e50;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
}

.auth-link a {
    color: #3498db;
    text-decoration: none;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #777;
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* 提示框 */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 卡片 */
.card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    color: #2c3e50;
    font-size: 2rem;
}

.page-header div {
    display: flex;
    gap: 10px;
}

/* 项目网格 */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.project-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.2rem;
    line-height: 1.4;
    min-height: 2.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-description {
    color: #666;
    margin-bottom: 15px;
    height: 4.8em;
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.project-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #777;
    flex-wrap: wrap;
}

.project-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: auto;
    margin-bottom: 10px;
}

.project-meta {
    font-size: 12px;
    color: #999;
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: auto;
}

/* 角色网格 */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.character-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.character-card h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.character-info p {
    margin-bottom: 8px;
    font-size: 14px;
}

.character-actions {
    display: flex;
    gap: 5px;
    margin-top: 15px;
}

/* 章节列表 */
.chapters-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chapter-item {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chapter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.chapter-header h3 {
    color: #2c3e50;
    font-size: 1.2rem;
}

.chapter-words {
    color: #777;
    font-size: 14px;
}

.chapter-summary {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.chapter-actions {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.chapter-meta {
    font-size: 12px;
    color: #999;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

/* 统计栏 */
.stats-bar {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    gap: 30px;
}

.stat-item {
    display: flex;
    gap: 5px;
}

.stat-label {
    color: #777;
}

.stat-value {
    color: #2c3e50;
    font-weight: bold;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.empty-state p {
    color: #777;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.table tr:hover {
    background-color: #f8f9fa;
}

/* 徽章 */
.badge {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.badge-admin {
    background-color: #e74c3c;
    color: white;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background-color: #3498db;
    transition: width 0.3s;
}

#progressArea {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

#results {
    margin-top: 20px;
}

#results ul {
    list-style: none;
    padding: 0;
}

#results li {
    padding: 10px;
    background: white;
    margin-bottom: 5px;
    border-radius: 4px;
}

/* 文本样式 */
.text-muted {
    color: #999;
}

.text-danger {
    color: #e74c3c;
}

/* 页脚 */
.footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

/* 响应式 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }
    
    .nav-menu li {
        width: 100%;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .projects-grid,
    .characters-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ==================== 加载动画样式 ==================== */

/* 加载遮罩层 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

/* 加载容器 */
.loading-container {
    background: white;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    max-width: 500px;
}

/* 旋转加载器 */
.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 脉冲加载器 */
.pulse-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 0 auto 20px;
}

.pulse-dot {
    width: 12px;
    height: 12px;
    background: #007bff;
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite;
}

.pulse-dot:nth-child(1) {
    animation-delay: 0s;
}

.pulse-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.pulse-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 进度条 */
.progress-container {
    width: 100%;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
    height: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* 加载文本 */
.loading-text {
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 500;
}

.loading-subtext {
    font-size: 14px;
    color: #666;
    margin-top: 10px;
}

/* 加载状态 */
.loading-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.status-icon {
    width: 20px;
    height: 20px;
    border: 2px solid #007bff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.status-text {
    font-size: 13px;
    color: #555;
}

/* 按钮加载状态 */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* 模态框加载状态 */
.modal-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 8px;
}

/* AI生成特定样式 */
.ai-generating {
    text-align: center;
    padding: 30px;
}

.ai-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-glow 2s ease-in-out infinite;
}

.ai-icon::before {
    content: '🤖';
    font-size: 40px;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(102, 126, 234, 0);
        transform: scale(1.05);
    }
}

/* 成功/错误状态 */
.loading-success {
    color: #28a745;
}

.loading-error {
    color: #dc3545;
}

.success-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid #28a745;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #28a745;
}

.error-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid #dc3545;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #dc3545;
}

/* 响应式 */
@media (max-width: 768px) {
    .loading-container {
        margin: 20px;
        padding: 30px 20px;
        min-width: auto;
    }
    
    .spinner {
        width: 50px;
        height: 50px;
    }
    
    .ai-icon {
        width: 60px;
        height: 60px;
    }
    
    .ai-icon::before {
        font-size: 30px;
    }
}
