/* 冰箱整理 · 清爽冷藏主题 */
:root {
    --bg: #e8f4f8;
    --surface: #fff;
    --text: #1a2d33;
    --text-muted: #5a7a82;
    --accent: #0d9488;
    --accent-light: #5eead4;
    --border: #b8d4dc;
    --shadow: rgba(13, 148, 136, 0.08);
    --meat: #dc2626;
    --vegetable: #16a34a;
    --seasoning: #ca8a04;
    --beer: #d97706;
    --milk: #7c3aed;
    --drink: #0891b2;
    --status-good: #16a34a;
    --status-soon: #ca8a04;
    --status-urgent: #ea580c;
    --status-expired: #dc2626;
    --font-sans: "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.app {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.5rem;
}

.header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.25rem 0;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

.add-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px var(--shadow);
    margin-bottom: 1.25rem;
}

.add-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--text);
}

.add-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem 0;
}

.add-form .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.add-form .form-row:last-of-type {
    margin-bottom: 0;
}

.add-form input[type="text"],
.add-form input[type="date"],
.add-form select,
.add-form textarea {
    flex: 1;
    min-width: 140px;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

.add-form textarea {
    min-height: 100px;
    resize: vertical;
}

.add-form input[type="date"] {
    min-width: 160px;
}

.add-form label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-add {
    padding: 0.6rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.btn-add:hover {
    background: #0f766e;
}

.filter-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.filter-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.filter-btn {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
}

.filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.list-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px var(--shadow);
}

.list-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--text);
}

.item-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

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

.item-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.item-name {
    font-weight: 500;
    color: var(--text);
}

.item-name-en {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.85em;
}

.item-category-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.item-category-tag.meat { background: #fef2f2; color: var(--meat); }
.item-category-tag.vegetable { background: #f0fdf4; color: var(--vegetable); }
.item-category-tag.seasoning { background: #fefce8; color: var(--seasoning); }
.item-category-tag.beer { background: #fff7ed; color: var(--beer); }
.item-category-tag.milk { background: #f5f3ff; color: var(--milk); }
.item-category-tag.drink { background: #ecfeff; color: var(--drink); }

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

.item-status {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-weight: 500;
}

.item-status.good {
    background: #dcfce7;
    color: var(--status-good);
}

.item-status.soon {
    background: #fef9c3;
    color: #a16207;
}

.item-status.urgent {
    background: #ffedd5;
    color: var(--status-urgent);
}

.item-status.expired {
    background: #fee2e2;
    color: var(--status-expired);
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-remove {
    padding: 0.35rem 0.6rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
}

.btn-remove:hover {
    border-color: var(--status-expired);
    color: var(--status-expired);
}

.empty-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    padding: 2rem 0;
    margin: 0;
}

.empty-hint.hidden {
    display: none;
}

.receipt-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px var(--shadow);
    margin-bottom: 1.25rem;
}

.receipt-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--text);
}

.receipt-upload {
    margin-bottom: 0.75rem;
}

.receipt-upload input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
}

.receipt-label {
    display: inline-block;
    padding: 0.6rem 1rem;
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.receipt-label:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.receipt-preview {
    display: block;
    max-width: 100%;
    max-height: 200px;
    margin-top: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.receipt-preview:not([src]) {
    display: none;
}

.receipt-actions {
    margin-bottom: 0.5rem;
}

.receipt-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem 0;
}

.receipt-result {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.receipt-result.hidden {
    display: none;
}

.receipt-result-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem 0;
}

.receipt-item-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0 0;
    max-height: 240px;
    overflow-y: auto;
}

.receipt-item-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.receipt-item-list li:last-child {
    border-bottom: none;
}

.receipt-item-list input[type="checkbox"] {
    flex-shrink: 0;
}

.receipt-item-list input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

/* Status summary bar */
.status-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-summary:empty {
    display: none;
}

.summary-item {
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}

.summary-item.good { background: #dcfce7; color: var(--status-good); }
.summary-item.soon { background: #fef9c3; color: #a16207; }
.summary-item.urgent { background: #ffedd5; color: var(--status-urgent); }
.summary-item.expired { background: #fee2e2; color: var(--status-expired); }

.summary-sep {
    color: var(--border);
    font-weight: 300;
}

/* Category group headers */
.category-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--border);
    background: var(--bg);
    border-radius: 0 6px 6px 0;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 1rem;
    list-style: none;
}

.category-group-header:first-child {
    margin-top: 0;
}

.category-group-header.meat { border-left-color: var(--meat); }
.category-group-header.vegetable { border-left-color: var(--vegetable); }
.category-group-header.seasoning { border-left-color: var(--seasoning); }
.category-group-header.beer { border-left-color: var(--beer); }
.category-group-header.milk { border-left-color: var(--milk); }
.category-group-header.drink { border-left-color: var(--drink); }

.group-name {
    color: var(--text);
}

.group-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface);
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

@media (max-width: 480px) {
    .app { padding: 1rem; }
    .add-form .form-row { flex-direction: column; align-items: stretch; }
    .add-form input[type="text"],
    .add-form input[type="date"],
    .add-form select { min-width: 100%; }
}
