@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 1rem;
    -webkit-user-select: none;
    user-select: none;
}

input, textarea, select {
    -webkit-user-select: text;
    user-select: text;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.6s ease;
}

h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.subtitle {
    color: var(--text-secondary);
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    font-weight: 400;
}

.scanner-section {
    background: var(--bg-card);
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.6s ease;
}

.input-group {
    position: relative;
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: clamp(0.85rem, 2.5vw, 0.9rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 1.25rem 1rem;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    color: var(--text-primary);
    font-size: clamp(1rem, 4vw, 1.1rem);
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    min-height: 48px;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#barcodeInput {
    font-size: clamp(1.25rem, 5vw, 1.5rem);
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.1em;
    padding: 1.5rem 1rem;
}

.btn {
    padding: 1.25rem 2rem;
    border: none;
    border-radius: 0.75rem;
    font-size: clamp(0.95rem, 3.5vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-height: 48px;
    width: 100%;
    display: block;
    margin-bottom: 0.75rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:active {
    background: rgba(99, 102, 241, 0.1);
}

.product-display {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 2px solid var(--primary);
    animation: scaleIn 0.4s ease;
    margin-bottom: 1.5rem;
}

.product-display h2 {
    font-size: clamp(1.25rem, 4.5vw, 1.8rem);
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    line-height: 1.3;
    word-break: break-word;
}

.product-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.info-item {
    background: var(--bg-dark);
    padding: 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

.info-label {
    font-size: clamp(0.8rem, 2.5vw, 0.85rem);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.info-value {
    font-size: clamp(1.1rem, 4vw, 1.25rem);
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

.price {
    color: var(--success);
    font-size: clamp(1.25rem, 5vw, 1.5rem);
}

.add-product-form {
    animation: fadeInUp 0.4s ease;
}

.add-product-form h3 {
    font-size: clamp(1.15rem, 4vw, 1.5rem);
    margin-bottom: 1.5rem;
    color: var(--warning);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.alert {
    padding: 1.25rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
    animation: slideInRight 0.4s ease;
    font-size: clamp(0.9rem, 3vw, 1rem);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--error);
    color: var(--error);
}

.alert-info {
    background: rgba(99, 102, 241, 0.1);
    border: 2px solid var(--primary);
    color: var(--primary);
}

.hidden {
    display: none;
}

.stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.25rem 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    text-align: center;
    flex: 1;
    min-width: 120px;
}

.stat-value {
    font-size: clamp(1.5rem, 6vw, 2rem);
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Tablet and larger screens */
@media (min-width: 480px) {
    body {
        padding: 1.5rem;
    }
    
    .scanner-section {
        padding: 2rem;
    }
    
    .product-info {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .btn {
        width: auto;
        display: inline-block;
        margin-bottom: 0;
    }
    
    .form-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
}

@media (min-width: 768px) {
    body {
        padding: 2rem;
    }
    
    header {
        margin-bottom: 3rem;
    }
    
    .scanner-section {
        margin-bottom: 2rem;
    }
    
    .product-display {
        padding: 2rem;
    }
    
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Landscape mode optimization for handheld devices */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 0.5rem;
    }
    
    header {
        margin-bottom: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .scanner-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .product-info {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* High DPI screens (Zebra devices often have high DPI) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    input[type="text"],
    input[type="number"],
    select,
    .btn {
        border-width: 1px;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}
