/* ==========================================================================
   Components — PetLife App UI components
   ========================================================================== */

/* --- Card --- */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

/* --- Button --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-base);
  transition: all var(--timing-fast) ease;
  min-height: 48px;
  width: 100%;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}
.btn-primary:active { opacity: 0.85; transform: scale(0.98); }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-sub);
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  background: var(--color-accent);
  color: #fff;
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
}

/* --- Input --- */
.input-group {
  margin-bottom: var(--space-md);
}

.input-group label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-main);
  margin-bottom: var(--space-xs);
}

.input-group input,
.input-group select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid #D0D7DE;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  background: var(--color-bg-card);
  transition: border-color var(--timing-fast);
}

.input-group input:focus,
.input-group select:focus {
  border-color: var(--color-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15);
}

[data-pet-type="cat"] .input-group input:focus,
[data-pet-type="cat"] .input-group select:focus {
  box-shadow: 0 0 0 3px rgba(255, 165, 0, 0.15);
}

/* --- Section header --- */
.section-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.section-header h3 {
  margin-bottom: 0;
}

/* --- Checklist --- */
.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid #F0F0F0;
}

.checklist-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--color-accent);
}

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  color: var(--color-text-sub);
}

.empty-state .emoji {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

/* --- Bottom Nav --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: var(--color-bg-card);
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-around;
  padding: var(--space-sm) 0;
  z-index: var(--z-sticky);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: var(--font-size-xs);
  color: var(--color-text-sub);
  padding: var(--space-xs);
  transition: color var(--timing-fast);
}

.nav-item.active {
  color: var(--color-accent);
}

.nav-item .nav-icon {
  font-size: 1.25rem;
}

/* --- Top bar --- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-md);
}

/* --- Photo grid --- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xs);
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* --- Timeline section --- */
.timeline-section {
  margin-bottom: var(--space-lg);
}

.timeline-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-sub);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid #E8E8E8;
  margin-bottom: var(--space-sm);
}

/* --- Product card --- */
.product-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  border: 1px solid #E8E8E8;
}

.product-card .price {
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  margin: var(--space-sm) 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

/* --- Confetti --- */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-celebration);
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* --- Modal / Overlay --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-md);
}

.modal-content {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
}

/* --- Toggle --- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  border-bottom: 1px solid #F0F0F0;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
  background: #D0D7DE;
  border-radius: 14px;
  cursor: pointer;
  transition: background var(--timing-fast);
}

.toggle-switch.on {
  background: var(--color-accent);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--timing-fast);
}

.toggle-switch.on::after {
  transform: translateX(20px);
}
