* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e7eb 100%);
    color: #333;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
}

.header-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    background-color: #fff;
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

#appDescription {
    margin: 0;
    padding: 8px 16px;
    color: #e74c3c;
    font-size: 14px;
    transition: all 0.3s ease;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: 600;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    position: relative;
    min-width: 150px;
}

.tab-button:hover {
    color: #3498db;
    background-color: rgba(52, 152, 219, 0.1);
}

.tab-button.active {
    color: #fff;
    background-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 16px;
}

main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.upload-section {
    width: 100%;
}

.upload-area {
    border: 2px dashed #3498db;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #2980b9;
    background-color: #f8f9fa;
}

.upload-area.drag-over {
    border-color: #2980b9;
    background-color: #e3f2fd;
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon {
    color: #3498db;
}

.options-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.image-preview, .conversion-options {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.image-preview h3, .conversion-options h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.preview-container {
    width: 100%;
    max-height: 300px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8f9fa;
}

.preview-container img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.image-info p {
    margin-bottom: 5px;
    font-size: 14px;
}

.conversion-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.format-selection {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.format-selection label {
    font-weight: 600;
}

.format-selection select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.quality-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quality-control label {
    font-weight: 600;
}

.quality-control input[type="range"] {
    width: 100%;
}

.size-control h4 {
    margin-bottom: 10px;
    font-weight: 600;
}

.preset-sizes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.preset-sizes label {
    font-weight: 600;
    font-size: 14px;
}

.preset-sizes select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
}

.preset-sizes select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.size-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.size-inputs > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.size-inputs label {
    font-size: 14px;
    font-weight: 500;
}

.size-inputs input[type="number"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.checkbox-container {
    grid-column: span 2;
    display: flex;
    align-items: center;
    gap: 8px;
}

.convert-button, .download-button, .reset-button {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

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

.download-button {
    background-color: #2ecc71;
    color: white;
}

.download-button:hover {
    background-color: #27ae60;
}

.reset-button {
    background-color: #e74c3c;
    color: white;
}

.reset-button:hover {
    background-color: #c0392b;
}

.result-section {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.result-preview {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.result-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.result-info {
    background-color: #f8f9fa;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 14px;
    color: #555;
    border-left: 4px solid #3498db;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

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

.loading-overlay p {
    color: #fff;
    font-size: 18px;
}
/* 图片识别功能样式 */
.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-hint {
    font-size: 0.9rem !important;
    color: #7f8c8d !important;
    margin: 5px 0;
}

#recognizerPreviewImg {
    max-width: 100%;
    max-height: 500px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.option-group {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-group label {
    font-weight: 500;
    color: #34495e;
    min-width: 140px;
}

.option-group select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.option-group input[type="checkbox"] {
    margin-right: 8px;
}

.image-controls, .result-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

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

.btn-secondary {
    background-color: #ecf0f1;
    color: #34495e;
}

.btn-secondary:hover {
    background-color: #dde4e6;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background-color: #3498db;
    width: 0%;
    transition: width 0.3s ease;
}

#progressText {
    text-align: center;
    color: #7f8c8d;
}

.result-text {
    background-color: #f8fafc;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: monospace;
    line-height: 1.5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .tab-button {
        width: 100%;
        text-align: center;
    }
    
    .options-section {
        grid-template-columns: 1fr;
    }
    
    .image-controls, .result-controls {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
    }
    
    .size-inputs {
        grid-template-columns: 1fr;
    }
    
    .checkbox-container {
        grid-column: span 1;
    }
    
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .result-actions button {
        width: 200px;
    }
}