/* 基础样式 */
* {
    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: #f5f7fa;
}

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

/* 头部样式 */
.header {
    background: #fff;
    border-bottom: 1px solid #e1e8ed;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a73e8;
}

.nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    color: #5f6368;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: #f8f9fa;
    color: #1a73e8;
}

.nav-link.logout {
    color: #d93025;
}

.user-info {
    color: #5f6368;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.login-type {
    color: #07c160;
    font-size: 0.8rem;
    font-weight: 500;
}

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

/* 闪现消息 */
.flash-messages {
    margin-bottom: 20px;
}

.flash-message {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-weight: 500;
}

.flash-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.flash-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.flash-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* 登录页面样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-title {
    text-align: center;
    color: #333;
    margin-bottom: 8px;
    font-size: 1.8rem;
    font-weight: 600;
}

.login-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.login-btn:hover {
    background: #1557b0;
}

/* 分隔线样式 */
.divider {
    margin: 30px 0;
    text-align: center;
    position: relative;
}

.divider:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e1e8ed;
}

.divider span {
    background: #fff;
    padding: 0 15px;
    color: #666;
    font-size: 0.9rem;
}


/* 文件浏览器样式 */
.file-browser {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

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

.breadcrumb {
    font-size: 0.9rem;
}

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

.upload-btn {
    background: #28a745;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-btn:hover {
    background: #218838;
}

.create-dir-btn {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.create-dir-btn:hover {
    background: #0056b3;
}

.delete-dir-btn {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-dir-btn:hover {
    background: #c82333;
}

.delete-dir-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.breadcrumb-item {
    color: #5f6368;
}

.breadcrumb-link {
    color: #1a73e8;
    text-decoration: none;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.file-list-header {
    display: grid;
    grid-template-columns: 1fr 120px 180px;
    gap: 20px;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e8ed;
    font-weight: 600;
    color: #5f6368;
}

.file-list-content {
    min-height: 400px;
}

.file-item {
    display: grid;
    grid-template-columns: 1fr 120px 180px;
    gap: 20px;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s;
    cursor: pointer;
}

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

.file-item-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
}

.file-icon.folder {
    color: #ffa726;
}

.file-icon.file {
    color: #42a5f5;
}

.file-item-size {
    color: #5f6368;
    font-size: 0.9rem;
}

.file-item-modified {
    color: #5f6368;
    font-size: 0.9rem;
}

/* 文件详情页面样式 */
.file-detail {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.file-detail-header {
    padding: 20px;
    border-bottom: 1px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-title {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

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

.download-btn {
    color: #fff;
    background: #28a745;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid #28a745;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

.download-btn:hover {
    background: #218838;
    border-color: #218838;
}

.download-btn.downloading {
    background: #6c757d;
    border-color: #6c757d;
    cursor: wait;
}

.delete-btn {
    color: #fff;
    background: #dc3545;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid #dc3545;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

.delete-btn:hover {
    background: #c82333;
    border-color: #bd2130;
}

.back-btn {
    color: #1a73e8;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid #1a73e8;
    border-radius: 4px;
    transition: all 0.2s;
}

.back-btn:hover {
    background: #1a73e8;
    color: #fff;
}

.file-info {
    padding: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-weight: 600;
    color: #5f6368;
    font-size: 0.9rem;
}

.info-value {
    color: #333;
    word-break: break-all;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-indexed {
    background: #d4edda;
    color: #155724;
}

.status-not-indexed {
    background: #f8d7da;
    color: #721c24;
}

/* 文件分片样式 */
.file-chunks {
    border-top: 1px solid #e1e8ed;
    padding: 20px;
}

.chunks-title {
    color: #333;
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.chunks-toggle {
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
}

.chunk-item {
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    margin-bottom: 10px;
}

.chunk-header {
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e8ed;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chunk-header:hover {
    background: #f1f3f4;
}

.chunk-title {
    font-weight: 500;
    color: #333;
}

.chunk-toggle {
    color: #5f6368;
    font-size: 0.9rem;
}

.chunk-content {
    padding: 16px;
    background: #fff;
    white-space: pre-wrap;
    line-height: 1.6;
    color: #333;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
}

.chunk-content.collapsed {
    display: none;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #5f6368;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        padding: 0 16px;
    }
    
    .main {
        padding: 16px;
    }
    
    .login-box {
        margin: 20px;
        padding: 30px;
    }
    
    .file-list-header,
    .file-item {
        grid-template-columns: 1fr 80px 120px;
        gap: 10px;
        padding: 12px 16px;
    }
    
    .file-detail-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* 解析测试样式 */
.btn-test {
    background: #ff6b35;
    color: #fff;
    margin-left: 10px;
    font-size: 0.85rem;
    padding: 6px 12px;
}

.btn-test:hover {
    background: #e55a2e;
}

.btn-test:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-test.loading {
    background: #ccc;
    cursor: wait;
}

.btn-text {
    background: transparent;
    color: #1a73e8;
    border: none;
    padding: 6px 12px;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-text:hover {
    background: #f8f9fa;
}


.result-title {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.result-content {
    margin-bottom: 15px;
}

.result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
}

.result-icon {
    font-size: 1.2rem;
    margin-top: 2px;
}

.result-text {
    flex: 1;
    line-height: 1.5;
}

.content-preview {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

.content-preview h4 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: #333;
}

.chunk-preview {
    margin-bottom: 15px;
    padding: 12px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.chunk-info {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.chunk-preview-content {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.result-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.result-close {
    text-align: right;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 15px;
}

/* 模态对话框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: #e9ecef;
    color: #333;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.parse-summary {
    margin-bottom: 25px;
}

.parse-summary h4 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #333;
}

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

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
}

.summary-item .label {
    font-weight: 500;
    color: #666;
}

.summary-item .value {
    font-weight: 600;
    color: #333;
}

.parse-chunks h4 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #333;
}

.chunks-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
}

/* 删除确认对话框样式 */
.delete-modal {
    max-width: 500px;
    width: 90vw;
}

.delete-warning {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    margin-bottom: 20px;
}

.warning-icon {
    font-size: 2rem;
    margin-top: 5px;
}

.warning-text {
    flex: 1;
}

.warning-text p {
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.warning-text p:last-child {
    margin-bottom: 0;
}

.file-name-highlight {
    font-family: 'Courier New', monospace;
    background: #e9ecef;
    padding: 8px 12px;
    border-radius: 4px;
    border-left: 4px solid #dc3545;
    font-weight: 600;
    color: #333;
}

.warning-message {
    color: #856404;
    font-size: 0.9rem;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e1e8ed;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8f9fa;
}

.btn-cancel {
    background: #6c757d;
    color: #fff;
    border: 1px solid #6c757d;
}

.btn-cancel:hover {
    background: #5a6268;
    border-color: #545b62;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
    border: 1px solid #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

.btn-danger:disabled,
.btn-danger.loading {
    background: #6c757d;
    border-color: #6c757d;
    cursor: wait;
}

/* 删除消息样式 */
.delete-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid;
    position: relative;
}

.delete-message.success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.delete-message.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.message-icon {
    font-size: 1.2rem;
    margin-top: 2px;
}

.message-text {
    flex: 1;
    line-height: 1.5;
}

.message-text small {
    opacity: 0.8;
}

.message-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.6;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.message-close:hover {
    opacity: 1;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .modal-content {
        width: 95vw;
        max-height: 95vh;
    }
    
    .delete-modal {
        width: 95vw;
        max-width: none;
    }
    
    .delete-warning {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .warning-icon {
        font-size: 3rem;
        margin-top: 0;
    }
    
    .modal-header,
    .modal-body {
        padding: 15px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .content-preview {
        padding: 12px;
    }
    

}

/* 文件上传样式 */
.file-item.uploading {
    background: #e8f4fd;
    border: 1px dashed #1a73e8;
    animation: uploadPulse 2s infinite;
}

.file-item.upload-error {
    background: #ffeaa7;
    border: 1px solid #fdcb6e;
}

@keyframes uploadPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.upload-status {
    margin-left: 8px;
    font-size: 0.8rem;
    color: #1a73e8;
    font-weight: 500;
}

.upload-progress {
    display: flex;
    align-items: center;
    width: 100%;
}

.progress-bar {
    width: 100px;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #28a745;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.error-text {
    color: #dc3545;
    font-size: 0.9rem;
}

/* 上传结果对话框样式 */
.upload-result-modal {
    max-width: 500px;
    width: 90vw;
}

.upload-result {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.upload-result.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.upload-result.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.result-icon {
    font-size: 2rem;
    margin-top: 5px;
}

.result-message {
    flex: 1;
}

.result-message p {
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.result-message p:last-child {
    margin-bottom: 0;
}

.failed-files {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 20px;
}

.failed-files h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #333;
}

.failed-files ul {
    margin: 0;
    padding-left: 20px;
}

.failed-files li {
    margin-bottom: 5px;
    line-height: 1.4;
}

.btn-primary {
    background: #1a73e8;
    color: #fff;
    border: 1px solid #1a73e8;
}

.btn-primary:hover {
    background: #1557b0;
    border-color: #1557b0;
}

/* 响应式设计补充 */
@media (max-width: 768px) {
    .file-browser-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .browser-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .upload-result-modal {
        width: 95vw;
        max-width: none;
    }
    
    .upload-result {
        flex-direction: column;
        text-align: center;
    }
    
    .result-icon {
        font-size: 3rem;
        margin-top: 0;
    }
} 