/* ==========================================================================
   The date range picker (wwwroot/js/reports/date-range-picker.js) — one button, presets, two months
   side by side. Loaded on every page (_Head.cshtml): the Employee & project report builds it itself,
   and every other report gets it through _DateRange.cshtml and date-range-field.js. Everything is
   under .erp-rp or .date-range-field, so nothing here reaches anything else. Moved here from
   reports/work-summary.css unchanged; the .date-range-field rules at the end are new.
   ========================================================================== */

.erp-rp {
  position: relative;
  --rp-blue: #1a76d1;
  --rp-blue-soft: #e8f1fb;
  --rp-line: #dde1e6;
  --rp-grey: #5f6670;
}

.erp-rp-btn {
  font: inherit;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--rp-line);
  border-radius: 4px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  min-width: 270px;
}

.erp-rp-btn svg {
  color: var(--rp-blue);
  flex: none;
}

.erp-rp-btn[aria-expanded=true] {
  border-color: var(--rp-blue);
  box-shadow: 0 0 0 3px var(--rp-blue-soft);
}

.erp-rp-btn:focus-visible {
  outline: 2px solid var(--rp-blue);
  outline-offset: 1px;
}

.erp-rp-pop {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  display: flex;
  background: #fff;
  border: 1px solid var(--rp-line);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
}

.erp-rp-pop[hidden] { display: none; }

.erp-rp-presets {
  display: flex;
  flex-direction: column;
  padding: 8px;
  border-right: 1px solid var(--rp-line);
  min-width: 130px;
}

.erp-rp-presets button {
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 7px 10px;
  border: 0;
  background: none;
  border-radius: 4px;
  cursor: pointer;
  color: inherit;
}

.erp-rp-presets button:hover,
.erp-rp-presets button:focus-visible {
  background: var(--rp-blue-soft);
  outline: none;
}

.erp-rp-presets button[aria-pressed=true] {
  background: var(--rp-blue);
  color: #fff;
}

.erp-rp-main { padding: 12px 14px; }

.erp-rp-cals {
  display: grid;
  grid-template-columns: repeat(2, 232px);
  gap: 22px;
}

.erp-rp-cal h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px;
  text-align: center;
  position: relative;
  height: 28px;
  line-height: 28px;
}

.erp-rp-nav {
  position: absolute;
  top: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--rp-line);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  color: inherit;
}

.erp-rp-nav:disabled {
  opacity: .35;
  cursor: default;
}

.erp-rp-nav.prev { left: 0; }
.erp-rp-nav.next { right: 0; }

.erp-rp-cal:first-child .erp-rp-nav.next { display: none; }

.erp-rp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 2px;
}

.erp-rp-grid .wd {
  font-size: 11px;
  color: var(--rp-grey);
  text-align: center;
  padding: 2px 0 6px;
}

.erp-rp-day {
  font: inherit;
  font-size: 13px;
  height: 32px;
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
  font-variant-numeric: tabular-nums;
  position: relative;
}

.erp-rp-day:hover:not(:disabled) {
  outline: 1px solid var(--rp-blue);
  outline-offset: -1px;
  border-radius: 4px;
}

.erp-rp-day:focus-visible {
  outline: 2px solid var(--rp-blue);
  outline-offset: -2px;
  border-radius: 4px;
}

.erp-rp-day.today {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.erp-rp-day.in { background: var(--rp-blue-soft); }

.erp-rp-day.s,
.erp-rp-day.e {
  background: var(--rp-blue);
  color: #fff;
}

.erp-rp-day.s { border-radius: 4px 0 0 4px; }
.erp-rp-day.e { border-radius: 0 4px 4px 0; }
.erp-rp-day.s.e { border-radius: 4px; }
.erp-rp-day.we:not(.s):not(.e) { color: var(--rp-grey); }

.erp-rp-day:disabled {
  color: #c3c8ce;
  cursor: default;
}

.erp-rp-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--rp-line);
  font-size: 13px;
}

.erp-rp-actions {
  display: flex;
  gap: 6px;
}

.erp-rp-warn { color: #b91c1c; }

/* A phone: a bottom sheet, one month, the presets in a row. */
@media (max-width: 700px) {
  .erp-rp-pop {
    flex-direction: column;
    position: fixed;
    left: 8px;
    right: 8px;
    top: auto;
    bottom: 8px;
    max-height: 85vh;
    overflow: auto;
  }

  .erp-rp-presets {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--rp-line);
  }

  .erp-rp-cals { grid-template-columns: 1fr; }
  .erp-rp-cal + .erp-rp-cal { display: none; }
  .erp-rp-cal:first-child .erp-rp-nav.next { display: block; }
  .erp-rp-btn { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .erp-rp * {
    animation: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   A report's date filter (_DateRange.cshtml): the picker sized like the form's other small controls.
   The two date boxes underneath are the form's fields, and what shows when scripts do not run.
   ========================================================================== */

/* Not Bootstrap's d-flex: its !important would beat the hidden attribute the script sets once the picker is up. */
.date-range-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.date-range-boxes[hidden] { display: none; }

.date-range-box { flex: 1 1 140px; min-width: 0; }

.date-range-field .erp-rp { display: block; }

.date-range-field .erp-rp-btn {
  width: 100%;
  min-width: 250px;
  min-height: calc(1.5em + .5rem + calc(var(--bs-border-width) * 2));
  padding: .25rem .5rem;
  font-size: .875rem;
  border-color: var(--bs-border-color);
  border-radius: var(--bs-border-radius-sm);
}

.date-range-field .erp-rp-lbl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-range-field .erp-rp-pop { z-index: 1050; }

/* The picker opens leftwards when its field sits at the right of the row. */
.date-range-field.is-right .erp-rp-pop { left: auto; right: 0; }

@media (max-width: 700px) {
  .date-range-field .erp-rp-btn { min-width: 0; }
}
