/* --- SMARTCART GOLD PALETTE --- */
:root {
    --bg: #272727; 
    --text: #EFF1F3; 
    --text-dim: #8D8C95;
    --accent: #FED766; 
    --teal: #009FB7;
    --danger: #ff453a;
    --card-bg: rgba(255,255,255, 0.05); 
    --border: rgba(255,255,255,0.08);
    
    /* SHOPS (Nur noch für Badges, nicht mehr für Stats) */
    --s-lidl: #0050aa; --s-tesco: #004d95; --s-aldi: #0093cf; --s-dm: #4a2c85; --s-spar: #006633; 
    --s-obi: #e0731a; --s-fressnapf: #8a1c1c; --s-kik: #e3000f; --s-praktiker: #f26f21; --s-sonst: #3a3a3c;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; scrollbar-width: none; }
::-webkit-scrollbar { display: none; }

html { height: 100%; overflow: hidden; }
body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; position: absolute; top: 0; left: 0; right: 0; bottom: 0; height: 100%; width: 100%; display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; }

/* --- HEADER BEREICH --- */
.hero-header { width: 100%; padding: max(20px, calc(env(safe-area-inset-top) + 5px)) 20px 0 20px; background: rgba(39, 39, 39, 0.45); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px); flex-shrink: 0; z-index: 50; border-bottom: none; }

/* Obere Zeile: Buttons Links - Titel Mitte - Buttons Rechts */
.top-row { 
    display: grid; 
    grid-template-columns: 1fr auto 1fr; 
    align-items: center; 
    margin-bottom: 5px; 
}

.header-left { display: flex; justify-content: flex-start; }
.header-right { display: flex; justify-content: flex-end; gap: 10px; }

.app-title { font-weight: 800; letter-spacing: 1px; color: var(--text-dim); font-size: 0.75rem; text-transform: uppercase; text-align: center; }

.icon-btn { background: var(--card-bg); border: none; color: var(--text-dim); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 1.1rem; transition: 0.2s; }
.icon-btn:active { background: var(--accent); color: var(--bg); transform: scale(0.9); }

/* Untere Zeile: Preis Links - Pfand Rechts (Getrennt) */
.hero-price-row {
    display: flex;
    align-items: flex-end; /* Auf einer Linie unten bündig */
    justify-content: space-between; /* Auseinanderdrücken */
    padding: 0 20px 10px 20px; /* Luft zum Rand */
}

.main-price-wrap { font-size: 2.8rem; font-weight: 800; line-height: 1; color: var(--accent); letter-spacing: -1px; transition: color 0.3s; }
.main-price-wrap.credit { color: #00e676; } 
.main-price-wrap small { font-size: 1rem; font-weight: 600; color: var(--text-dim); margin-left: 4px; }

/* Pfand-Eingabe (Rechtsbündig) */
.pfand-inline-wrapper { 
    display: flex; 
    align-items: center; 
    gap: 4px; 
    color: var(--accent); 
    opacity: 0.8;
    margin-bottom: 5px; 
}
.pfand-inline-wrapper i { font-size: 0.9rem; }
.pfand-inline-wrapper input { 
    border: none; 
    background: transparent; 
    color: inherit; 
    font-weight: 700; 
    font-size: 1.1rem;
    min-width: 30px; 
    max-width: 70px; 
    padding: 0; 
    margin: 0;
    text-align: right; 
}
.pfand-inline-wrapper input::placeholder { color: var(--text-dim); opacity: 0.5; }

/* --- SUB-HEADER (Filter & Mini-Stats) --- */
.sub-header { width: 100%; padding-bottom: 10px; background: rgba(39, 39, 39, 0.45); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px); border-bottom: 1px solid var(--border); z-index: 40; flex-shrink: 0; }
.filter-scroll { width: 100%; overflow-x: auto; padding: 5px 20px; }
.filter-track { display: flex; gap: 8px; width: max-content; }
.chip { background: var(--card-bg); color: var(--text); padding: 6px 14px; border-radius: 18px; font-weight: 600; font-size: 0.85rem; white-space: nowrap; border: 1px solid transparent; transition: 0.2s; }
.chip.active { background: var(--accent); color: var(--bg); border-color: var(--accent); transform: scale(1.02); }

.stats-bar { display: flex; justify-content: space-between; padding: 10px 25px 0 25px; }
.stat { display: flex; flex-direction: column; align-items: center; }
.s-val { font-size: 1.1rem; font-weight: 800; color: var(--accent); }
.stat.dim .s-val { color: var(--text); }
.s-lbl { font-size: 0.65rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; margin-top: 2px; }

/* --- HAUPTLISTE --- */
.content-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 15px 15px 180px 15px; width: 100%; position: relative; z-index: 1; }
.empty-placeholder { text-align: center; margin-top: 50px; color: var(--text-dim); font-size: 0.9rem; }
.group-title { font-size: 0.75rem; font-weight: 800; color: var(--text-dim); text-transform: uppercase; margin: 20px 0 10px 5px; }

/* Gruppen Header */
.group-header { display: flex; justify-content: space-between; align-items: center; padding: 25px 5px 10px 5px; cursor: pointer; color: var(--text-dim); font-weight: 800; font-size: 0.85rem; text-transform: uppercase; background: transparent; position: relative; }
.group-header i { transition: transform 0.3s; }
.group-header i.collapsed { transform: rotate(-90deg); }
.group-header span small { font-weight: 500; opacity: 0.6; margin-left: 5px; }
.group-list-wrap { padding-top: 5px; margin-bottom: 10px; display: block; position: relative; }

/* Artikel Karte */
.item-card { background: var(--card-bg); padding: 14px; margin-bottom: 10px; border-radius: 18px; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border); width: 100%; position: relative; z-index: 2; cursor: pointer; transition: 0.1s; touch-action: manipulation; }
.item-card:active { transform: scale(0.98); background: rgba(255,255,255,0.1); }
.item-card.done { opacity: 0.5; border-color: transparent; }
.item-card.done .i-name { text-decoration: line-through; }
.card-left { display: flex; align-items: center; gap: 0; overflow: hidden; flex: 1; }
.check-box { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--text-dim); display: grid; place-items: center; flex-shrink: 0; margin-right: 15px; position: relative; }
.check-box::after { content: ''; position: absolute; top: -15px; bottom: -15px; left: -15px; right: -15px; z-index: 10; }
.item-card.done .check-box { background: var(--teal); border-color: var(--teal); color: var(--bg); }
.check-box i { font-size: 1rem; opacity: 0; pointer-events: none; }
.item-card.done .check-box i { opacity: 1; }
.i-info { overflow: hidden; }
.i-name { font-size: 1rem; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.i-meta { display: flex; gap: 6px; align-items: center; font-size: 0.75rem; font-weight: 600; color: var(--text-dim); }
.cat-icon { margin-left: 4px; color: var(--teal); opacity: 0.7; }
.badge { padding: 2px 6px; border-radius: 4px; color: white; }
.badge.qty { background: rgba(254, 215, 102, 0.2); color: var(--accent); }
.i-price { font-size: 1rem; font-weight: 700; color: var(--text); margin-left: 10px; white-space: nowrap; }

/* --- BOTTOM DOCK (Eingabe) --- */
.bottom-dock { position: fixed; bottom: 0; left: 0; right: 0; z-index: 100; background: transparent; pointer-events: none; display: flex; flex-direction: column; justify-content: flex-end; padding: 12px 15px 15px 15px; }
.bottom-dock::before { content: ''; position: absolute; inset: 0; background: rgba(39, 39, 39, 0.45); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px); border-top: 1px solid rgba(255,255,255,0.05); box-shadow: 0 -5px 20px rgba(0,0,0,0.1); border-radius: 20px 20px 0 0; -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.25) 0%, black 15px, black 100%); mask-image: linear-gradient(to bottom, rgba(0,0,0,0.25) 0%, black 15px, black 100%); z-index: -1; }
.suggestion-rail { position: absolute; bottom: 100%; left: 0; width: 100%; display: flex; gap: 8px; overflow-x: auto; padding: 10px 10px 15px 10px; background: linear-gradient(to top, rgba(39,39,39,0.5) 20%, transparent); opacity: 0; pointer-events: none; transition: 0.3s; }
.suggestion-rail.show { opacity: 1; pointer-events: auto; }
.sugg-pill { background: #1e1e1e; border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; white-space: nowrap; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.sugg-pill.exists { background: rgba(255, 69, 58, 0.2); border-color: var(--danger); color: #ff8a84; }

.input-bar { pointer-events: auto; background: transparent; border: 2px solid rgba(255,255,255,0.1); padding: 8px 8px 8px 20px; border-radius: 30px; display: flex; gap: 10px; width: 100%; align-items: center; margin: 0; transition: all 0.2s ease; }
.input-bar:focus-within { border-color: var(--accent); background: rgba(254, 215, 102, 0.05); box-shadow: 0 0 15px rgba(254, 215, 102, 0.15); transform: scale(1.01); }
.input-bar input { flex: 1; background: transparent; border: none; padding: 4px 0; color: var(--text); font-size: 1.1rem; font-weight: 500; min-width: 0; text-transform: capitalize; }
.input-bar button { width: 42px; height: 42px; border-radius: 50%; border: none; background: var(--accent); color: var(--bg); font-size: 1.4rem; display: grid; place-items: center; flex-shrink: 0; transition: 0.1s; }
.input-bar button:active { transform: scale(0.95); }

/* --- FAB (Buttons) --- */
.fab-container { position: fixed; bottom: 100px; right: 20px; display: flex; flex-direction: column; gap: 15px; z-index: 999; transition: opacity 0.3s, transform 0.3s; }
.fab-container.hidden { opacity: 0; transform: translateY(20px); pointer-events: none; }
.fab { width: 44px; height: 44px; border-radius: 14px; border: none; display: grid; place-items: center; font-size: 1.1rem; box-shadow: 0 5px 15px rgba(0,0,0,0.3); transition: 0.1s; }
.fab:active { transform: scale(0.95); }
.fab.secondary { background: var(--card-bg); color: var(--text-dim); border: 1px solid var(--border); }
.fab.primary { background: var(--teal); color: white; }
.fab:disabled { opacity: 0; transform: scale(0.5); pointer-events: none; }

/* TREND ICON */
.trend-icon { font-size: 1.2rem; margin-right: 5px; font-weight: 800; display: none; }
.trend-up { color: #ff453a; display: inline-block; }
.trend-down { color: #00e676; display: inline-block; }

/* --- MODALS (Edit, Archiv, Stats) --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 200; display: none; align-items: flex-end; justify-content: center; opacity: 0; transition: 0.3s; pointer-events: none; }
.modal-overlay.open { display: flex; opacity: 1; pointer-events: auto; }
.modal-card { background: #1e1e1e; width: 100%; border-radius: 25px 25px 0 0; padding: 25px 20px; padding-bottom: 50vh; margin-bottom: -45vh; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); border-top: 1px solid var(--border); max-height: 90vh; overflow-y: auto; }
.modal-overlay.open .modal-card { transform: translateY(0); }
.modal-card.full { height: 90vh; display: flex; flex-direction: column; padding-bottom: 30px; margin-bottom:0; }
.modal-drag-bar { width: 40px; height: 4px; background: rgba(255,255,255,0.1); border-radius: 10px; margin: -10px auto 20px auto; }
.modal-card h2 { margin: 0; font-size: 1.5rem; color: var(--text); }
.modal-sub { color: var(--text-dim); font-weight: 600; margin: 4px 0 20px 0; font-size: 0.85rem; }

/* Horizontale Strips (Shops/Cats) */
.scroll-strip { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; gap: 8px; overflow-x: auto; padding: 10px 5px 15px 15px; margin-bottom: 15px; -webkit-overflow-scrolling: touch; width: 100%; scrollbar-width: none; }
.scroll-strip::-webkit-scrollbar { display: none; }
.strip-btn { background: var(--card-bg); border-radius: 12px; padding: 10px 14px; text-align: center; font-size: 0.8rem; font-weight: 700; color: var(--text-dim); border: 1px solid transparent; white-space: nowrap; transition: 0.2s; flex-shrink: 0; display: flex; align-items: center; gap: 6px; }
.strip-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(254, 215, 102, 0.05); transform: scale(1.02); }
.strip-btn i { font-size: 1rem; }

/* Controls im Edit Modal */
.controls-row { display: flex; gap: 15px; margin-bottom: 25px; }
.stepper { display: flex; align-items: center; background: var(--card-bg); border-radius: 16px; padding: 4px; }
.stepper button { width: 40px; height: 40px; background: transparent; border: none; color: var(--text); font-size: 1.5rem; }
.stepper span { width: 30px; text-align: center; font-weight: 700; font-size: 1.1rem; }

/* Preis Input mit Pfand Button */
.price-input { flex: 1; background: var(--card-bg); border-radius: 16px; display: flex; align-items: center; padding: 0 10px; }
.price-input input { flex: 1; background: transparent; border: none; color: var(--accent); font-size: 1.4rem; font-weight: 700; text-align: right; width: 100%; }
.price-input span.currency { margin-left: 8px; font-weight: 600; color: var(--text-dim); font-size: 0.9rem; }

/* Der kleine Pfand-Toggle Button */
.deposit-btn { width: 44px; height: 44px; border-radius: 12px; border: none; background: transparent; color: var(--text-dim); font-size: 1.2rem; margin-right: 5px; transition: 0.2s; display: grid; place-items: center; }
.deposit-btn.active { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.deposit-btn:active { transform: scale(0.9); }

.big-save-btn { width: 100%; padding: 16px; border-radius: 18px; border: none; font-size: 1rem; font-weight: 800; background: var(--accent); color: var(--bg); margin-bottom: 15px; }
.modal-actions { display: flex; justify-content: space-between; padding: 0 10px; margin-top: 10px; }
.modal-actions button { background: transparent; border: none; font-weight: 600; font-size: 0.9rem; padding: 10px; }
.text-danger { color: #ff453a; } .text-dim { color: var(--text-dim); }

.history-scroll { margin-bottom: 20px; max-height: 150px; overflow-y: auto; background: rgba(0,0,0,0.2); border-radius: 12px; padding: 5px; border: 1px solid var(--border); }
.hist-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.85rem; }
.hist-row:last-child { border-bottom: none; }
.h-date { color: var(--text-dim); font-size: 0.75rem; width: 60px; }
.h-shop { flex: 1; font-weight: 600; padding: 0 10px; display: flex; align-items: center; gap: 6px; }
.h-shop-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.h-price { font-weight: 700; color: var(--text); text-align: right; min-width: 60px; }

/* Archiv & Modal Header */
.modal-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.close-icon { width: 32px; height: 32px; background: var(--card-bg); border-radius: 50%; border:none; color:var(--text); }
.search-box { background: var(--card-bg); padding: 10px 15px; border-radius: 16px; display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.search-box input { border: none; background: transparent; font-size: 1rem; flex: 1; color: var(--text); }
.archive-list { flex: 1; overflow-y: auto; }
.arch-item { display: flex; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid var(--border); align-items: center; }
.btn-restore { background: rgba(0, 159, 183, 0.15); color: var(--teal); border: none; padding: 6px 12px; border-radius: 10px; font-weight: 700; font-size: 0.8rem; }

/* --- GOLDEN DASHBOARD STATS --- */
.stats-hero { text-align: center; margin: 30px 0 20px 0; }
.sh-label { color: var(--text-dim); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; margin-top: 5px; }
.sh-val { font-size: 3.5rem; font-weight: 800; color: var(--accent); letter-spacing: -1px; line-height: 1; }

.stats-period-selector { display: flex; gap: 8px; margin-bottom: 25px; background: var(--card-bg); padding: 4px; border-radius: 16px; }
.period-btn { flex: 1; background: transparent; border: none; color: var(--text-dim); padding: 10px; border-radius: 12px; font-weight: 700; font-size: 0.85rem; transition: 0.2s; }
.period-btn.active { background: var(--bg); color: var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,0.2); }

.stats-type-switch { display: flex; justify-content: center; gap: 20px; margin-bottom: 20px; }
.switch-btn { background: transparent; border: none; color: var(--text-dim); font-weight: 700; font-size: 0.9rem; padding-bottom: 5px; border-bottom: 2px solid transparent; transition: 0.2s; opacity: 0.5; }
.switch-btn.active { color: var(--text); border-color: var(--accent); opacity: 1; }

.stats-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 30px; }

.golden-row { 
    position: relative; 
    height: 50px; 
    width: 100%; 
    border-radius: 12px; 
    overflow: hidden; 
    background: rgba(255,255,255,0.02); 
    display: flex;
    align-items: center;
    padding: 0 15px;
    cursor: pointer; 
}

.golden-bar { 
    position: absolute; 
    top: 0; left: 0; bottom: 0; 
    background: var(--accent); 
    border-radius: 12px; 
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); 
    z-index: 0;
    opacity: 0.8; 
}

.golden-content { 
    position: relative; 
    z-index: 1; 
    display: flex; 
    justify-content: space-between; 
    width: 100%; 
    font-weight: 700; 
    color: var(--bg); 
    text-shadow: 0 1px 0 rgba(255,255,255,0.2);
}

.g-name { text-transform: capitalize; font-size: 1rem; }
.g-val { font-family: monospace; font-size: 1.1rem; letter-spacing: -0.5px; }

#toast { position: fixed; top: calc(env(safe-area-inset-top) + 15px); left: 50%; transform: translateX(-50%) translateY(-200%); background: var(--accent); color: var(--bg); padding: 12px 30px; border-radius: 30px; font-weight: 800; font-size: 0.9rem; opacity: 0; pointer-events: none; transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 2000; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
