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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

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

/* 主要内容区域 */
main {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* 上传区域样式 */
.upload-section {
    margin-bottom: 30px;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 文件输入样式 */
.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    border: 2px dashed #667eea;
    border-radius: 10px;
    background: #f8f9ff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    color: #667eea;
}

.file-input-label:hover {
    background: #e8ebff;
    border-color: #5a67d8;
}

.file-input-wrapper.has-file .file-input-label {
    background: #e6fffa;
    border-color: #38b2ac;
    color: #38b2ac;
}

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

/* 表单组样式 */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #4a5568;
}

.form-group input[type="text"] {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 复选框样式 */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    color: #4a5568;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.help-text {
    color: #718096;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* 处理按钮样式 */
.process-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.process-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.process-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 工作表选择区域样式 */
.sheet-selection {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    border: none;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
}

.sheet-selection::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    pointer-events: none;
}

.sheet-selection h3 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.sheet-selection h3::before {
    content: '📊';
    font-size: 1.2em;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.sheet-info p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.sheet-selector {
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.sheet-dropdown {
    width: 100%;
    padding: 16px 20px;
    padding-right: 50px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: #2d3748;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23667eea" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.sheet-dropdown:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
    background: white;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3), 0 0 0 4px rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.sheet-dropdown:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.2);
}

.sheet-dropdown option {
    padding: 12px;
    background: white;
    color: #2d3748;
    font-weight: 500;
}

.sheet-dropdown option:hover {
    background: #f7fafc;
}

/* 预览区域样式 */
.preview-section, .result-section {
    margin-top: 30px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.preview-section h3, .result-section h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.table-info, .result-info {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.table-info p, .result-info p {
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.table-info span, .result-info span {
    font-weight: 600;
    color: #667eea;
}

/* 表格样式 */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

#preview_table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

#preview_table th {
    background: #667eea;
    color: white;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
}

#preview_table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e2e8f0;
}

#preview_table tr:hover {
    background: #f7fafc;
}

/* 列名显示 */
.columns-info h4 {
    color: #4a5568;
    margin-bottom: 10px;
}

#columns_list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.column-tag {
    background: #667eea;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.column-tag:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

/* 下载链接样式 */
.download-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.download-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.download-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.download-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.download-filename {
    font-weight: 600;
    color: #2d3748;
}

.download-size {
    font-size: 0.85rem;
    color: #718096;
}

.download-btn {
    padding: 8px 16px;
    background: #38b2ac;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

/* 错误信息样式 */
.error-section {
    margin-top: 20px;
    padding: 15px;
    background: #fed7d7;
    border: 1px solid #fc8181;
    border-radius: 8px;
}

.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #c53030;
    font-weight: 600;
}

.error-icon {
    font-size: 1.2rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 20px;
    }
    
    .table-info, .result-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .download-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .download-btn {
        text-align: center;
    }
}