/* ============================================================================
   CORREÇÃO DEFINITIVA - Z-INDEX DO CALENDÁRIO (DatePicker)
   Problema: Calendário fica atrás de cards e tem "faixa vermelha" no topo
   Solução: Elevar z-index massivamente + remover overflow hidden + portal
   ============================================================================ */

/* 1) EVITAR CLIPPING NOS CARDS QUE CERCAM O DATEPICKER */
.card, 
.dash-card, 
.dbc-card,
.section, 
.panel, 
.container,
.card-body,
.dbc-card-body {
  overflow: visible !important;
  /* Remove overflow hidden que clipa o calendário */
}

/* 2) ELEVAR MASSIVAMENTE O Z-INDEX DO POPOVER DO REACT-DATES */
.DateRangePicker_picker,
.SingleDatePicker_picker,
.DayPicker,
.CalendarMonth,
.DayPickerNavigation {
  position: relative !important;
  z-index: 9999 !important;  /* Máximo possível */
  outline: none !important;  /* Remove "faixa/risco" vermelha */
  border: none !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important; /* Shadow forte para destacar */
}

/* 3) SE USAR PORTAL (with_portal=True), ELEVAR AINDA MAIS */
.DateRangePicker_picker__portal,
.SingleDatePicker_picker__portal,
.DateRangePicker_portal,
.SingleDatePicker_portal {
  z-index: 99999 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
}

/* 4) ELEVAR WRAPPERS DO DATEPICKER */
.DateRangePicker, 
.SingleDatePicker, 
.DateInput, 
.DateInput_input,
.DateRangePickerInput,
.SingleDatePickerInput {
  z-index: 9998 !important;
  position: relative !important;
}

/* 5) GARANTIR QUE NÃO "SAIA" PARA FORA DA TELA À DIREITA */
.DateRangePicker_picker__directionRight {
  right: 0 !important;
  left: auto !important;
}

.DateRangePicker_picker__directionLeft {
  left: 0 !important;
  right: auto !important;
}

/* 6) BOTÕES DE NAVEGAÇÃO DO MÊS TOTALMENTE CLICÁVEIS */
.DayPickerNavigation_button,
.DayPickerNavigation_button__horizontal {
  z-index: 99999 !important;
  position: relative !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* 7) SE HOUVER DROPDOWNS SELECT CORTANDO, ELEVAR TAMBÉM */
.Select, 
.Select-menu-outer, 
.VirtualizedSelectFocusedOption,
.dropdown-menu {
  z-index: 9000 !important;
  position: relative !important;
}

/* 8) GARANTIR QUE SIDEBAR STICKY NÃO CORTE CALENDÁRIO */
.sidebar-sticky,
[style*="position: sticky"],
[style*="position:sticky"] {
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: auto !important;
}

/* 9) REMOVER TRANSFORM/FILTER QUE CRIAM STACKING CONTEXT PROBLEMÁTICO */
.card-with-calendar,
.date-picker-wrapper,
.date-selector-container {
  transform: none !important;
  filter: none !important;
  perspective: none !important;
}

/* 10) AJUSTE RESPONSIVO - EM TELAS MENORES */
@media (max-width: 768px) {
  .DateRangePicker_picker,
  .SingleDatePicker_picker {
    left: 0 !important;
    right: 0 !important;
    max-width: 100vw !important;
    margin: 0 auto !important;
  }
}

/* 11) GARANTIR QUE OVERLAY DO PORTAL SEJA TRANSPARENTE E NÃO BLOQUEIE */
.DateRangePicker_picker__portal::before,
.SingleDatePicker_picker__portal::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 9998;
}

/* 12) MELHORAR VISUAL DO CALENDÁRIO */
.CalendarDay__selected,
.CalendarDay__selected:hover {
  background: #007bff !important;
  color: white !important;
  border-radius: 50% !important;
}

.CalendarDay__hovered_span {
  background: rgba(0, 123, 255, 0.15) !important;
  border-radius: 4px !important;
}

.CalendarMonth_caption {
  font-weight: 600 !important;
  font-size: 1rem !important;
  padding: 10px 0 !important;
}

/* 13) ESCALA COMPLETA DE Z-INDEX PARA EVITAR CONFLITOS */
/* Ordem: 
   - 1000: Sidebar sticky
   - 5000: Modais normais
   - 9000: Dropdowns
   - 9998-9999: DatePicker sem portal
   - 99999: DatePicker com portal
*/

.modal {
  z-index: 8000 !important;
}

.toast,
.notification,
.alert-toast {
  z-index: 10000 !important;
}

/* ============================================================================
   FIM DAS CORREÇÕES DE Z-INDEX
   ============================================================================ */
