/* ── Shopping List Styles ── */
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;600;800&family=Nunito:wght@400;600;700&display=swap');

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

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, #e8f5e9 0%, #e3f2fd 100%);
  min-height: 100vh;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* Back bar */
.topbar {
  width: 100%; max-width: 540px;
  display: flex; align-items: center; gap: 10px;
}
.btn-back {
  padding: 7px 14px; border: none; border-radius: 8px;
  cursor: pointer; font-family: 'Nunito', sans-serif;
  font-weight: 700; font-size: 13px;
  background: white; color: #444; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* Card */
.card {
  width: 100%; max-width: 540px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
  overflow: hidden;
}

.card-header {
  background: #43a047;
  padding: 20px 24px 16px;
  color: white;
}
.card-header h1 {
  font-family: 'Baloo 2', cursive;
  font-size: 28px; font-weight: 800;
  margin-bottom: 14px;
}

/* Input row */
.input-row {
  display: flex; gap: 8px;
}
.input-row input {
  flex: 1;
  padding: 10px 14px;
  border: none; border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 15px; color: #222;
  outline: none;
  background: rgba(255,255,255,0.92);
}
.input-row input::placeholder { color: #aaa; }
.input-row input.shake { animation: shake 0.35s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.btn-add {
  padding: 10px 18px;
  background: #1b5e20; color: white;
  border: none; border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700; font-size: 20px;
  cursor: pointer; line-height: 1;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.1s;
}
.btn-add:active { transform: scale(0.94); background: #388e3c; }

/* Meta row */
.meta-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px 0;
  font-size: 13px; color: #888;
}
#counter { font-weight: 700; }

.btn-clear {
  display: none;
  padding: 5px 12px; border: none; border-radius: 20px;
  background: #ffebee; color: #c62828;
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 12px;
  cursor: pointer; align-items: center; gap: 4px;
  -webkit-tap-highlight-color: transparent;
}
.btn-clear:active { background: #ffcdd2; }

/* List */
#shoppingList {
  list-style: none;
  padding: 10px 16px 20px;
  display: flex; flex-direction: column; gap: 8px;
}

#shoppingList li {
  display: flex; align-items: center; gap: 10px;
  background: #f9f9f9;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 10px 12px;
  transition: background 0.2s, opacity 0.2s;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

#shoppingList li.completed {
  background: #f1f8e9;
  border-color: #c5e1a5;
  opacity: 0.75;
}
#shoppingList li.completed .item-text {
  text-decoration: line-through;
  color: #aaa;
}

#shoppingList li.empty {
  justify-content: center;
  color: #bbb; font-size: 14px;
  background: transparent; border: none;
  padding: 24px 0;
}

.check-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid #43a047;
  background: transparent;
  color: #43a047; font-size: 14px; font-weight: 800;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.1s;
}
.completed .check-btn {
  background: #43a047; color: white;
}
.check-btn:active { transform: scale(0.88); }

.item-text {
  flex: 1; font-size: 15px; color: #333;
  word-break: break-word;
}

.delete-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%; border: none;
  background: #ffebee; color: #c62828;
  font-size: 13px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.1s;
}
.delete-btn:active { background: #ffcdd2; transform: scale(0.88); }
