/* Custom date picker */

.dp-root {
  position: relative;
  display: inline-block;
  min-width: 200px;
  max-width: 100%;
}

.dp-trigger {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dp-trigger:hover {
  border-color: rgba(123, 134, 232, 0.45);
}

.dp-root.is-open .dp-trigger,
.dp-trigger:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 113, 219, 0.15);
}

.dp-icon {
  flex-shrink: 0;
  color: var(--purple);
}

.dp-display {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dp-display.is-placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.dp-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.dp-root.is-open .dp-chevron {
  transform: rotate(180deg);
}

.dp-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dp-dropdown {
  position: absolute;
  z-index: 200;
  top: calc(100% + 6px);
  left: 0;
  width: min(100%, 320px);
  min-width: 300px;
  padding: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.04),
    0 16px 40px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .dp-dropdown {
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.2),
    0 16px 40px rgba(0, 0, 0, 0.45);
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.dp-header-picks {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 0;
}

.dp-month-select,
.dp-year-select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dp-month-select {
  flex: 1.2;
  min-width: 0;
}

.dp-year-select {
  flex: 0.85;
  min-width: 4.5rem;
}

.dp-month-select:hover,
.dp-year-select:hover {
  border-color: rgba(123, 134, 232, 0.45);
}

.dp-month-select:focus,
.dp-year-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 113, 219, 0.15);
}

.dp-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.dp-nav:hover {
  background: var(--surface-hover);
  color: var(--blue);
}

.dp-nav:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 0.35rem;
}

.dp-weekday {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.25rem 0;
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.dp-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-height: 2.1rem;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}

.dp-day:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--blue);
}

.dp-day:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.dp-day.is-other {
  color: var(--text-muted);
  opacity: 0.45;
}

.dp-day.is-today {
  box-shadow: inset 0 0 0 2px var(--purple);
  color: var(--purple);
  font-weight: 700;
}

.dp-day.is-selected {
  background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(59, 113, 219, 0.35);
}

.dp-day.is-selected.is-today {
  box-shadow: 0 4px 12px rgba(59, 113, 219, 0.35);
}

.dp-day:disabled {
  opacity: 0;
  cursor: default;
  pointer-events: none;
}

.dp-footer {
  display: flex;
  justify-content: center;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
}

.dp-today-btn {
  padding: 0.35rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: var(--result-bg);
  color: var(--blue);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.dp-today-btn:hover {
  background: rgba(59, 113, 219, 0.12);
  color: var(--purple);
}

.sunrise-date-pick .dp-root {
  flex: 1;
  min-width: 220px;
  max-width: 320px;
}

@media (max-width: 600px) {
  .dp-root {
    width: 100%;
  }

  .dp-dropdown {
    left: 50%;
    transform: translateX(-50%);
    width: min(calc(100vw - 2rem), 300px);
  }
}
