/* =============================================
   DESIGN TOKENS
   ============================================= */
:root {
  --primary: #6c63ff;
  --primary-dark: #4f46e5;
  --primary-light: #ede9fe;
  --success: #22c55e;
  --success-light: #dcfce7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --bg: #f5f4ff;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --text-light: #9ca3af;

  /* category accent colors */
  --cat-food:      #f97316; /* laranja */
  --cat-beverage:  #06b6d4; /* ciano */
  --cat-cleaning:  #8b5cf6; /* roxo */
  --cat-hygiene:   #ec4899; /* rosa */
  --cat-dairy:     #fbbf24; /* amarelo */
  --cat-meat:      #ef4444; /* vermelho */
  --cat-frozen:    #3b82f6; /* azul */
  --cat-bakery:    #d97706; /* âmbar */
  --cat-other:     #6b7280; /* cinza */

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(108,99,255,.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.08);
  --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 90px;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
}

ul { list-style: none; }

/* =============================================
   HEADER
   ============================================= */
.app-header {
  background: linear-gradient(135deg, #6c63ff 0%, #4f46e5 100%);
  color: #fff;
  padding: 20px 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(108,99,255,.35);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
}

.header-text h1 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.2;
}

.header-text p {
  font-size: .78rem;
  opacity: .8;
  margin-top: 2px;
}

/* =============================================
   SHARE BUTTON
   ============================================= */
.btn-share {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.18);
  border: 1.5px solid rgba(255,255,255,.3);
  color: #fff;
  border-radius: 30px;
  padding: 8px 14px;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition);
  backdrop-filter: blur(6px);
}

.btn-share:active,
.btn-share:hover {
  background: rgba(255,255,255,.28);
}

/* =============================================
   TOAST
   ============================================= */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: #fff;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: .85rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity .25s, transform .25s;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =============================================
   ADD SECTION
   ============================================= */
.add-section {
  background: var(--surface);
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 84px;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.add-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

#item-input {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition);
}

#item-input:focus {
  border-color: var(--primary);
  background: #fff;
}

#item-input::placeholder {
  color: var(--text-light);
}

.btn-add {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}

.btn-add:active {
  background: var(--primary-dark);
  transform: scale(.94);
}

.hint-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.hint {
  font-size: .75rem;
  color: var(--text-muted);
}

.btn-danger-sm {
  background: none;
  border: 1.5px solid var(--danger);
  color: var(--danger);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .75rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
}

.btn-danger-sm:active,
.btn-danger-sm:hover {
  background: var(--danger);
  color: #fff;
}

/* =============================================
   FILTER TABS
   ============================================= */
.filter-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 164px;
  z-index: 80;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-tab {
  flex-shrink: 0;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .8rem;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}

.filter-tab.active {
  background: var(--primary);
  color: #fff;
}

/* =============================================
   LIST AREA
   ============================================= */
.list-area {
  padding: 14px 16px;
}

/* empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  display: none;
}

.empty-state.visible {
  display: block;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: .95rem;
  line-height: 1.6;
}

/* =============================================
   CATEGORY GROUP
   ============================================= */
.category-group {
  margin-bottom: 20px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 0 2px;
}

.cat-badge {
  font-size: 1.1rem;
  line-height: 1;
}

.cat-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
}

.cat-count {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-light);
  margin-left: auto;
}

/* =============================================
   ITEM CARD
   ============================================= */
.item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid transparent;
  transition: opacity var(--transition), transform var(--transition);
  animation: slideIn .2s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.item-card.checked-card {
  opacity: .55;
}

/* category left border colors */
.item-card[data-cat="food"]      { border-color: var(--cat-food); }
.item-card[data-cat="beverage"]  { border-color: var(--cat-beverage); }
.item-card[data-cat="cleaning"]  { border-color: var(--cat-cleaning); }
.item-card[data-cat="hygiene"]   { border-color: var(--cat-hygiene); }
.item-card[data-cat="dairy"]     { border-color: var(--cat-dairy); }
.item-card[data-cat="meat"]      { border-color: var(--cat-meat); }
.item-card[data-cat="frozen"]    { border-color: var(--cat-frozen); }
.item-card[data-cat="bakery"]    { border-color: var(--cat-bakery); }
.item-card[data-cat="other"]     { border-color: var(--cat-other); }

/* =============================================
   CUSTOM CHECKBOX
   ============================================= */
.item-check {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
}

.item-check:checked {
  background: var(--success);
  border-color: var(--success);
}

.item-check:checked::after {
  content: '✓';
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* =============================================
   ITEM TEXT
   ============================================= */
.item-name {
  flex: 1;
  font-size: .97rem;
  font-weight: 500;
  color: var(--text);
  transition: text-decoration var(--transition), color var(--transition);
  word-break: break-word;
}

.item-name.striked {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* =============================================
   DELETE BUTTON
   ============================================= */
.btn-delete {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-light);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
}

.btn-delete:active,
.btn-delete:hover {
  color: var(--danger);
  background: var(--danger-light);
}

/* =============================================
   BOTTOM BAR
   ============================================= */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,.07);
}

#summary-text {
  font-size: .82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-uncheck-all {
  background: none;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}

.btn-uncheck-all:active,
.btn-uncheck-all:hover {
  background: var(--primary);
  color: #fff;
}

/* =============================================
   CATEGORY FILTER COLORS (tab pills)
   ============================================= */
.filter-tab[data-cat="food"].active      { background: var(--cat-food); }
.filter-tab[data-cat="beverage"].active  { background: var(--cat-beverage); }
.filter-tab[data-cat="cleaning"].active  { background: var(--cat-cleaning); }
.filter-tab[data-cat="hygiene"].active   { background: var(--cat-hygiene); }
.filter-tab[data-cat="dairy"].active     { background: var(--cat-dairy); }
.filter-tab[data-cat="meat"].active      { background: var(--cat-meat); }
.filter-tab[data-cat="frozen"].active    { background: var(--cat-frozen); }
.filter-tab[data-cat="bakery"].active    { background: var(--cat-bakery); }
.filter-tab[data-cat="other"].active     { background: var(--cat-other); }

/* =============================================
   INSTALL BANNER
   ============================================= */
.install-banner {
  background: var(--primary-light);
  color: var(--text);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .85rem;
  font-weight: 600;
  border-bottom: 1px solid var(--primary);
}

.btn-install-banner {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-install-banner:active,
.btn-install-banner:hover {
  background: var(--primary-dark);
}

