/* BaoBao ♡ Shared Styles */

:root {
  --peach: #ffd9d2;
  --peach-deep: #ffb3a7;
  --sakura: #ffc8dd;
  --sakura-deep: #ff8fab;
  --sakura-glow: #ffafc5;
  --cream: #fff8f3;
  --gold: #d4a574;
  --sage: #c8d5b9;
  --lavender: #e0c3fc;
  --mint: #d4f1e6;
  --ink: #5a3d3d;
  --ink-soft: #8b6b6b;
  --ink-light: #b89a9a;
  --shadow: rgba(255, 143, 171, 0.25);
  --white-glass: rgba(255, 255, 255, 0.75);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Quicksand', sans-serif;
  background:
    radial-gradient(circle at 10% 20%, var(--peach) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, var(--sakura) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, var(--lavender) 0%, transparent 70%),
    var(--cream);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 100px;
}

/* ─── Floating decorations ─── */
.floating-deco {
  position: fixed;
  pointer-events: none;
  opacity: 0.55;
  z-index: 0;
  animation: float 8s ease-in-out infinite;
  will-change: transform;
}
.floating-deco:nth-child(1) { top: 8%; left: 5%; font-size: 2rem; animation-delay: 0s; }
.floating-deco:nth-child(2) { top: 22%; right: 8%; font-size: 1.8rem; animation-delay: 1.5s; }
.floating-deco:nth-child(3) { top: 55%; left: 3%; font-size: 2.2rem; animation-delay: 3s; }
.floating-deco:nth-child(4) { top: 75%; right: 5%; font-size: 1.5rem; animation-delay: 4.5s; }
.floating-deco:nth-child(5) { top: 40%; right: 15%; font-size: 1.7rem; animation-delay: 2s; }
.floating-deco:nth-child(6) { top: 90%; left: 10%; font-size: 1.9rem; animation-delay: 5s; }
.floating-deco:nth-child(7) { top: 15%; left: 50%; font-size: 1.6rem; animation-delay: 3.8s; }
.floating-deco:nth-child(8) { top: 65%; right: 40%; font-size: 1.5rem; animation-delay: 6s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-15px) rotate(8deg); }
  50% { transform: translateY(-25px) rotate(-5deg); }
  75% { transform: translateY(-10px) rotate(10deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bobble {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-4px) rotate(-3deg); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  10%, 30% { transform: scale(1.15); }
  20% { transform: scale(0.95); }
  40% { transform: scale(1.05); }
  50% { transform: scale(1); }
}

@keyframes sparkle {
  0%, 100% { opacity: 0.5; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ─── Top Navigation ─── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 248, 243, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 143, 171, 0.15);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .heart {
  color: var(--sakura-deep);
  animation: heartBeat 2s ease-in-out infinite;
  display: inline-block;
}

.brand-chinese {
  font-family: 'Ma Shan Zheng', cursive;
  color: var(--sakura-deep);
  font-size: 1.2rem;
  opacity: 0.75;
  margin-left: 6px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 14px;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.nav-link:hover {
  background: rgba(255, 143, 171, 0.12);
  color: var(--sakura-deep);
}

.nav-link.active {
  background: var(--sakura-deep);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 143, 171, 0.35);
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--ink-light);
  cursor: pointer;
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  padding: 6px 12px;
  border-radius: 10px;
  transition: all 0.2s;
}

.logout-btn:hover {
  color: var(--sakura-deep);
  background: rgba(255, 143, 171, 0.1);
}

/* ─── Header ─── */
header.page-header {
  text-align: center;
  padding: 50px 20px 30px;
  position: relative;
  z-index: 1;
}

.chinese-title {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: clamp(2.5rem, 6vw, 4rem);
  color: var(--sakura-deep);
  margin-bottom: 8px;
  opacity: 0.85;
  letter-spacing: 0.1em;
  animation: gentleSway 4s ease-in-out infinite;
}

@keyframes gentleSway {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1deg); }
}

h1.page-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-style: italic;
  font-size: clamp(2.8rem, 7vw, 5rem);
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 12px;
}

h1.page-title .heart {
  display: inline-block;
  color: var(--sakura-deep);
  animation: heartBeat 1.8s ease-in-out infinite;
  margin: 0 8px;
}

.page-subtitle {
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* ─── Progress ─── */
.progress-wrap {
  max-width: 500px;
  margin: 30px auto 0;
  padding: 0 20px;
}

.progress-label {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 10px;
}

.progress-label strong {
  color: var(--sakura-deep);
  font-weight: 700;
}

.progress-bar {
  height: 16px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(255, 143, 171, 0.15);
  border: 2px solid white;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--peach-deep), var(--sakura-deep), var(--lavender));
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
  border-radius: 20px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px var(--shadow);
}

/* ─── Main ─── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* ─── Categories ─── */
.category {
  margin-bottom: 50px;
  animation: slideUp 0.6s ease-out backwards;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding: 0 12px;
  flex-wrap: wrap;
}

.category-emoji {
  font-size: 2.4rem;
  filter: drop-shadow(0 4px 8px rgba(255, 143, 171, 0.3));
  animation: bobble 3s ease-in-out infinite;
}

.category-title {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 1.9rem;
  color: var(--ink);
  font-weight: 600;
}

.category-chinese {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 1.4rem;
  color: var(--sakura-deep);
  opacity: 0.75;
}

.category-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px solid rgba(255, 143, 171, 0.3);
  border-radius: 12px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all 0.2s;
  font-size: 0.9rem;
}

.icon-btn:hover {
  background: var(--sakura);
  color: white;
  border-color: var(--sakura-deep);
  transform: scale(1.1);
}

.icon-btn.danger:hover {
  background: #ff6b8a;
  border-color: #ff6b8a;
}

/* ─── Item Grid ─── */
.items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.item {
  background: var(--white-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 18px 20px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 20px rgba(255, 143, 171, 0.1);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  animation: slideUp 0.5s ease-out backwards;
}

.item:hover {
  transform: translateY(-4px) rotate(-0.5deg);
  box-shadow: 0 14px 28px rgba(255, 143, 171, 0.25);
  border-color: var(--sakura);
}

.checkbox {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--sakura-deep);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
  transition: all 0.3s;
  background: white;
}

.checkbox::after {
  content: '♡';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0);
  color: white;
  font-size: 15px;
  font-weight: bold;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.item.done .checkbox {
  background: var(--sakura-deep);
  border-color: var(--sakura-deep);
  transform: scale(1.1);
  animation: heartBeat 0.6s ease;
}

.item.done .checkbox::after {
  transform: translate(-50%, -50%) scale(1);
}

.item.done .item-text {
  text-decoration: line-through;
  text-decoration-color: var(--sakura-deep);
  text-decoration-thickness: 2px;
  opacity: 0.55;
}

.item.done {
  background: linear-gradient(135deg, rgba(255, 217, 210, 0.4), rgba(255, 200, 221, 0.4));
}

.item-content {
  flex: 1;
  min-width: 0;
}

.item-text {
  font-family: 'Quicksand', sans-serif;
  font-weight: 500;
  font-size: 1.02rem;
  color: var(--ink);
  line-height: 1.4;
  transition: all 0.3s;
  word-wrap: break-word;
}

.item-note {
  font-family: 'Caveat', cursive;
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-top: 2px;
  display: block;
}

.item-delete {
  background: none;
  border: none;
  color: var(--ink-light);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: 8px;
  opacity: 0;
  transition: all 0.2s;
  align-self: flex-start;
}

.item:hover .item-delete {
  opacity: 1;
}

.item-delete:hover {
  color: #ff4d6d;
  background: rgba(255, 77, 109, 0.1);
}

/* ─── Add buttons inline ─── */
.add-item-btn {
  background: rgba(255, 255, 255, 0.5);
  border: 2px dashed var(--sakura);
  border-radius: 20px;
  padding: 18px 20px;
  cursor: pointer;
  color: var(--sakura-deep);
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  font-weight: 700;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 70px;
}

.add-item-btn:hover {
  background: var(--sakura);
  color: white;
  transform: scale(1.02);
}

.add-category-card {
  background: rgba(255, 255, 255, 0.5);
  border: 2.5px dashed var(--sakura);
  border-radius: 24px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  font-family: 'Caveat', cursive;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--sakura-deep);
  margin-bottom: 50px;
  transition: all 0.3s;
}

.add-category-card:hover {
  background: rgba(255, 200, 221, 0.4);
  transform: scale(1.01);
  border-style: solid;
}

/* ─── Floating action button ─── */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 20;
}

.fab-btn {
  background: white;
  border: 2px solid var(--sakura);
  color: var(--sakura-deep);
  padding: 12px 18px;
  border-radius: 30px;
  font-family: 'Caveat', cursive;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(255, 143, 171, 0.3);
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.fab-btn:hover {
  transform: scale(1.05) rotate(-2deg);
  background: var(--sakura);
  color: white;
}

.fab-btn.primary {
  background: linear-gradient(135deg, var(--peach-deep), var(--sakura-deep));
  color: white;
  border-color: transparent;
}

.fab-btn.primary:hover {
  background: linear-gradient(135deg, var(--sakura-deep), var(--peach-deep));
  color: white;
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(91, 61, 61, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--cream);
  border-radius: 28px;
  padding: 32px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(255, 143, 171, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 2px solid white;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-title {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
  text-align: center;
}

.modal-sub {
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-family: 'Caveat', cursive;
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
  margin-left: 8px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid rgba(255, 143, 171, 0.25);
  border-radius: 16px;
  font-family: 'Quicksand', sans-serif;
  font-size: 1rem;
  background: white;
  color: var(--ink);
  outline: none;
  transition: all 0.2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--sakura-deep);
  box-shadow: 0 0 0 4px rgba(255, 143, 171, 0.12);
}

.form-textarea {
  resize: vertical;
  min-height: 90px;
  font-family: 'Quicksand', sans-serif;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.btn {
  flex: 1;
  padding: 14px 20px;
  border-radius: 16px;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--peach-deep), var(--sakura-deep));
  color: white;
  box-shadow: 0 6px 18px rgba(255, 143, 171, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255, 143, 171, 0.45);
}

.btn-secondary {
  background: white;
  color: var(--ink-soft);
  border: 2px solid rgba(255, 143, 171, 0.3);
}

.btn-secondary:hover {
  background: rgba(255, 143, 171, 0.1);
}

/* ─── Confetti ─── */
.confetti {
  position: fixed;
  pointer-events: none;
  font-size: 1.6rem;
  z-index: 200;
  animation: confettiFall 1.4s ease-out forwards;
}

@keyframes confettiFall {
  0% { transform: translate(0, 0) rotate(0deg) scale(0.5); opacity: 1; }
  20% { transform: translate(calc(var(--tx) * 0.4), calc(var(--ty) * 0.4 - 30px)) rotate(180deg) scale(1.2); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) rotate(720deg) scale(0.8); opacity: 0; }
}

/* ─── Heart explosion ─── */
.heart-burst {
  position: fixed;
  pointer-events: none;
  z-index: 200;
  font-size: 2rem;
  color: var(--sakura-deep);
  animation: heartBurst 1.6s ease-out forwards;
}

@keyframes heartBurst {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  50% { transform: translate(-50%, calc(-50% + var(--rise))) scale(1.3); opacity: 1; }
  100% { transform: translate(-50%, calc(-50% + var(--rise) * 2)) scale(0.8); opacity: 0; }
}

/* ─── Footer ─── */
footer {
  text-align: center;
  margin-top: 60px;
  padding: 30px 20px;
  font-family: 'Caveat', cursive;
  color: var(--ink-soft);
  font-size: 1.3rem;
  position: relative;
  z-index: 1;
}

footer .heart {
  color: var(--sakura-deep);
  display: inline-block;
  animation: heartBeat 1.8s ease-in-out infinite;
}

/* ─── Empty states ─── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  font-family: 'Caveat', cursive;
  color: var(--ink-soft);
}

.empty-state-emoji {
  font-size: 4rem;
  margin-bottom: 16px;
  display: block;
  animation: bobble 3s ease-in-out infinite;
}

.empty-state-text {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.empty-state-sub {
  font-size: 1.15rem;
  color: var(--ink-light);
}

/* ─── Mobile ─── */
@media (max-width: 600px) {
  .topnav { padding: 12px 16px; }
  .brand { font-size: 1.25rem; }
  .nav-link { padding: 6px 10px; font-size: 0.85rem; }
  header.page-header { padding: 30px 16px 20px; }
  main { padding: 12px; }
  .category-title { font-size: 1.4rem; }
  .category-emoji { font-size: 1.9rem; }
  .items { grid-template-columns: 1fr; }
  .modal { padding: 24px; }
  .fab-btn { padding: 10px 14px; font-size: 1rem; }
}
