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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.section {
    padding: 40px;
}

.hidden {
    display: none;
}

.auth-box {
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-box input {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.auth-box input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.logout-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.token-status {
    color: #10b981;
    font-weight: 600;
}

.service-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 15px 25px;
    font-size: 16px;
    cursor: pointer;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.ocr-settings {
    display: flex;
    gap: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: center;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-group label {
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-group select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.setting-group select:focus {
    outline: none;
    border-color: #667eea;
}

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

.ocr-engine-label {
    font-weight: normal !important;
}

.engine-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-content h3 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.5em;
}

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

.upload-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #555;
}

.upload-group input[type="file"] {
    display: block;
    width: 100%;
    padding: 12px;
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.3s;
}

.upload-group input[type="file"]:hover {
    border-color: #667eea;
}

.image-preview {
    margin-top: 15px;
    min-height: 150px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.image-preview-multiple {
    margin-top: 15px;
    min-height: 150px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.preview-item {
    flex: 0 0 calc(33.333% - 10px);
    min-width: 150px;
    background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.preview-item img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    border-radius: 4px;
}

.preview-label {
    margin-top: 8px;
    text-align: center;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.result-box {
    margin-top: 25px;
    padding: 20px;
    border-radius: 8px;
    display: none;
}

.result-box.show {
    display: block;
}

.result-box.success {
    background: #d1fae5;
    border: 2px solid #10b981;
}

.result-box.error {
    background: #fee2e2;
    border: 2px solid #ef4444;
}

.result-box h4 {
    margin-bottom: 15px;
    color: #333;
}

.result-data {
    background: white;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
}

.error-message {
    color: #dc2626;
    font-weight: 600;
}

.processing {
    color: #667eea;
    font-weight: 600;
    text-align: center;
    padding: 20px;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

#auth-status {
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
}

#auth-status.success {
    background: #d1fae5;
    color: #059669;
}

#auth-status.error {
    background: #fee2e2;
    color: #dc2626;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    border-top: 1px solid #e0e0e0;
}

footer p {
    margin: 0;
}

@media (max-width: 768px) {
    .upload-section {
        grid-template-columns: 1fr;
    }
    
    .service-tabs {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 2em;
    }
}
