* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.privacy-notice {
    background: #e8f5e8;
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.95rem;
}

/* Upload Section */
.upload-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.upload-area {
    border: 3px dashed #3498db;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: #f8fcff;
}

.upload-area:hover, .upload-area.dragover {
    border-color: #2980b9;
    background: #e3f2fd;
    transform: translateY(-2px);
}

.upload-area input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-content h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.upload-content p {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.language-section {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.language-section label {
    font-weight: 600;
    color: #2c3e50;
}

.language-section select {
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

/* Controls Section */
.controls-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.processing-info {
    font-weight: 600;
    color: #2c3e50;
}

.control-buttons {
    display: flex;
    gap: 1rem;
}

.control-buttons button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#startProcessing {
    background: #3498db;
    color: white;
}

#startProcessing:hover {
    background: #2980b9;
}

#startProcessing:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

#clearQueue {
    background: #e74c3c;
    color: white;
}

#clearQueue:hover {
    background: #c0392b;
}

/* Image Queue Section */
.queue-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.queue-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.image-item {
    position: relative;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.image-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.image-item-info {
    padding: 0.5rem;
    font-size: 0.8rem;
    color: #666;
}

.image-item-status {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.status-pending {
    background: #f39c12;
    color: white;
}

.status-processing {
    background: #3498db;
    color: white;
}

.status-completed {
    background: #27ae60;
    color: white;
}

.status-error {
    background: #e74c3c;
    color: white;
}

.remove-image {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0.8rem;
}

/* Progress Sections */
.overall-progress-section, .current-progress-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.overall-progress-section h3, .current-progress-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.current-image-info {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #666;
}

.progress-container {
    margin-bottom: 1rem;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-header h3 {
    color: #2c3e50;
}

.results-summary {
    background: #e8f5e8;
    color: #27ae60;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.results-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.results-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#downloadAllButton {
    background: #27ae60;
    color: white;
}

#downloadAllButton:hover {
    background: #219a52;
}

#copyAllButton {
    background: #3498db;
    color: white;
}

#copyAllButton:hover {
    background: #2980b9;
}

#resetAllButton {
    background: #95a5a6;
    color: white;
}

#resetAllButton:hover {
    background: #7f8c8d;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.result-item {
    border: 2px solid #eee;
    border-radius: 8px;
    padding: 1.5rem;
    background: #f8f9fa;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.result-filename {
    font-weight: 600;
    color: #2c3e50;
}

.result-confidence {
    background: #e8f5e8;
    color: #27ae60;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.result-text {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    margin-bottom: 1rem;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.result-actions button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-individual {
    background: #3498db;
    color: white;
}

.copy-individual:hover {
    background: #2980b9;
}

.download-individual {
    background: #27ae60;
    color: white;
}

.download-individual:hover {
    background: #219a52;
}

/* Error Section */
.error-section {
    background: #fff5f5;
    border: 2px solid #e74c3c;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.error-content h3 {
    color: #e74c3c;
    margin-bottom: 1rem;
}

.error-list {
    margin-bottom: 1rem;
}

.error-item {
    background: white;
    border: 1px solid #e74c3c;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.error-filename {
    font-weight: 600;
    color: #e74c3c;
    margin-bottom: 0.5rem;
}

.error-message {
    color: #666;
    font-size: 0.9rem;
}

#retryFailedButton {
    background: #e74c3c;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

#retryFailedButton:hover {
    background: #c0392b;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    color: #7f8c8d;
    font-size: 0.9rem;
}

footer a {
    color: #3498db;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Compatibility Warning */
.compatibility-warning {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f39c12;
    color: white;
    padding: 0.75rem;
    text-align: center;
    z-index: 1000;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .language-section, .controls-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .results-actions, .result-actions {
        flex-direction: column;
    }
    
    .results-actions button, .result-actions button {
        width: 100%;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus, input:focus, select:focus, textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.upload-area:focus-within {
    border-color: #2980b9;
    background: #e3f2fd;
}
