/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Color Palette */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #059669;
    --error-color: #dc2626;
    --warning-color: #d97706;
    
    /* Neutral Colors */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Typography */
    --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Borders */
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Animations */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-4) 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.logo-icon {
    font-size: var(--font-size-2xl);
}

.nav {
    display: flex;
    gap: var(--space-2);
}

/* Main Content */
.main {
    flex: 1;
    padding: var(--space-8) 0;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.section-header h2 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
}

.section-header p {
    font-size: var(--font-size-lg);
    color: var(--gray-600);
}

/* Upload Section */
.upload-area {
    max-width: 600px;
    margin: 0 auto;
}

.camera-section {
    text-align: center;
}

.camera-preview {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--space-6);
}

.upload-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    align-items: center;
}

.divider {
    position: relative;
    text-align: center;
    margin: var(--space-4) 0;
    width: 100%;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gray-300);
}

.divider span {
    background: var(--gray-50);
    padding: 0 var(--space-4);
    color: var(--gray-500);
    font-size: var(--font-size-sm);
}

/* Image Preview */
.image-preview-section {
    text-align: center;
    margin-top: var(--space-8);
}

.image-preview {
    max-width: 100%;
    max-height: 500px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--space-6);
}

.preview-actions {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
}

/* Forms */
.review-form {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: var(--space-8);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: var(--space-6);
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    transition: border-color var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.form-actions {
    display: flex;
    gap: var(--space-4);
    justify-content: space-between;
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid var(--gray-200);
}

/* Items List */
.items-list {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: var(--space-6) 0;
    text-align: center;
    color: var(--gray-500);
    font-size: var(--font-size-sm);
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-4);
}

.loading-text {
    font-size: var(--font-size-lg);
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results */
.results-content {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: var(--space-8);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.success-message {
    color: var(--success-color);
    font-size: var(--font-size-2xl);
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.error-message {
    color: var(--error-color);
    font-size: var(--font-size-2xl);
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.result-details {
    background: var(--gray-50);
    padding: var(--space-6);
    border-radius: var(--border-radius);
    margin: var(--space-6) 0;
    text-align: left;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--gray-200);
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 600;
    color: var(--gray-700);
}

.result-value {
    color: var(--gray-900);
}