/* House Inventory – mobile-first, clean family style */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: 80px; /* space for bottom nav */
}

a {
    color: var(--primary);
    text-decoration: none;
}

/* Header */
.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

/* Bottom navigation (mobile friendly) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 100;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    color: var(--muted);
    padding: 4px 12px;
}

.bottom-nav a.active,
.bottom-nav a:hover {
    color: var(--primary);
}

.bottom-nav .icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

/* Cards & lists */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

.card {
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.item-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.item-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
    background: #f1f5f9;
    flex-shrink: 0;
}

.item-card .info {
    flex: 1;
    min-width: 0;
}

.item-card .name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
}

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

.badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    margin-left: 6px;
}

.badge.needs-info {
    background: #fee2e2;
    color: #991b1b;
}

/* Forms */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--muted);
}

input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

button, .btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

button:hover, .btn:hover {
    background: var(--primary-dark);
}

button.secondary, .btn.secondary {
    background: #e2e8f0;
    color: var(--text);
}

button.danger, .btn.danger {
    background: var(--danger);
}

button.full, .btn.full {
    width: 100%;
}

/* Scan page */
#reader {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
}

.scan-result {
    margin-top: 16px;
}

.manual-entry {
    margin-top: 20px;
    text-align: center;
}

.manual-entry input {
    max-width: 220px;
    display: inline-block;
    margin-right: 8px;
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-bar input {
    flex: 1;
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--card);
    padding: 32px 24px;
    border-radius: 16px;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: center;
}

.login-box h1 {
    margin-bottom: 20px;
}

.login-box input {
    margin-bottom: 12px;
}

.error {
    color: var(--danger);
    margin-bottom: 12px;
    font-size: 0.9rem;
}

/* Empty state */
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

.empty .icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

/* Utilities */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.flex { display: flex; gap: 8px; }
.flex-1 { flex: 1; }

/* Fridge / pantry badges & chips */
.badge-expired { background: #fee2e2; color: #991b1b; }
.badge-urgent  { background: #ffedd5; color: #9a3412; }
.badge-soon    { background: #fef3c7; color: #92400e; }
.badge-ok      { background: #dcfce7; color: #166534; }

.filter-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}
.chip {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: #e2e8f0;
    color: var(--text);
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.chip.active {
    background: var(--primary);
    color: #fff;
}

.form-row {
    display: flex;
    gap: 10px;
}
.form-row .form-group {
    flex: 1;
}

/* Dark mode */
html.dark {
    --primary: #3b82f6;
    --primary-dark: #60a5fa;
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --danger: #f87171;
    --warning: #fbbf24;
    color-scheme: dark;
}

html.dark body {
    background: var(--bg);
    color: var(--text);
}

html.dark .chip {
    background: #334155;
    color: var(--text);
}
html.dark .chip.active {
    background: var(--primary);
    color: #fff;
}
html.dark input,
html.dark select,
html.dark textarea {
    background: #0f172a;
    color: var(--text);
    border-color: var(--border);
}
html.dark .login-box,
html.dark .card,
html.dark .item-card,
html.dark .recipe-card {
    background: var(--card);
}
html.dark .toast {
    background: #14532d;
    color: #bbf7d0;
    border-color: #166534;
}
html.dark .toast.err {
    background: #450a0a;
    color: #fecaca;
    border-color: #7f1d1d;
}
html.dark .match-summary {
    background: #1e293b;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text);
    line-height: 1;
}
.icon-btn:hover {
    background: var(--border);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-actions a {
    font-size: 0.85rem;
    color: var(--muted);
}
