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

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9fafb;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 容器样式 - 全屏设计 */
.container {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    height: 100vh;
    max-width: 100%;
    margin: 0;
    background-color: #fff;
    overflow: hidden;
}

/* 头部样式 - 更醒目的设计 */
header {
    background-color: #3b82f6; /* Tailwind的蓝色 */
    color: white;
    padding: 1.25rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1.75rem;
}

header p {
    font-size: 1rem;
    opacity: 0.9;
}

/* 主要内容区域 - 占满剩余空间 */
main {
    display: flex;
    flex-direction: row;
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

/* 上传区域样式 - 更明显的虚线边框 */
.upload-section {
    margin-bottom: 1.5rem;
}

.upload-area {
    border: 2px dashed #3b82f6;
    border-radius: 0.5rem;
    padding: 2rem 1rem;
    text-align: center;
    background-color: #f0f7ff;
    transition: all 0.2s ease;
    cursor: pointer;
    margin-bottom: 1rem;
}

.upload-area:hover, .upload-area.drag-over {
    background-color: #e5f0ff;
    border-color: #2563eb;
}

.upload-area p {
    margin: 0.5rem 0;
    color: #4b5563;
}

.upload-hint {
    font-size: 0.75rem;
    color: #6b7280 !important;
    margin-top: 1rem !important;
}

#selectFileBtn {
    padding: 0.75rem 1.5rem;
    margin-top: 1rem;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s;
}

#selectFileBtn:hover {
    transform: translateY(-1px);
}

#selectFileBtn:active, #selectFileBtn.active {
    transform: translateY(1px);
}

/* 预览区域样式 */
.preview-section {
    flex: 1;
    opacity: 0.7;
    margin-bottom: 1rem;
    transition: opacity 0.3s ease;
}

.preview-section h2 {
    margin-bottom: 1rem;
    color: #1f2937;
    font-weight: 600;
    font-size: 1.25rem;
}

.preview-container {
    flex: 2;
    background-color: white;
    border-radius: 0.375rem;
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.preview-container h3 {
    margin-bottom: 1rem;
    color: #1f2937;
    font-size: 1.125rem;
    font-weight: 500;
}

.preview-table-container {
    overflow-x: auto;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background-color: white;
    height: calc(100% - 3rem);
    min-height: 200px;
}

#previewTable {
    width: 100%;
    border-collapse: collapse;
}

#previewTable th, #previewTable td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

#previewTable th {
    background-color: #f9fafb;
    font-weight: 500;
    color: #4b5563;
    position: sticky;
    top: 0;
    z-index: 10;
}

#previewTable tbody tr:hover {
    background-color: #f9fafb;
}

/* 底部样式 */
footer {
    background-color: #f9fafb;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
}

.status-bar {
    color: #4b5563;
    font-size: 0.875rem;
    transition: opacity 0.3s ease;
}

#downloadBtn {
    background-color: #10b981; /* Tailwind的绿色 */
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

#downloadBtn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

#downloadBtn:not(:disabled):hover {
    background-color: #059669;
    transform: translateY(-1px);
}

#downloadBtn:not(:disabled):active, #downloadBtn.active:not(:disabled) {
    transform: translateY(1px);
}

/* 响应式设计 - 针对各种屏幕尺寸优化 */
@media (min-width: 768px) {
    main {
        flex-direction: row;
        gap: 1.5rem;
    }
    
    .operation-panel {
        width: 50%;
        flex: 1;
    }
    
    .preview-panel {
        width: 50%;
        flex: 1;
    }
}

@media (max-width: 767px) {
    .upload-section, .preview-section {
        width: 100%;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    footer {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    
    #downloadBtn {
        width: 100%;
    }
}

/* 加载动画 - 改进动画效果 */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.75);
    z-index: 10;
    backdrop-filter: blur(2px);
}

.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2.5rem;
    height: 2.5rem;
    margin: -1.25rem 0 0 -1.25rem;
    border: 3px solid rgba(219, 234, 254, 0.8);
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 11;
}

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

/* 错误信息样式 */
.error-message {
    background-color: #fee2e2;
    color: #b91c1c;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin: 0.75rem 0;
    border-left: 4px solid #dc2626;
    animation: slideIn 0.3s ease-out;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes slideIn {
    0% { 
        opacity: 0;
        transform: translateY(-10px);
    }
    100% { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* 高亮样式用于新增的音标列 */
.highlight {
    background-color: #d1fae5;
    animation: highlightFade 2s forwards;
}

@keyframes highlightFade {
    0% { background-color: #d1fae5; }
    70% { background-color: #d1fae5; }
    100% { background-color: transparent; }
}

/* 添加淡入效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 添加对话框和列选择相关样式 */
.dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.dialog.hidden {
    display: none;
}

.dialog-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 90%;
}

.dialog h3 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.5rem;
}

.column-select {
    width: 100%;
    padding: 0.75rem;
    margin: 1rem 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.primary-button, .secondary-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.primary-button {
    background-color: #3498db;
    color: white;
}

.primary-button:hover {
    background-color: #2980b9;
}

.secondary-button {
    background-color: #ecf0f1;
    color: #2c3e50;
}

.secondary-button:hover {
    background-color: #bdc3c7;
}

/* 列信息显示区域 */
.column-info {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
}

.column-info p {
    margin: 0;
}

.small-button {
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
}

.small-button:hover {
    background-color: #2980b9;
}

#detectedColumn {
    font-weight: bold;
    margin: 0 0.25rem;
}

/* 步骤式布局相关样式 */
.section {
    margin-bottom: 2rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: white;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.section.hidden {
    display: none;
}

.section-title {
    margin-bottom: 1rem;
    color: #1f2937;
    font-weight: 600;
    font-size: 1.125rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.section-title:before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: #3b82f6;
    border-radius: 50%;
    margin-right: 0.75rem;
    color: white;
    text-align: center;
    line-height: 24px;
    font-size: 0.875rem;
    font-weight: bold;
}

#uploadSection .section-title:before {
    content: '1';
}

#configSection .section-title:before {
    content: '2';
}

#actionSection .section-title:before {
    content: '3';
}

/* 文件信息显示 */
.file-info {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.file-info:empty {
    display: none;
}

/* 配置区域样式 */
.config-container {
    display: flex;
    gap: 1.5rem;
}

.config-panel {
    flex: 1;
    min-width: 250px;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.375rem;
}

.preview-container {
    flex: 2;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #4b5563;
}

.helper-text {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.word-stats {
    margin: 1rem 0;
    padding: 0.75rem;
    background-color: #eff6ff;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.config-options h3 {
    font-size: 1rem;
    font-weight: 500;
    margin: 1rem 0 0.5rem;
    color: #4b5563;
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin: 0.5rem 0;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* 列预览表格 */
.selected-column-info {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: #f0f7ff;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.table-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

#columnPreviewTable {
    width: 100%;
    border-collapse: collapse;
}

#columnPreviewTable th, #columnPreviewTable td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

#columnPreviewTable th {
    background-color: #f9fafb;
    font-weight: 500;
    color: #4b5563;
    position: sticky;
    top: 0;
    z-index: 10;
}

.preview-actions {
    margin-top: 2rem;
    text-align: center;
}

/* 按钮样式 */
.primary-button, .success-button, .secondary-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-block;
    text-align: center;
}

.primary-button {
    background-color: #3b82f6;
    color: white;
}

.primary-button:hover {
    background-color: #2563eb;
}

.success-button {
    background-color: #10b981;
    color: white;
}

.success-button:hover {
    background-color: #059669;
}

.secondary-button {
    background-color: #f3f4f6;
    color: #374151;
}

.secondary-button:hover {
    background-color: #e5e7eb;
}

.primary-button:disabled, .success-button:disabled, .secondary-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary-button:not(:disabled):active,
.success-button:not(:disabled):active,
.secondary-button:not(:disabled):active {
    transform: translateY(2px);
}

/* 处理结果预览区 */
.result-preview {
    margin-top: 1.5rem;
}

.result-preview h3 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: #1f2937;
}

#resultTable {
    width: 100%;
    border-collapse: collapse;
}

#resultTable th, #resultTable td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

#resultTable th {
    background-color: #f9fafb;
    font-weight: 500;
    color: #4b5563;
}

/* 操作按钮容器 */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* 进度条 */
.progress-container {
    height: 6px;
    background-color: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background-color: #3b82f6;
    width: 0;
    transition: width 0.3s ease;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .config-container {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons button {
        width: 100%;
    }
}

/* 二栏布局 */
.two-column-layout {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    height: calc(100vh - 120px); /* 考虑减去header和footer的高度 */
    overflow: hidden;
    width: 100%;
}

/* 左侧操作面板 */
.operation-panel {
    flex: 1;
    width: 50%;
    min-width: 300px;
    max-width: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* 右侧预览面板 */
.preview-panel {
    flex: 1;
    width: 50%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* 面板区域共享样式 */
.panel-section {
    background-color: white;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 预览区文本内容改小 */
.preview-panel table {
    font-size: 0.9rem;
}

/* 增加原始数据和结果数据区域的分隔 */
#dataPreviewSection {
    margin-bottom: 1rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .two-column-layout {
        flex-direction: column;
        height: auto;
    }
    
    .operation-panel, .preview-panel {
        width: 100%;
        max-width: none;
    }
    
    .panel-section {
        margin-bottom: 1rem;
    }
}

/* 禁用状态的按钮样式 */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 确保滚动条美观 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
} 