/* ============================================================================
   CORREÇÃO DEFINITIVA DO CALENDÁRIO - SEM PORTAL
   Estratégia: Calendário inline com z-index alto e overflow visible em toda hierarquia
   ============================================================================ */

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* 1. REMOVER OVERFLOW HIDDEN DE TODA HIERARQUIA */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

body, #react-entry-point, #_dash-app-content {
  overflow: visible !important;
}

.container, 
.container-fluid,
.card, 
.card-body,
.dash-card, 
.dbc-card,
.dbc-card-body,
.section, 
.panel,
.row,
.col,
[class*="col-"],
.sidebar,
.main-content {
  overflow: visible !important;
  contain: none !important; /* Remove CSS containment que pode clipar */
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* 2. GARANTIR POSITION RELATIVE NOS WRAPPERS DO CALENDÁRIO */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.date-picker-wrapper,
.date-selector-container,
.date-picker-container {
  position: relative !important;
  overflow: visible !important;
  z-index: 100 !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* 3. ELEVAR MASSIVAMENTE O POPOVER DO CALENDÁRIO */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.DateRangePicker_picker,
.SingleDatePicker_picker {
  position: absolute !important; /* NUNCA fixed - fica inline */
  z-index: 9999 !important;
  background: white !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
  border: 1px solid #e0e0e0 !important;
  margin-top: 4px !important; /* Espaço pequeno entre input e calendário */
  outline: none !important;
  overflow: visible !important;
}

/* Forçar alinhamento à esquerda do input */
.DateRangePicker_picker__directionLeft,
.SingleDatePicker_picker__directionLeft {
  left: 0 !important;
  right: auto !important;
}

/* Se o calendário tentar abrir à direita, forçar esquerda */
.DateRangePicker_picker__directionRight,
.SingleDatePicker_picker__directionRight {
  left: 0 !important;
  right: auto !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* 4. ELEVAR COMPONENTES INTERNOS DO CALENDÁRIO */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.DayPicker,
.CalendarMonth,
.CalendarMonthGrid,
.DayPickerNavigation {
  z-index: 10000 !important;
  position: relative !important;
  background: white !important;
}

/* Botões de navegação 100% clicáveis */
.DayPickerNavigation_button,
.DayPickerNavigation_button__horizontal {
  z-index: 10001 !important;
  position: relative !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  background: white !important;
  border: 1px solid #e0e0e0 !important;
  border-radius: 4px !important;
}

.DayPickerNavigation_button:hover {
  background: #f5f5f5 !important;
  border-color: #007bff !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* 5. ELEVAR WRAPPERS E INPUTS DO DATEPICKER */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.DateRangePicker,
.SingleDatePicker {
  position: relative !important;
  z-index: 1000 !important;
  overflow: visible !important;
}

.DateRangePickerInput,
.SingleDatePickerInput,
.DateInput,
.DateInput_input {
  z-index: 1001 !important;
  position: relative !important;
  background: white !important;
}

/* Input em foco deve manter z-index alto */
.DateInput_input__focused {
  z-index: 1002 !important;
  outline: 2px solid #007bff !important;
  outline-offset: -2px !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* 6. GARANTIR QUE SIDEBAR STICKY NÃO INTERFIRA */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sidebar-sticky,
[style*="position: sticky"],
[style*="position:sticky"] {
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: auto !important;
  /* Permite que calendário ultrapasse lateralmente */
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* 7. PREVENIR "ÁREA BRANCA GIGANTE" */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Garantir que nenhum overlay indesejado seja criado */
.DateRangePicker::before,
.DateRangePicker::after,
.SingleDatePicker::before,
.SingleDatePicker::after {
  display: none !important;
}

/* Se algum wrapper tentar criar fundo branco, remover */
.DateRangePicker_picker__openUp,
.DateRangePicker_picker__openDown,
.SingleDatePicker_picker__openUp,
.SingleDatePicker_picker__openDown {
  background: white !important;
  max-width: 100% !important;
  width: auto !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* 8. MELHORAR VISUAL DO CALENDÁRIO */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Cabeçalho do mês */
.CalendarMonth_caption {
  font-weight: 600 !important;
  font-size: 1rem !important;
  padding: 12px 0 !important;
  color: #333 !important;
}

/* Dias da semana */
.DayPicker_weekHeader_li {
  font-weight: 600 !important;
  color: #666 !important;
  font-size: 0.85rem !important;
}

/* Dias selecionados */
.CalendarDay__selected,
.CalendarDay__selected:hover {
  background: #007bff !important;
  color: white !important;
  border-radius: 50% !important;
  font-weight: 600 !important;
}

/* Hover nos dias */
.CalendarDay:hover {
  background: #e3f2fd !important;
  border-radius: 50% !important;
}

/* Range de dias (entre início e fim) */
.CalendarDay__hovered_span,
.CalendarDay__selected_span {
  background: rgba(0, 123, 255, 0.1) !important;
  border-radius: 0 !important;
}

/* Dia de hoje */
.CalendarDay__today {
  font-weight: 700 !important;
  color: #007bff !important;
}

/* Dias fora do mês atual */
.CalendarDay__blocked_out_of_range,
.CalendarDay__blocked_out_of_range:hover {
  color: #ccc !important;
  background: transparent !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* 9. RESPONSIVO - AJUSTES PARA TELAS MENORES */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

@media (max-width: 768px) {
  .DateRangePicker_picker,
  .SingleDatePicker_picker {
    left: 50% !important;
    transform: translateX(-50%) !important;
    max-width: 95vw !important;
  }
  
  .CalendarMonth {
    padding: 8px !important;
  }
  
  .CalendarDay {
    font-size: 0.85rem !important;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* 10. GARANTIR QUE DROPDOWNS TAMBÉM FUNCIONEM */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.Select,
.Select-menu-outer,
.dropdown-menu {
  z-index: 8000 !important;
  position: absolute !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* 11. REMOVER TRANSFORM/FILTER QUE CRIAM STACKING CONTEXT */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.date-picker-wrapper,
.date-picker-wrapper *,
.card-with-datepicker,
.card-with-datepicker * {
  transform: none !important;
  filter: none !important;
  perspective: none !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* 12. FIX PARA EDGE CASES - CALENDÁRIO EM TABS/MODAIS */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.tab-content,
.modal-body,
.accordion-body {
  overflow: visible !important;
}

/* ============================================================================
   FIM DAS CORREÇÕES
   ============================================================================ */
