:root {
    --primary-color: #2196F3;
    --secondary-color: #4CAF50;
    --danger-color: #f44336;
    --background-color: #f5f5f5;
    --text-color: #333333;
    --card-background: #ffffff;
    --border-radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.app-container {
    max-width: 100%;
    padding: 16px;
}

.page-header {
    text-align: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.capture-container {
    max-width: 600px;
    margin: 0 auto;
}

.camera-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background-color: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 16px;
}

.camera-wrapper video,
.camera-wrapper canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.capture-button {
    display: block;
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s;
}

.capture-button:hover {
    background-color: #1976D2;
}

.capture-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.file-upload-btn {
    display: block;
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    color: white;
    background-color: var(--secondary-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s;
}

.file-upload-btn:hover {
    background-color: #388E3C;
}

.preview-container {
    margin: 16px auto;
    max-width: 400px;
    text-align: center;
}

.preview-image {
    max-width: 100%;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.live-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #f44336;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.result-card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.result-card.compact {
    padding: 0.5rem;
    box-shadow: none;
    border: none;
}

.result-card.compact .result-details {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}



.result-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.detail-item {
    background-color: var(--background-color);
    padding: 12px;
    border-radius: var(--border-radius);
}

.detail-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: white;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    background-color: #FFEBEE;
    color: var(--danger-color);
    padding: 12px;
    border-radius: var(--border-radius);
    margin-top: 16px;
}

.blur-map-preview {
    margin-top: 16px;
    text-align: center;
}

.blur-map-preview img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .result-details {
        grid-template-columns: 1fr;
    }
}

/* Processing Queue Styles */
.processing-queue {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.queue-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #1f2937;
}

.clear-btn {
    padding: 0.5rem 1rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.clear-btn:hover {
    background: #dc2626;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.queue-empty {
    text-align: center;
    color: #6b7280;
    padding: 2rem;
}

.queue-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    align-items: flex-start;
}

.queue-item-thumbnail img {
    max-width: 80px;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
}

.queue-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.queue-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.queue-item-id {
    font-weight: 600;
    color: #1f2937;
}

.queue-item-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-processing {
    background: #dbeafe;
    color: #1e40af;
    animation: pulse 2s infinite;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.queue-item-progress {
    margin-top: 0.5rem;
    width: 100%;
}

.progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.progress-fill {
    height: 100%;
    background: #3b82f6;
    transition: width 0.3s ease;
    background-image: linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);
    background-size: 1rem 1rem;
}

.status-processing .progress-fill {
    animation: progress-stripes 1s linear infinite;
}

.status-completed .progress-fill {
    background: #10b981;
}

.status-failed .progress-fill {
    background: #ef4444;
}

.progress-text {
    font-size: 0.75rem;
    color: #6b7280;
}

.queue-item-result {
    margin-top: 0.5rem;
    width: 100%;
}

.result-badge-wrapper {
    margin-top: 0.5rem;
    text-align: center;
}

.blur-ratio {
    font-weight: 600;
    color: #1f2937;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-badge.accepted {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.queue-item-timestamp {
    font-size: 0.75rem;
    color: #6b7280;
}

.queue-item-error {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes progress-stripes {
    0% { background-position: 1rem 0; }
    100% { background-position: 0 0; }
}

/* Camera Switch Button */
.camera-switch-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}

.camera-switch-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.85);
}

.camera-switch-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.camera-switch-btn.switching {
    animation: pulse 1.5s infinite;
}

.camera-switch-btn svg {
    width: 16px;
    height: 16px;
}