/* ========================================
   CUSTOM DATEPICKER (profile birthday)
   ======================================== */

/* Uses global.css tokens: --primary-color, --color-*, etc. */
:root {
  --edu-primary: var(--primary-color);
  --edu-white: var(--color-white);
  --edu-black: var(--secondary-color);
  --edu-gray-border: var(--color-gray-300);
  --edu-gray-border-light: var(--color-gray-200);
  --edu-gray-text: var(--color-gray-600);
  --edu-gray-muted: var(--color-gray-600);
  --font-paragraph: var(--font-xs);
  --datepicker-header-bg: var(--color-epaper-bg);
  --datepicker-day-muted: var(--color-gray-600);
  --datepicker-day-muted-bg: var(--color-gray-100);
}

.custom-datepicker-container {
  position: relative;
}

.custom-datepicker-container.active {
  z-index: 95;
}

.custom-datepicker-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.custom-datepicker-display {
  width: 100%;
  padding: 0.4rem 1rem;
  padding-right: 40px;
  background: var(--edu-white);
  border: 1px solid var(--edu-gray-border);
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font-sans, "DM Sans", system-ui, sans-serif);
  color: var(--edu-black);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

table .custom-datepicker-display {
  height: 38px;
  padding: 0.375rem 1rem;
  padding-right: 40px;
}

.custom-datepicker-display:focus {
  outline: none;
  box-shadow: none;
  border-color: var(--edu-gray-border);
}

.profile-birthday-datepicker .custom-datepicker-display:focus {
  color: inherit !important;
  background-color: var(--color-white) !important;
}

.custom-datepicker-display::placeholder {
  color: var(--edu-gray-text);
}

.custom-datepicker-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--edu-gray-muted);
  cursor: pointer;
  transition: color 0.3s ease;
  z-index: 10;
}

.custom-datepicker-icon:hover {
  color: var(--edu-primary);
}

.custom-datepicker-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.custom-datepicker-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  background: var(--edu-white);
  border: 1px solid var(--edu-gray-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 95;
  display: none;
  margin-top: 6px;
  font-family: var(--font-sans, "DM Sans", system-ui, sans-serif);
  min-width: 300px;
  max-width: 100%;
  width: min(100%, 340px);
  overflow: visible;
}

.custom-datepicker-dropdown.show {
  display: block;
  z-index: 95;
}

.custom-datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--edu-gray-border-light);
  background: var(--edu-white);
  border-radius: 12px 12px 0 0;
}

.custom-datepicker-nav-btn {
  background: none;
  border: none;
  color: var(--edu-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.custom-datepicker-nav-btn:hover {
  background: var(--edu-primary);
  color: var(--edu-white);
}

.custom-datepicker-nav-btn:focus-visible {
  outline: none;
}

.custom-datepicker-month-year {
  font-weight: 600;
  font-size: var(--font-paragraph);
  color: var(--edu-black);
  text-align: center;
  flex: 1;
}

.custom-datepicker-month-year-selector {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

/* Month/year: Bootstrap dropdown + .year-dropdown (see site.css) — list = borders, grey hover, black left bar on .active */
.custom-datepicker-dropdown-field {
  min-width: 0;
}

.custom-datepicker-dropdown-field--year {
  flex: 0 0 92px;
  width: 92px;
}

.profile-birthday-datepicker .custom-datepicker-month-year-selector .year-dropdown-toggle {
  height: 38px !important;
  min-height: 38px;
  padding: 8px 10px !important;
}

.profile-birthday-datepicker .custom-datepicker-month-year-selector .year-dropdown .dropdown-menu {
  max-height: 220px;
}

.profile-birthday-datepicker .year-dropdown .dropdown-item:hover,
.profile-birthday-datepicker .year-dropdown .dropdown-item:focus,
.profile-birthday-datepicker .year-dropdown .dropdown-item:active {
  background-color: #e0e0e0 !important;
  color: var(--secondary-color) !important;
}

@media (max-width: 575.98px) {
  .custom-datepicker-dropdown-field--year {
    flex: 0 0 80px;
    width: 80px;
  }
}

.custom-datepicker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 8px 10px 6px;
  background: var(--datepicker-header-bg);
  color: var(--edu-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
}

.custom-datepicker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 10px 12px 14px;
}

.custom-datepicker-day {
  aspect-ratio: 1;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  font-size: var(--font-xs, 0.875rem);
  color: var(--edu-black);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  padding: 0;
}

.custom-datepicker-day:hover:not(:disabled) {
  background: var(--datepicker-header-bg);
}

.custom-datepicker-day.is-other-month {
  color: var(--datepicker-day-muted);
  background: var(--datepicker-day-muted-bg);
  cursor: pointer;
}

.custom-datepicker-day.is-other-month:hover {
  background: var(--edu-gray-border-light);
}

.custom-datepicker-day.is-selected {
  background: var(--edu-primary);
  color: var(--edu-white);
  font-weight: 600;
}

.custom-datepicker-day.is-selected:hover {
  background: var(--edu-primary);
  color: var(--edu-white);
}

.custom-datepicker-day:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.custom-datepicker-day:focus,
.custom-datepicker-day:focus-visible {
  outline: none;
}

.profile-birthday-datepicker .profile-birthday-icon-btn:focus-visible {
  outline: none;
}

/* Profile birthday: align with form-control height */
.profile-birthday-datepicker .custom-datepicker-input-wrapper .custom-datepicker-display.form-control {
  padding-right: 44px !important;
  border-radius: var(--radius-sm, 8px);
}

.profile-birthday-datepicker .custom-datepicker-dropdown {
  left: 0;
  right: auto;
}

@media (max-width: 575.98px) {
  .profile-birthday-datepicker .custom-datepicker-dropdown {
    width: 100%;
    min-width: 0;
  }
}
