:root {
    color-scheme: dark;
    --bring-bg: #222b31;
    --bring-surface: #1e262c;
    --bring-panel: #29343c;
    --bring-red: #e75d62;
    --bring-red-dim: rgba(231, 93, 98, 0.15);
    --bring-green: #51a193;
    --text-main: #ffffff;
    --text-muted: #8c979d;
    --radius-pill: 24px;
    --radius-card: 12px;
}

body {
    background-color: var(--bring-bg);
    color: var(--text-main);
    font-family: 'Roboto', sans-serif;
    margin: 0; padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* --- ROBUSTE ICONS (Verhindert den iOS Safari Bug) --- */
.material-symbols-rounded {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
    display: inline-block;
}

/* --- ALLGEMEINES --- */
.app-bar-general { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; background: var(--bring-surface); box-shadow: 0 2px 10px rgba(0,0,0,0.2); }
.app-bar-general h3 { margin: 0; font-size: 20px; }
.app-bar-general a { color: var(--text-main); text-decoration: none; }
.content-wrapper { padding: 20px; max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.widget { background: var(--bring-surface); padding: 20px; border-radius: var(--radius-card); border: 1px solid rgba(255,255,255,0.05); }
.widget h4 { margin: 0 0 12px 0; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
.login-container { display: flex; justify-content: center; align-items: center; height: 100vh; }
.login-card { background: var(--bring-surface); padding: 32px; border-radius: var(--radius-card); display: flex; flex-direction: column; gap: 16px; width: 300px; border: 1px solid rgba(255,255,255,0.05); }

/* --- EINKAUFSLISTE KACHELN --- */
.bring-header { padding: 20px 20px 10px 20px; display: flex; justify-content: space-between; align-items: center; }
.bring-header h1 { font-size: 28px; margin: 0; font-weight: 700; }
.bring-avatars { display: flex; gap: 6px; align-items: center; }
.avatar { width: 32px; height: 32px; background: #ddd; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #333; font-weight: bold; }

.category-title { font-weight: 600; font-size: 15px; margin: 15px 20px 10px 20px; color: var(--text-main); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 20px 180px 20px; }

.item-card {
    background-color: var(--bring-red); border-radius: var(--radius-card); aspect-ratio: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 8px; box-sizing: border-box; cursor: pointer; transition: transform 0.1s ease;
    user-select: none; position: relative;
}
.item-card:active { transform: scale(0.92); }
.item-card .icon-main { font-size: 42px; color: white; margin-bottom: 4px; }
.item-card span { font-size: 13px; font-weight: 500; line-height: 1.15; color: white; text-align: center; }

.card-badge { position: absolute; top: 6px; left: 6px; font-size: 14px; }
.card-qty { position: absolute; top: 6px; right: 6px; font-size: 12px; font-weight: bold; background: rgba(0,0,0,0.2); padding: 2px 6px; border-radius: 10px; color: white; }
.card-desc { font-size: 10px; opacity: 0.8; margin-top: 4px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.item-card.bought { background-color: var(--bring-red-dim); }
.item-card.bought .icon-main, .item-card.bought span, .item-card.bought .card-desc, .item-card.bought .card-qty { color: var(--text-muted); opacity: 0.5; }

/* --- BOTTOM BAR & DETAILS PANEL --- */
.bottom-area { position: fixed; bottom: 0; left: 0; width: 100%; z-index: 100; }

.detail-panel {
    background-color: var(--bring-panel); border-top-left-radius: 20px; border-top-right-radius: 20px;
    padding: 20px; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
    display: flex; flex-direction: column; gap: 16px; position: absolute; bottom: 0; left: 0;
    width: 100%; box-sizing: border-box; padding-bottom: 90px; z-index: 99;
}
.detail-panel.show { transform: translateY(0); }
.detail-header { font-size: 15px; font-weight: 600; margin: 0; color: var(--text-main); display: flex; justify-content: space-between;}
.detail-header span { cursor: pointer; color: var(--text-muted); }

/* --- MENGEN-AUSWAHL (Quantity) --- */
.qty-control { display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,0.2); padding: 8px; border-radius: 12px; width: fit-content; }
.qty-btn { background: rgba(255,255,255,0.1); border: none; color: white; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.qty-btn:active { background: rgba(255,255,255,0.2); }
.qty-input { background: transparent; border: none; color: white; width: 40px; text-align: center; font-size: 18px; outline: none; font-weight: 500; }

.urgency-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { 
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); 
    color: var(--text-main); padding: 8px 12px; border-radius: 8px; 
    display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; transition: 0.2s;
}
.chip span { font-size: 16px; }
.chip.active { background: var(--bring-green); border-color: var(--bring-green); }

.desc-input { background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.1); color: white; padding: 12px; border-radius: 8px; width: 100%; box-sizing: border-box; font-size: 14px; outline: none; }

.save-btn { background: var(--bring-green); color: white; border: none; padding: 14px; border-radius: 12px; width: 100%; font-size: 16px; font-weight: 600; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 8px; }
.delete-btn { background: rgba(231, 93, 98, 0.1); color: var(--bring-red); border: 1px solid rgba(231, 93, 98, 0.2); padding: 12px; border-radius: 8px; width: 100%; font-size: 14px; display: flex; justify-content: center; align-items: center; gap: 8px; cursor: pointer; font-weight: 500;}

/* --- AUTOCOMPLETE VORSCHLÄGE --- */
.suggestions-overlay {
    display: none; position: absolute; bottom: 100%; left: 0; width: 100%;
    background: var(--bring-surface); padding: 12px 20px; box-sizing: border-box;
    border-top-left-radius: 20px; border-top-right-radius: 20px; box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    gap: 12px; overflow-x: auto;
}
.suggestions-overlay::-webkit-scrollbar { display: none; }
.suggestions-overlay.show { display: flex; }

.suggestion-card {
    background-color: rgba(255,255,255,0.05); border-radius: var(--radius-card); border: 1px solid rgba(255,255,255,0.1);
    min-width: 80px; height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 8px; cursor: pointer; flex-shrink: 0; transition: background 0.2s;
}
.suggestion-card:active { background: rgba(255,255,255,0.1); }
.suggestion-card .icon-main { font-size: 28px; color: var(--bring-green); margin-bottom: 4px; }
.suggestion-card span { font-size: 12px; font-weight: 500; color: white; text-align: center; }

.bottom-bar {
    background-color: var(--bring-surface); padding: 16px 20px; padding-bottom: env(safe-area-inset-bottom, 16px);
    display: flex; gap: 12px; align-items: center; position: relative; z-index: 100;
}
.search-pill { flex-grow: 1; background: white; border-radius: var(--radius-pill); height: 48px; display: flex; align-items: center; padding: 0 16px; }
.search-pill .search-icon { color: #888; margin-right: 8px; font-size: 22px; }
.search-pill input { border: none; outline: none; font-size: 16px; width: 100%; background: transparent; color: #333; }

.add-btn { width: 48px; height: 48px; border-radius: 50%; background-color: var(--bring-green); color: white; display: flex; align-items: center; justify-content: center; border: none; cursor: pointer; flex-shrink: 0; }