@import 'react-datepicker/dist/react-datepicker.css';

/* Тема react-datepicker под Tailwind/shadcn-стиль остального UI.
 * В проекте Tailwind v4 — единственный кастомный токен это --color-brand
 * (зелёный фирменный); остальное берём из палитры slate-*. */

.react-datepicker {
  font-family: inherit;
  font-size: 0.875rem;
  border-color: rgb(226 232 240); /* slate-200 */
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  background-color: white;
  color: rgb(15 23 42); /* slate-900 */
}

.react-datepicker__header {
  background-color: rgb(248 250 252); /* slate-50 */
  border-bottom: 1px solid rgb(226 232 240); /* slate-200 */
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  padding-top: 0.75rem;
}

.react-datepicker__current-month {
  color: rgb(15 23 42);
  font-weight: 500;
  font-size: 0.875rem;
}

.react-datepicker__day-name {
  color: rgb(100 116 139); /* slate-500 */
  font-weight: 400;
  font-size: 0.75rem;
}

.react-datepicker__day {
  color: rgb(15 23 42);
  border-radius: 0.375rem;
  margin: 0.125rem;
  line-height: 1.75rem;
}

.react-datepicker__day:hover {
  background-color: rgb(241 245 249); /* slate-100 */
  border-radius: 0.375rem;
}

.react-datepicker__day--selected,
.react-datepicker__day--selected:hover {
  background-color: var(--color-brand);
  color: var(--color-brand-foreground);
}

.react-datepicker__day--keyboard-selected {
  background-color: rgb(241 245 249);
  color: rgb(15 23 42);
}

.react-datepicker__day--today {
  font-weight: 700;
  color: var(--color-brand);
}

.react-datepicker__day--today.react-datepicker__day--selected {
  color: var(--color-brand-foreground);
}

.react-datepicker__day--outside-month {
  color: rgb(148 163 184); /* slate-400 */
  opacity: 0.6;
}

.react-datepicker__navigation {
  top: 0.625rem;
}
.react-datepicker__navigation-icon::before {
  border-color: rgb(100 116 139);
  border-width: 2px 2px 0 0;
}
.react-datepicker__navigation:hover .react-datepicker__navigation-icon::before {
  border-color: rgb(15 23 42);
}

.react-datepicker__month-select,
.react-datepicker__year-select {
  background-color: white;
  border: 1px solid rgb(203 213 225); /* slate-300 */
  border-radius: 0.25rem;
  padding: 0.125rem 0.375rem;
  font-size: 0.875rem;
  color: rgb(15 23 42);
  margin: 0 0.125rem;
}

.react-datepicker__today-button {
  background-color: rgb(248 250 252);
  border-top: 1px solid rgb(226 232 240);
  font-weight: 500;
  color: var(--color-brand);
  padding: 0.5rem;
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}
.react-datepicker__today-button:hover {
  background-color: rgb(241 245 249);
}

.react-datepicker__triangle {
  display: none;
}

.react-datepicker__close-icon::after {
  background-color: rgb(148 163 184);
  color: white;
  font-size: 0.75rem;
  height: 1rem;
  width: 1rem;
  line-height: 1rem;
}
.react-datepicker__close-icon:hover::after {
  background-color: rgb(100 116 139);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .react-datepicker {
    background-color: rgb(15 23 42); /* slate-900 */
    border-color: rgb(30 41 59); /* slate-800 */
    color: rgb(226 232 240); /* slate-200 */
  }
  .react-datepicker__header {
    background-color: rgb(30 41 59);
    border-bottom-color: rgb(30 41 59);
  }
  .react-datepicker__current-month,
  .react-datepicker__day {
    color: rgb(226 232 240);
  }
  .react-datepicker__day-name {
    color: rgb(148 163 184);
  }
  .react-datepicker__day:hover {
    background-color: rgb(30 41 59);
  }
  .react-datepicker__day--keyboard-selected {
    background-color: rgb(30 41 59);
    color: rgb(226 232 240);
  }
  .react-datepicker__day--outside-month {
    color: rgb(100 116 139);
  }
  .react-datepicker__month-select,
  .react-datepicker__year-select {
    background-color: rgb(15 23 42);
    border-color: rgb(51 65 85); /* slate-700 */
    color: rgb(226 232 240);
  }
  .react-datepicker__today-button {
    background-color: rgb(30 41 59);
    border-top-color: rgb(30 41 59);
  }
  .react-datepicker__today-button:hover {
    background-color: rgb(51 65 85);
  }
  .react-datepicker__navigation-icon::before {
    border-color: rgb(148 163 184);
  }
  .react-datepicker__navigation:hover .react-datepicker__navigation-icon::before {
    border-color: rgb(226 232 240);
  }
}
