:root {
    --primary-color: #4F46E5;
    /* Indigo 600 */
    --primary-hover: #4338CA;
    --background-color: #F9FAFB;
    --card-bg: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --success: #10B981;
    --danger: #EF4444;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #6366F1;
        --primary-hover: #818CF8;
        --background-color: #111827;
        --card-bg: #1F2937;
        --text-main: #F9FAFB;
        --text-muted: #9CA3AF;
        --border-color: #374151;
        --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Disables double-tap zoom on some browsers */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-main);
    padding-bottom: 80px;
    /* Space for FAB */
    line-height: 1.5;
}

/* Header */
header {
    background-color: var(--card-bg);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

header h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

/* Cards */
.item-card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
    border: 1px solid var(--border-color);
}

.item-card:active {
    transform: scale(0.98);
}

.item-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.item-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.item-qty {
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-icon {
    padding: 0.8rem;
    border-radius: 50%;
    font-size: 1.5rem;
    /* Larger icon override */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    /* Touch target minimum */
    min-height: 48px;
    color: inherit;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-icon:active {
    background-color: rgba(0, 0, 0, 0.1);
}

/* FAB */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
    text-decoration: none;
    z-index: 50;
    font-size: 1.5rem;
}

.fab:hover {
    transform: translateY(-2px);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

input,
textarea {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background-color: var(--background-color);
    color: var(--text-main);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Search Bar */
.search-bar {
    margin-bottom: 1rem;
}

.scanner-container {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
    background: black;
}

#reader {
    width: 100%;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 1rem;
}

.flex-gap {
    display: flex;
    gap: 1rem;
}

.full-width {
    width: 100%;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 4rem;
    height: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}