:root {
  /* Premium Color Palette */
  --primary-color: #6C63FF;
  /* Modern Purple */
  --primary-light: #A39BFE;
  --secondary-color: #FF6584;
  /* Soft Red/Pink for alerts or accents */
  --accent-color: #FFB347;
  /* Soft Orange/Amber for Sleep */
  --background-color: #F7F9FC;
  /* Light Blue-Grey */
  --surface-color: #FFFFFF;
  --text-primary: #2D3748;
  --text-secondary: #718096;
  --success-color: #48BB78;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;

  /* Border Radius */
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

a {
  text-decoration: none;
}

/* Glassmorphism Utilities */
.glass-panel {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(108, 99, 255, 0.2);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-lg);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  border: none;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 14px 0 rgba(108, 99, 255, 0.39);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(108, 99, 255, 0.23);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-secondary:hover {
  color: var(--text-primary);
}

.container {
  max-width: 600px;
  /* Mobile focused */
  margin: 0 auto;
  padding: var(--spacing-md);
}

/* --- Form Styles --- */

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.form-input,
.form-select {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  box-sizing: border-box;
  /* Important for width: 100% */
}

.form-input:focus,
.form-select:focus {
  outline: 0;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
  background-color: #fff;
}

/* Custom Checkbox / Radio Containers */
.checkbox-group {
  display: flex;
  gap: 1rem;
}

.checkbox-card {
  flex: 1;
  position: relative;
}

.checkbox-card input[type="radio"],
.checkbox-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkbox-card-label {
  display: flex;
  /* Flex to align items if we add icons later */
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0.75rem;
  background-color: #fff;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-sizing: border-box;
}

.checkbox-card input:checked~.checkbox-card-label {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background-color: rgba(108, 99, 255, 0.05);
  /* Slight tint */
  box-shadow: 0 2px 4px rgba(108, 99, 255, 0.1);
}

/* Dashboard Summaries */
.summaries-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  flex: 1;
  border-radius: 12px;
  padding: 0.75rem;
  text-align: center;
  min-height: 85px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: transform 0.2s;
}

.summary-card:active {
  transform: scale(0.98);
}

.summary-card-feeding {
  background: rgba(108, 99, 255, 0.1);
  border: 1px solid rgba(108, 99, 255, 0.2);
  color: var(--primary-color);
}

.summary-card-sleep {
  background: rgba(255, 179, 71, 0.1);
  border: 1px solid rgba(255, 179, 71, 0.2);
  color: var(--accent-color);
}

.summary-card-diaper {
  background: rgba(72, 187, 120, 0.1);
  border: 1px solid rgba(72, 187, 120, 0.2);
  color: var(--success-color);
}

/* Modal / Dialog Styles */
dialog {
  border: none;
  padding: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  width: 400px;
  background: transparent;
  /* Changed to let glass-panel handle bg */
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

/* Animations for dialog */
dialog[open] {
  animation: scaleIn 0.25s ease-out forwards;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

/* Carousel Styles */
.carousel-container {
  margin: 3rem 0;
  width: 100%;
  position: relative;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  background: white;
  overflow: hidden;
}

.carousel-viewport {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.carousel-viewport::-webkit-scrollbar {
  display: none;
}

.carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  position: relative;
  aspect-ratio: 16/10;
  /* Slightly taller for better mobile display */
  background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.1));
  transition: transform 0.3s ease;
}

.carousel-slide:hover img {
  transform: scale(1.02);
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: var(--primary-color);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
  opacity: 0;
}

.carousel-container:hover .carousel-arrow {
  opacity: 1;
}

.carousel-arrow:hover {
  background: white;
  scale: 1.1;
  color: var(--primary-light);
}

.carousel-arrow-prev {
  left: 1rem;
}

.carousel-arrow-next {
  right: 1rem;
}

.carousel-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3rem 1.5rem 1.5rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 100%);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.carousel-caption-text {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.carousel-dots {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 11;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-dot:hover {
  background: rgba(255, 255, 255, 0.7);
}

.carousel-dot.active {
  background: white;
  width: 24px;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

@media (max-width: 640px) {
  .carousel-arrow {
    display: none;
  }

  /* Use touch scroll on mobile */
  .carousel-slide {
    aspect-ratio: 4/5;
  }

  /* Mobile vertical snapshots orientation */
}

/* Growth Chart Fullscreen */
.growth-chart-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 9999;
  background: white !important;
  padding: 1rem !important;
  box-sizing: border-box !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

@media (max-width: 767px) {
  .growth-chart-fullscreen {
    width: 100vh !important;
    height: 100vw !important;
    transform: rotate(90deg) translateY(-100%);
    transform-origin: top left;
  }
}

@media (min-width: 768px) {
  .growth-chart-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
  }
}

.growth-chart-fullscreen canvas {
  max-height: none !important;
  height: 100% !important;
  width: 100% !important;
}

.growth-chart-fullscreen .chart-container {
  flex-grow: 1 !important;
  position: relative !important;
  height: 100% !important;
  width: 100% !important;
}

.growth-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* Markdown / Prose Styles */
.prose ul,
.prose ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

.prose p {
  margin-bottom: 1rem;
}

.prose strong {
  font-weight: 700;
  color: var(--primary-color);
}

.prose h1,
.prose h2,
.prose h3 {
  color: var(--text-primary);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
}