/* =====================================================================
   ndh-datetime-picker.css
   Custom date/time picker — NDH Finance Hub premium dark style.
   Works alongside ndh-forms.css. Both load on pages that use the picker.
   ===================================================================== */

/* ------------------------------------------------------------------
   Trigger button (replaces the visible native input)
   ------------------------------------------------------------------ */
.ndh-dt-trigger {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  min-height: 44px;
  padding: .72rem 1rem;
  background: rgba(255, 255, 255, .02);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  color: var(--text-main, rgba(226, 232, 240, .88));
  font-size: .92rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.ndh-dt-trigger:hover {
  border-color: rgba(255, 255, 255, .18);
}

.ndh-dt-trigger:focus-visible {
  outline: none;
  border-color: rgba(255, 87, 5, .55);
  box-shadow: 0 0 0 3px rgba(255, 87, 5, .18);
}

.ndh-dt-trigger svg {
  flex: 0 0 auto;
  color: rgba(255, 87, 5, .7);
  transition: color .15s;
}

.ndh-dt-trigger:hover svg,
.ndh-dt-trigger:focus-visible svg {
  color: rgba(255, 87, 5, 1);
}

.ndh-dt-trigger-text {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-main, rgba(226, 232, 240, .88));
}

/* Placeholder appearance when no date is set */
.ndh-dt-trigger-text:empty::before {
  content: attr(data-placeholder);
  color: rgba(226, 232, 240, .4);
}

/* ------------------------------------------------------------------
   Popup container
   ------------------------------------------------------------------ */
.ndh-dt-popup {
  position: fixed;
  z-index: 9999;
  width: 308px;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(10, 17, 36, .98), rgba(2, 6, 23, .99));
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 20px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, .55),
    0 4px 16px rgba(0, 0, 0, .3),
    inset 0 1px 0 rgba(255, 255, 255, .06);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  user-select: none;
  overflow: hidden;
  max-width: calc(100vw - 16px);
}

/* Mobile: centered overlay */
.ndh-dt-popup--center {
  position: fixed;
  top: 50% !important;
  left: 50% !important;
  bottom: auto !important;
  right: auto !important;
  transform: translate(-50%, -50%);
  width: min(360px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 96px);
  overflow: hidden;
  overflow-y: auto;
}

/* ------------------------------------------------------------------
   Calendar header (month/year + nav)
   ------------------------------------------------------------------ */
.ndh-dt-cal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
}

.ndh-dt-nav-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .04);
  color: rgba(255, 255, 255, .8);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}

.ndh-dt-nav-btn:hover {
  background: rgba(255, 87, 5, .14);
  border-color: rgba(255, 87, 5, .35);
  color: #fff;
}

.ndh-dt-nav-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 87, 5, .45);
}

.ndh-dt-month-label {
  flex: 1 1 auto;
  text-align: center;
  font-size: .95rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: .01em;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: background .15s;
}

.ndh-dt-month-label:hover {
  background: rgba(255, 255, 255, .06);
}

.ndh-dt-month-label:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 87, 5, .4);
}

/* ------------------------------------------------------------------
   Weekday row
   ------------------------------------------------------------------ */
.ndh-dt-wk-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
}

.ndh-dt-weekday {
  text-align: center;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .32);
  padding: .2rem 0;
}

/* ------------------------------------------------------------------
   Days grid
   ------------------------------------------------------------------ */
.ndh-dt-days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}

.ndh-dt-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 9px;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.ndh-dt-day {
  font-size: .84rem;
  font-weight: 600;
  color: rgba(226, 232, 240, .88);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  line-height: 1;
}

.ndh-dt-day:hover {
  background: rgba(255, 87, 5, .14);
  color: #fff;
  border-color: rgba(255, 87, 5, .28);
}

.ndh-dt-day:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 87, 5, .5);
}

/* Today ring */
.ndh-dt-day.ndh-dt-today {
  color: rgba(255, 87, 5, 1);
  border-color: rgba(255, 87, 5, .35);
  font-weight: 900;
}

.ndh-dt-day.ndh-dt-today:hover {
  background: rgba(255, 87, 5, .18);
}

/* Selected day */
.ndh-dt-day.ndh-dt-sel {
  background: rgba(255, 87, 5, 1);
  color: #fff;
  border-color: rgba(255, 87, 5, 1);
  font-weight: 900;
}

.ndh-dt-day.ndh-dt-sel:hover {
  background: rgba(255, 107, 25, 1);
}

/* ------------------------------------------------------------------
   Time picker (datetime mode)
   ------------------------------------------------------------------ */
.ndh-dt-time-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: .6rem 0;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.ndh-dt-colon {
  font-size: 1.35rem;
  font-weight: 900;
  color: rgba(255, 255, 255, .45);
  line-height: 1;
  margin-top: -2px;
}

.ndh-dt-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ndh-dt-spin-btn {
  width: 30px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .04);
  color: rgba(255, 255, 255, .72);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, border-color .12s;
}

.ndh-dt-spin-btn:hover {
  background: rgba(255, 87, 5, .14);
  border-color: rgba(255, 87, 5, .3);
  color: #fff;
}

.ndh-dt-spin-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 87, 5, .45);
}

.ndh-dt-spin-val {
  min-width: 36px;
  text-align: center;
  font-size: 1.45rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: .02em;
  line-height: 1;
}

/* ------------------------------------------------------------------
   Footer (Hoy + Confirmar)
   ------------------------------------------------------------------ */
.ndh-dt-footer {
  display: flex;
  gap: .5rem;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, .07);
  padding-top: .65rem;
}

.ndh-dt-footer-btn {
  flex: 1 1 auto;
  padding: .6rem .8rem;
  border-radius: 12px;
  font-size: .88rem;
  font-weight: 850;
  cursor: pointer;
  transition: background .14s, border-color .14s;
}

.ndh-dt-today-btn {
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .04);
  color: rgba(255, 255, 255, .82);
}

.ndh-dt-today-btn:hover {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .18);
  color: #fff;
}

.ndh-dt-today-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 87, 5, .4);
}

.ndh-dt-confirm-btn {
  border: 1px solid rgba(255, 87, 5, .55);
  background: rgba(255, 87, 5, .18);
  color: rgba(255, 140, 60, 1);
}

.ndh-dt-confirm-btn:hover {
  background: rgba(255, 87, 5, .3);
  border-color: rgba(255, 87, 5, .8);
  color: #fff;
}

.ndh-dt-confirm-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 87, 5, .5);
}

/* ------------------------------------------------------------------
   Mobile overrides
   ------------------------------------------------------------------ */
@media (max-width: 767px) {
  .ndh-dt-popup {
    border-radius: 18px;
    padding: .9rem;
    width: min(340px, calc(100vw - 16px));
  }

  .ndh-dt-day {
    font-size: .82rem;
  }

  .ndh-dt-weekday {
    font-size: .65rem;
  }

  .ndh-dt-spin-val {
    font-size: 1.5rem;
  }

  .ndh-dt-footer-btn {
    padding: .72rem .7rem;
    font-size: .9rem;
  }
}
