/**
 * Export Dropdown Component Stylesheet
 * Responsive inline dropdown menu and custom calendar range picker for Statistics page.
 */

/* Relative Container on Export Wrapper */
html[data-page=statistics] .section__exportWrapper,
.dataTables_filterWrapper .section__exportWrapper {
  position: relative !important;
}

/* Dropdown Container */
.c-exportDropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1000;
  border-radius: 15px;

  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  height: fit-content;
}

.c-exportDropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Mobile Backdrop (Disabled - pure dropdown menu) */
.c-exportDropdown__backdrop {
  display: none !important;
}

/* Main Dropdown Card */
.c-exportDropdown__card {
  background: #f9f9f9;
  border-radius: 15px;
  padding: 0;
  border: 1px solid #dadada;
  box-shadow: 0px 4px 14px 0px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  box-sizing: border-box;
  height: fit-content;
}

/* Dropdown Content Layout */
.c-exportDropdown__content {
  display: flex;
  gap: 0;
  align-items: stretch;
  height: fit-content;
}

/* Left Sidebar / Option List */
.c-exportDropdown__sidebar {
  min-width: 200px;
  flex-shrink: 0;
  padding: 20px;
  background: #f9f9f9;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  height: fit-content;
}

.c-exportDropdown__optionList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.c-exportDropdown__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 20px;
  border-radius: 100px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #1E1E1C;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.c-exportDropdown__option:hover {
  background: #EAEAEA;
}

.c-exportDropdown__option.is-selected {
  background: #000000 !important;
  color: #FFFFFF !important;
  font-weight: 500;
}

.c-exportDropdown__checkIcon {
  display: none;
}

.c-exportDropdown__option.is-selected .c-exportDropdown__checkIcon {
  display: block;
}

/* Right Custom Date Range Panel (Desktop: Flush to top, right, bottom) */
.c-exportDropdown__customPanel {
  flex-shrink: 0;
  display: flex;
  height: fit-content;
}

/* Inner White Picker Card (Desktop: Flush against outer container edges) */
.c-exportDropdown__pickerCard {
  background: #FFFFFF;
  border-radius: 15px;
  padding: 24px 20px;
  width: 390px;
  margin-top: -1px;
  margin-bottom: -1px;
  margin-right: -1px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Back Arrow Button (Hidden on Desktop) */
.c-exportDropdown__backBtn {
  display: none;
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 16px;
  cursor: pointer;
  align-items: center;
  justify-content: flex-start;
  width: fit-content;
}

/* Date Input Fields (LHS is smaller than RHS) */
.c-exportDropdown__dateInputs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 20px;
}

.c-exportDropdown__dateInputGroup {
  background: #FFFFFF;
  border: 1px solid #dadada;
  border-radius: 8px;
  padding: 10px 10px;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.c-exportDropdown__dateInputGroup.-lhs {
  flex: 0.92;
}

.c-exportDropdown__dateInputGroup.-rhs {
  flex: 1.08;
}

.c-exportDropdown__dateInputGroup.is-active {
  border-color: #000000;
}

.c-exportDropdown__dateInputGroup.is-disabled {
  background: #F8F9FA;
  border-color: #E0E0E0;
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.c-exportDropdown__dateInputGroup.is-disabled .c-exportDropdown__dateInput {
  color: #A0A0A0;
  cursor: not-allowed;
}

.c-exportDropdown__dateInput {
  width: 100%;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #1E1E1C;
  text-align: center;
  letter-spacing: -0.5px;
}

/* Suppress outline for mouse users only; keyboard users get the ring from focus.min.css */
body.usingMouse .c-exportDropdown__dateInput {
  outline: none;
}

.c-exportDropdown__dateInput[readonly] {
  cursor: default;
  user-select: none;
}

.c-exportDropdown__dateInputGroup.-readonly {
  cursor: default;
}

.c-exportDropdown__dateArrow {
  font-size: 16px;
  color: #1E1E1C;
}

/* Header Navigation (< July 2026 >) */
.c-exportDropdown__headerNav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}

.c-exportDropdown__navBtn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.c-exportDropdown__navBtn:hover:not(:disabled) {
  background: #F5F5F5;
}

.c-exportDropdown__navBtn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.c-exportDropdown__navTitle {
  background: transparent;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #1E1E1C;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.2s ease;
  letter-spacing: -0.5px;
}

.c-exportDropdown__navTitle:hover {
  background: #F5F5F5;
}

/* Calendar Days Grid (Zero X-Gap between columns for continuous range strip) */
.c-exportDropdown__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #1E1E1C;
  margin-bottom: 12px;
}

.c-exportDropdown__daysGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  column-gap: 0;
  row-gap: 4px;
  align-items: center;
  width: 100%;
}

.c-exportDropdown__dayCell {
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #1E1E1C;
  cursor: pointer;
  position: relative;
  user-select: none;
  z-index: 1;
  transition: color 0.15s ease;
}

.c-exportDropdown__dayCell.-otherMonth {
  color: #B5B5B5 !important;
  cursor: default;
  pointer-events: none;
}

.c-exportDropdown__dayCell.-disabled {
  color: #D5D5D5 !important;
  opacity: 0.4;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.c-exportDropdown__dayCell.is-today:not(.is-selected):not(.is-range-start):not(.is-range-end) {
  font-weight: 600;
}

.c-exportDropdown__dayCell.is-today:not(.is-selected):not(.is-range-start):not(.is-range-end)::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border: 1px solid #000000;
  border-radius: 50%;
  box-sizing: border-box;
}

.c-exportDropdown__dayCell:hover:not(.-otherMonth):not(.-disabled):not(.is-selected):not(.is-range-start):not(.is-range-end)::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  background: #EAEAEA;
  border-radius: 50%;
  z-index: -1;
}

/* Continuous Horizontal Range Strip (Zero X-Gap) using ::before Pseudo-Element */
.c-exportDropdown__dayCell.is-in-range::before,
.c-exportDropdown__dayCell.is-range-preview::before,
.c-exportDropdown__dayCell.is-range-start::before,
.c-exportDropdown__dayCell.is-range-end::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  background: #F1F1F1;
  z-index: -2;
}

.c-exportDropdown__dayCell.is-in-range::before,
.c-exportDropdown__dayCell.is-range-preview::before {
  left: 0;
  right: 0;
}

.c-exportDropdown__dayCell.is-range-start:not(.is-range-end)::before {
  left: 50%;
  right: 0;
}

.c-exportDropdown__dayCell.is-range-end:not(.is-range-start)::before {
  left: 0;
  right: 50%;
}

/* Standalone Whole Black Circle Overlay using ::after Pseudo-Element */
.c-exportDropdown__dayCell.is-selected::after,
.c-exportDropdown__dayCell.is-range-start::after,
.c-exportDropdown__dayCell.is-range-end::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  background: #000000;
  border-radius: 50%;
  z-index: -1;
}

.c-exportDropdown__dayCell.is-selected,
.c-exportDropdown__dayCell.is-range-start,
.c-exportDropdown__dayCell.is-range-end {
  color: #FFFFFF !important;
  font-weight: 600;
  background: transparent !important;
}

/* Months & Years Selector Grids */
.c-exportDropdown__monthsGrid,
.c-exportDropdown__yearsGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 8px 0;
}

.c-exportDropdown__gridBtn {
  padding: 10px 6px;
  border-radius: 100px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #1E1E1C;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.c-exportDropdown__gridBtn:hover:not(:disabled) {
  background: #EAEAEA;
}

.c-exportDropdown__gridBtn:disabled,
.c-exportDropdown__gridBtn.-disabled {
  opacity: 0.25 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  background: transparent !important;
  color: #8C8C88 !important;
}

.c-exportDropdown__gridBtn.is-selected,
.c-exportDropdown__gridBtn.is-range-start,
.c-exportDropdown__gridBtn.is-range-end {
  background: #000000 !important;
  color: #FFFFFF !important;
  font-weight: 600;
}

.c-exportDropdown__gridBtn.is-in-range {
  background: #EAEAEA !important;
  color: #1E1E1C !important;
  border-radius: 8px;
}

/* Bottom Action Buttons */
.c-exportDropdown__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.c-exportDropdown__btn.-cancel {
  background: transparent;
  border: 1px solid #dadada;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #1E1E1C;
  cursor: pointer;
  padding: 10px 24px;
  border-radius: 100px;
  transition: all 0.2s ease;
}

.c-exportDropdown__btn.-cancel:hover {
  background: #EAEAEA;
}

.c-exportDropdown__btn.-apply {
  padding: 10px 24px;
  border-radius: 100px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  border: none;
  transition: all 0.2s ease;
}

.c-exportDropdown__btn.-apply:disabled {
  background: #B5B5B5;
  color: #FFFFFF;
  cursor: not-allowed;
}

.c-exportDropdown__btn.-apply:not(:disabled) {
  background: #000000;
  color: #FFFFFF;
  cursor: pointer;
}

.c-exportDropdown__btn.-apply:not(:disabled):hover {
  background: #1E1E1C;
}

/* Mobile Viewport Responsive Styles (< 1024px) */
@media screen and (max-width: 1023.98px) {
  html[data-page=statistics] #centralUnit .section__filterBar {
    position: relative !important;
    z-index: 50 !important;
  }

  html[data-page=statistics] #centralUnit .section__exportWrapper {
    position: static !important;
    width: auto !important;
    margin-left: auto !important;
  }

  #centralUnit .c-exportDropdown {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  div.dataTables_wrapper .dataTables_filterWrapper {
    position: relative !important;
    z-index: 10 !important;
    box-sizing: border-box !important;
  }

  div.dataTables_wrapper .dataTables_filterWrapper:has(.c-exportDropdown.is-open),
  div.dataTables_wrapper .dataTables_filterWrapper.is-dropdownOpen {
    z-index: 50 !important;
  }

  div.dataTables_wrapper .dataTables_filterWrapper .section__exportWrapper {
    position: static !important;
    width: 130px !important;
  }

  .dataTables_filterWrapper .c-exportDropdown {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .c-exportDropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    z-index: 1000;
    border-radius: 15px;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    height: fit-content;
  }

  .c-exportDropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .c-exportDropdown__card {
    position: relative;
    width: 100%;
    border-radius: 15px;
    padding: 0;
    overflow: hidden;
    border: 1px solid #dadada;
    box-shadow: 0px 4px 14px 0px rgba(0, 0, 0, 0.08);
    background: #f9f9f9;
    height: fit-content;
  }

  .c-exportDropdown__content {
    display: block;
    width: 100%;
    height: fit-content;
  }

  .c-exportDropdown__sidebar {
    width: 100%;
    min-width: 100%;
    padding: 20px;
    background: #f9f9f9;
    box-sizing: border-box;
    height: fit-content;
  }

  .c-exportDropdown__customPanel {
    width: 100%;
    min-width: 100%;
    display: block;
    background: #FFFFFF;
    border-radius: 15px;
    padding: 20px;
    box-sizing: border-box;
    height: fit-content;
  }

  .c-exportDropdown__pickerCard {
    border: none;
    padding: 0;
    background: transparent;
    width: 100%;
    margin: 0;
    height: fit-content;
  }

  .c-exportDropdown__backBtn {
    display: flex !important;
  }

  /* Tablet: don't stretch the dropdown / calendar across the section - cap it under the Export button
     (phones narrower than 425px still get the full width). The filters-modal copy below stays full width. */
  .c-exportDropdown,
  .dataTables_filterWrapper .c-exportDropdown {
    max-width: 425px !important;
    right: auto !important;
  }
}

/* Mobile Filter Modal Embedded Export (Figma node 27190:209136) */
.filtersModal .c-exportDropdown {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  display: block !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 15px 0 0 0 !important;
  height: auto !important;
  z-index: 1 !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

.filtersModal .c-exportDropdown__card {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  width: 100% !important;
}

.filtersModal .c-exportDropdown__content {
  display: flex !important;
  flex-direction: column !important;
  gap: 15px !important;
  width: 100% !important;
}

.filtersModal .c-exportDropdown__sidebar {
  width: 100% !important;
  min-width: 100% !important;
  padding: 20px !important;
  background: #f9f9f9 !important;
  border: 1px solid #dadada !important;
  border-radius: 15px !important;
  box-sizing: border-box !important;
}

.filtersModal .c-exportDropdown__option {
  padding: 11px 20px !important;
  border-radius: 100px !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  color: #1E1E1C !important;
  background: transparent !important;
  transition: all 0.2s ease !important;
  width: 100% !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

.filtersModal .c-exportDropdown__option:hover {
  background: #EAEAEA !important;
}

.filtersModal .c-exportDropdown__option.is-selected {
  background: #000000 !important;
  color: #FFFFFF !important;
}

.filtersModal .c-exportDropdown__customPanel {
  margin-top: 0 !important;
  margin-bottom: 25px !important;
  border-radius: 15px !important;
  border: 1px solid #dadada !important;
  background: #FFFFFF !important;
  padding: 20px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.filtersModal .c-exportDropdown__pickerCard {
  background: #FFFFFF !important;
  border: none !important;
  padding: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.filtersModal .c-exportDropdown__backBtn {
  display: flex !important;
  margin-bottom: 15px !important;
  cursor: pointer !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
}

.filtersModal .c-exportDropdown__actions {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 10px !important;
  margin-top: 15px !important;
}

.filtersModal .c-exportDropdown__btn.-cancel {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  color: #1E1E1C !important;
  border-radius: 100px !important;
  padding: 8px 20px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border: 1px solid #DADADA !important;
  cursor: pointer !important;
}

.filtersModal .c-exportDropdown__btn.-cancel:hover {
  background: #EAEAEA !important;
}

.filtersModal .c-exportDropdown__btn.-apply {
  background: #000000 !important;
  color: #FFFFFF !important;
  border-radius: 100px !important;
  padding: 8px 24px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border: none !important;
  cursor: pointer !important;
}

/* Ensure mobile filtersModal content never overlaps the sticky bottom action bar */
.filtersModal__inner {
  padding-bottom: 160px !important;
}

.filtersModal__export .filtersModal__accordionContent.isExpanded {
  height: auto !important;
  overflow: visible !important;
  padding-bottom: 30px !important;
}



/* Agent Institutions: the Export wrapper sits directly in .dataTable__container with no positioned
   parent, so the dropdown anchored to <main> (x=0). Anchor it to the wrapper, under the button. */
@media screen and (max-width: 1023.98px) {
  .dataTable__container > .section__exportWrapper.js-desktopExportWrapper {
    position: relative;
  }
}

/* Initially hidden (replaces inline style="display:none", which the CSP blocks).
   Scripts still show the element by setting element.style.display, which overrides this. */
html body .u-hiddenInitially:not(#csp-x) {
  display: none;
}
