* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    padding: 40px;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header h1::before {
    content: "🧾";
    font-size: 2.5rem;
}

.header p {
    color: #666;
    font-size: 1.1rem;
}

.upload-section {
    background: #f8f9fa;
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
    display: block;
}

.upload-section:hover {
    background: #e9ecef;
    border-color: #764ba2;
}

.upload-section.dragover {
    background: #e7e9fc;
    border-color: #5a67d8;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.upload-text {
    color: #495057;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.upload-subtext {
    color: #6c757d;
    font-size: 0.9rem;
}

.recent-uploads {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.recent-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: #333;
}

.btn-small {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.recent-hint {
    margin: 4px 0 10px;
    color: #666;
    font-size: 0.9rem;
}

.recent-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.recent-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.recent-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eef2f7;
}

.recent-meta {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.3;
}

.recent-actions {
    display: flex;
    justify-content: space-between;
    gap: 6px;
}

.btn-outline {
    background: #fff;
    color: #4f46e5;
    border: 1px solid #4f46e5;
}

.btn-outline:hover {
    background: #eef2ff;
}

.recent-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    padding: 10px 0;
}

#fileInput {
    display: none;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    margin: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.preview-section {
    display: none;
    margin-top: 30px;
    animation: slideIn 0.5s ease-in;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.preview-section.active {
    display: block;
}

.preview-title {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.preview-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.receipt-data {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.data-item {
    margin-bottom: 15px;
}

.data-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.data-value {
    color: #212529;
    padding: 8px 12px;
    background: white;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.items-list {
    list-style: none;
    padding: 0;
}

.items-list li {
    padding: 8px 12px;
    background: white;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    margin-bottom: 5px;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading.active {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #495057;
    font-size: 1.1rem;
}

.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: none;
}

.alert.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Module Test Section */
.module-test-section {
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    display: block; /* 始终显示 */
}

.module-test-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.btn-module {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    margin: 5px;
}

.btn-module:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
}

/* Module Results Styles */
.module-results {
    margin-top: 30px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    animation: slideIn 0.5s ease-in;
}

.module-content {
    margin-top: 15px;
}

.ocr-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.summary-item {
    font-size: 1rem;
    color: #495057;
}

.ocr-full-text {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.ocr-full-text h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.full-text-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #212529;
    max-height: 300px;
    overflow-y: auto;
}

.ocr-lines {
    margin-bottom: 20px;
}

.ocr-lines h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.ocr-line {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 3px solid #764ba2;
}

.line-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.line-number {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.line-text {
    flex: 1;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.line-blocks {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #dee2e6;
}

.text-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 5px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 0.9rem;
}

.block-text {
    font-weight: 600;
    color: #495057;
    min-width: 100px;
}

.block-info {
    color: #6c757d;
    font-size: 0.85rem;
}

.block-confidence {
    color: #28a745;
    font-weight: 600;
    font-size: 0.85rem;
    margin-left: auto;
}

.ocr-normalized {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.ocr-normalized h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.normalized-lines {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
}

.normalized-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 8px;
    background: white;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
}

.line-num {
    color: #667eea;
    font-weight: 600;
    min-width: 30px;
}

.line-content {
    flex: 1;
    color: #212529;
}

.line-length {
    color: #6c757d;
    font-size: 0.85rem;
}

/* Logo Detection Results Styles */
.logo-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #f5576c;
}

.summary-item.success {
    color: #28a745;
}

.summary-item.error {
    color: #dc3545;
}

.logo-details {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.logo-details h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.logo-info-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
}

.logo-info-box p {
    margin: 8px 0;
    color: #495057;
    font-size: 0.95rem;
}

/* Barcode Handler Results Styles */
.barcode-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.barcode-list {
    margin-top: 20px;
}

.barcode-list h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.barcode-item {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 3px solid #764ba2;
}

.barcode-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.barcode-number {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.barcode-type {
    color: #495057;
    font-weight: 600;
    font-size: 0.95rem;
}

.barcode-info {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #dee2e6;
}

.barcode-info p {
    margin: 5px 0;
    color: #495057;
    font-size: 0.9rem;
}

.barcode-info code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #e83e8c;
    font-size: 0.9rem;
}

.barcode-empty {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 8px;
    color: #6c757d;
}

.barcode-empty .hint {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #adb5bd;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .upload-section {
        padding: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .ocr-summary {
        flex-direction: column;
        gap: 10px;
    }
    
    .line-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .text-block {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .normalized-line {
        flex-direction: column;
        align-items: flex-start;
    }
}

