/* Themed date picker (shared/date-picker.js): a compact chip + month-grid
   popover that replaces the device's native <input type="date"> UI.
   Tokens come from the host page (plan.css); fallbacks keep it self-contained. */

/* ── Chip (trigger; .is-static = same look, not interactive) ─────────────── */
.dp-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 28px;
  box-sizing: border-box;
  margin: 0;
  padding: 0 0.55rem 0 0.5rem;
  flex-shrink: 0;
  background: var(--ice-1, #f4fbff);
  border: 1px solid var(--border-subtle, rgba(200, 215, 235, 0.6));
  border-left: 3px solid var(--accent, #1b6fd8);
  border-radius: 999px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-header, #083463);
  white-space: nowrap;
}
button.dp-chip {
  cursor: pointer;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
button.dp-chip:hover,
button.dp-chip[aria-expanded="true"] {
  background: rgba(27, 111, 216, 0.1);
}
button.dp-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(27, 111, 216, 0.22);
}
.dp-chip-ic {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(27, 111, 216, 0.12);
  color: var(--accent, #1b6fd8);
  font-size: 9px;
  flex-shrink: 0;
}
.dp-chip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dp-chip-label.is-empty {
  color: var(--muted, #6b7c93);
  font-weight: 700;
}
.dp-chip-short {
  display: none;
}
.dp-chip-caret {
  font-size: 9px;
  color: var(--muted, #6b7c93);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
button.dp-chip[aria-expanded="true"] .dp-chip-caret {
  transform: rotate(180deg);
}

/* Narrow phones: drop the weekday so the topbar row never wraps. */
@media (max-width: 480px) {
  .dp-chip-long {
    display: none;
  }
  .dp-chip-short {
    display: inline;
  }
}
@media (max-width: 340px) {
  .dp-chip {
    padding: 0 0.4rem 0 0.35rem;
    gap: 0.3rem;
  }
  .dp-chip-ic {
    display: none;
  }
}

/* ── Popover ─────────────────────────────────────────────────────────────── */
.dp-popover {
  position: fixed;
  /* Above .modal-overlay (z-index 500): it opens from inside the meal-detail
     modal but is appended to <body> so the modal can't clip it. 950 also
     clears the highest .z-90 overlay (900). */
  z-index: 950;
  width: 268px;
  max-width: calc(100vw - 16px);
  box-sizing: border-box;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border-subtle, rgba(200, 215, 235, 0.6));
  border-radius: 14px;
  box-shadow: var(--shadow-modal, 0 25px 50px -12px rgba(0, 0, 0, 0.25));
  font-family: inherit;
  animation: dp-popover-in 0.12s ease;
}
@keyframes dp-popover-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 6px;
}
.dp-title {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-header, #083463);
}
.dp-nav {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted, #6b7c93);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.dp-nav:hover {
  background: rgba(27, 111, 216, 0.1);
  color: var(--accent, #1b6fd8);
}
.dp-nav:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(27, 111, 216, 0.22);
}

.dp-weekdays,
.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.dp-weekdays {
  margin-bottom: 2px;
}
.dp-weekdays span {
  text-align: center;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--muted, #6b7c93);
  padding: 2px 0;
}
.dp-grid {
  gap: 2px 0;
}

.dp-day {
  height: 32px;
  padding: 0;
  margin: 0 auto;
  width: 32px;
  border: 1.5px solid transparent;
  border-radius: 50%;
  background: transparent;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main, #05223a);
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}
.dp-day:hover {
  background: rgba(27, 111, 216, 0.1);
}
.dp-day:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(27, 111, 216, 0.28);
}
.dp-day:disabled {
  background: transparent;
  color: #c3ceda;
  font-weight: 600;
  cursor: not-allowed;
}
.dp-day.is-outside {
  color: #a3b1c4;
  font-weight: 600;
}
.dp-day.is-today {
  border-color: var(--accent, #1b6fd8);
  color: var(--accent, #1b6fd8);
}
.dp-day.is-selected,
.dp-day.is-selected:hover {
  background: var(--accent, #1b6fd8);
  border-color: var(--accent, #1b6fd8);
  color: #fff;
}

.dp-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle, rgba(200, 215, 235, 0.6));
}
.dp-quick {
  padding: 5px 10px;
  border: none;
  border-radius: 999px;
  background: var(--ice-1, #f4fbff);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent, #1b6fd8);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.dp-quick:hover {
  background: rgba(27, 111, 216, 0.14);
}
.dp-quick:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(27, 111, 216, 0.22);
}
.dp-clear {
  margin-left: auto;
  background: transparent;
  color: var(--muted, #6b7c93);
}
.dp-clear:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}
