/* Calory — Bottom Sheet Modals */

/* Backdrop */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: var(--z-modal);
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.modal-bg.open {
  display: flex;
  animation: backdropFade 200ms var(--ease-out) both;
}

.modal-bg.closeing {
  animation: backdropFadeOut 150ms var(--ease-in) both;
  display: flex;
}

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

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

/* Sheet panel */
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 0;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  animation: sheetSlideUp var(--sheet-enter) var(--ease-out) forwards;
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-bottom: none;
}

.modal-bg.closeing .modal {
  animation: sheetSlideDown var(--sheet-exit) var(--ease-in) forwards;
}

@keyframes sheetSlideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes sheetSlideDown {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(100%);
  }
}

/* Drag handle */
.modal-handle {
  display: flex;
  justify-content: center;
  padding: 10px 16px 6px;
  cursor: grab;
}

.modal-handle:active {
  cursor: grabbing;
}

.modal-handle-bar {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

/* Modal content */
.modal-content {
  padding: 8px 20px 24px;
}

.modal-title {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.modal-footer .btn {
  min-width: 80px;
}

/* Day view inside modal */
.modal-day-date {
  font-family: 'Ubuntu Sans', -apple-system, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 20px;
}

/* Meal section in modal */
.modal-meal-section {
  margin-bottom: 16px;
}

.modal-meal-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.modal-food-list {
  padding-left: 8px;
  margin-top: 8px;
}

.modal-food-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  transition: background var(--transition-fast) ease;
}

.modal-food-item:hover {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
}

.modal-food-name {
  font-size: 0.85rem;
  color: var(--text);
}

.modal-food-macros {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.modal-food-kcal {
  font-weight: 600;
  color: var(--text-sub);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
