/* Date Picker Customizado - Seletores específicos para evitar conflitos */

:root {
  /* RGB da cor primária (#2ac1b9) */
  --primary-rgb: 42, 193, 185;
}

/* Dropdown do Select2 - apenas para datepicker */
.select2-dropdown.datepicker-dropdown {
  border: none !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4) !important;
  border-radius: 12px !important;
  z-index: 9999 !important;
  margin-top: 8px !important;
}

.select2-dropdown.datepicker-dropdown .select2-results {
  padding: 0 !important;
  background: #2a2d3a !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Contêiner principal do date picker */
.custom-datepicker,
.custom-datepicker-fixed {
  background: #2a2d3a;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-width: 320px;
  user-select: none;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.custom-datepicker-fixed {
  position: fixed !important;
  z-index: 99999 !important;
}

/* Header do calendário - especificidade máxima */
.custom-datepicker .datepicker-header,
.custom-datepicker-fixed .datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #343a50;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.custom-datepicker .datepicker-title,
.custom-datepicker-fixed .datepicker-title {
  font-weight: 600;
  font-size: 16px;
  color: #ffffff;
  flex: 1;
  text-align: center;
  letter-spacing: 0.5px;
}

.custom-datepicker .datepicker-prev,
.custom-datepicker .datepicker-next,
.custom-datepicker-fixed .datepicker-prev,
.custom-datepicker-fixed .datepicker-next {
  background: none;
  border: none;
  color: #a8adb8;
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

.custom-datepicker .datepicker-prev:hover,
.custom-datepicker .datepicker-next:hover,
.custom-datepicker-fixed .datepicker-prev:hover,
.custom-datepicker-fixed .datepicker-next:hover {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  transform: scale(1.05);
}

/* Setas desabilitadas */
.custom-datepicker .datepicker-prev.disabled,
.custom-datepicker .datepicker-next.disabled,
.custom-datepicker-fixed .datepicker-prev.disabled,
.custom-datepicker-fixed .datepicker-next.disabled {
  color: #4a4d5a !important;
  cursor: not-allowed !important;
  opacity: 0.4 !important;
}

.custom-datepicker .datepicker-prev.disabled:hover,
.custom-datepicker .datepicker-next.disabled:hover,
.custom-datepicker-fixed .datepicker-prev.disabled:hover,
.custom-datepicker-fixed .datepicker-next.disabled:hover {
  background: none !important;
  transform: none !important;
  color: #4a4d5a !important;
}

/* Área do calendário */
.custom-datepicker .datepicker-calendar,
.custom-datepicker-fixed .datepicker-calendar {
  padding: 20px;
}

.custom-datepicker .datepicker-weekdays,
.custom-datepicker-fixed .datepicker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.custom-datepicker .datepicker-weekday,
.custom-datepicker-fixed .datepicker-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #7c8394;
  padding: 8px 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.custom-datepicker .datepicker-days,
.custom-datepicker-fixed .datepicker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.custom-datepicker .datepicker-day,
.custom-datepicker-fixed .datepicker-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #ffffff;
  font-weight: 500;
  position: relative;
}

.custom-datepicker .datepicker-day:not(.datepicker-day-empty):not(.datepicker-day-disabled):hover,
.custom-datepicker-fixed .datepicker-day:not(.datepicker-day-empty):not(.datepicker-day-disabled):hover {
  background: rgba(var(--primary-rgb), 0.15);
  transform: scale(1.05);
  color: var(--primary);
}

.custom-datepicker .datepicker-day-empty,
.custom-datepicker-fixed .datepicker-day-empty {
  cursor: default;
  color: transparent;
}

.custom-datepicker .datepicker-day-disabled,
.custom-datepicker-fixed .datepicker-day-disabled {
  color: #4a4d5a;
  cursor: not-allowed;
  opacity: 0.4;
}

.custom-datepicker .datepicker-day-today,
.custom-datepicker-fixed .datepicker-day-today {
  background: rgba(var(--primary-rgb), 0.2);
  color: var(--primary);
  font-weight: 700;
  border: 2px solid var(--primary);
}

.custom-datepicker .datepicker-day-selected,
.custom-datepicker-fixed .datepicker-day-selected {
  background: var(--primary) !important;
  color: white !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
  transform: scale(1.05);
}

.custom-datepicker .datepicker-day-selected:hover,
.custom-datepicker-fixed .datepicker-day-selected:hover {
  background: var(--primary) !important;
  opacity: 0.9;
  box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.4);
}

/* Footer do calendário */
.custom-datepicker .datepicker-footer,
.custom-datepicker-fixed .datepicker-footer {
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #343a50;
}

.custom-datepicker .datepicker-clear,
.custom-datepicker .datepicker-today,
.custom-datepicker-fixed .datepicker-clear,
.custom-datepicker-fixed .datepicker-today {
  background: none;
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  color: var(--primary);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.custom-datepicker .datepicker-clear:hover,
.custom-datepicker-fixed .datepicker-clear:hover {
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b6b;
  border-color: #ff6b6b;
  transform: translateY(-1px);
}

.custom-datepicker .datepicker-today:hover,
.custom-datepicker-fixed .datepicker-today:hover {
  background: rgba(var(--primary-rgb), 0.1);
  color: #ffffff;
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Responsivo apenas para datepicker */
@media (max-width: 768px) {
  .custom-datepicker,
  .custom-datepicker-fixed {
    min-width: 300px;
  }

  .custom-datepicker .datepicker-day,
  .custom-datepicker-fixed .datepicker-day {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .custom-datepicker .datepicker-header,
  .custom-datepicker-fixed .datepicker-header {
    padding: 14px 16px;
  }

  .custom-datepicker .datepicker-calendar,
  .custom-datepicker-fixed .datepicker-calendar {
    padding: 16px;
  }

  .custom-datepicker .datepicker-footer,
  .custom-datepicker-fixed .datepicker-footer {
    padding: 14px 16px;
  }

  .custom-datepicker .datepicker-title,
  .custom-datepicker-fixed .datepicker-title {
    font-size: 15px;
  }
}

/* Animações apenas para datepicker */
.custom-datepicker *,
.custom-datepicker-fixed * {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Efeito pulse apenas no dia selecionado do datepicker */
.custom-datepicker .datepicker-day-selected::before,
.custom-datepicker-fixed .datepicker-day-selected::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(var(--primary-rgb), 0.2) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
  animation: datepicker-pulse 2s infinite;
}

@keyframes datepicker-pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

/* Focus apenas para datepicker */
.custom-datepicker .datepicker-day:focus,
.custom-datepicker-fixed .datepicker-day:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Scrollbar apenas para dropdown do datepicker */
.select2-dropdown.datepicker-dropdown .select2-results::-webkit-scrollbar {
  width: 6px;
}

.select2-dropdown.datepicker-dropdown .select2-results::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.select2-dropdown.datepicker-dropdown .select2-results::-webkit-scrollbar-thumb {
  background: rgba(var(--primary-rgb), 0.5);
  border-radius: 3px;
}

/* Select2 específico para datepicker */
.select2-container--default .select2-dropdown.datepicker-dropdown .select2-results__options {
  max-height: none !important;
}

.select2-container--default .select2-dropdown.datepicker-dropdown .select2-results__option {
  padding: 0 !important;
  background: transparent !important;
}

.select2-container--default .select2-dropdown.datepicker-dropdown .select2-results__option[aria-selected=true] {
  background: transparent !important;
}

/* User-select apenas para datepicker */
.custom-datepicker,
.custom-datepicker *,
.custom-datepicker-fixed,
.custom-datepicker-fixed * {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Font smoothing apenas para datepicker */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .custom-datepicker,
  .custom-datepicker-fixed {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Garantia final */
.custom-datepicker-fixed {
  pointer-events: auto !important;
}

/* Esconder dropdown do Select2 quando usado como datepicker */
.datepicker-select2-dropdown {
  display: none !important;
}

.select2-container--default .select2-dropdown.datepicker-select2-dropdown {
  display: none !important;
}

/* Garantir que apenas o calendário customizado seja mostrado */
.select2-container[data-select2-id*="inputData"] .select2-dropdown {
  display: none !important;
}

/* Estilo específico para container do datepicker */
.select2-container[data-select2-id*="inputData"] {
  position: relative;
}

.select2-container[data-select2-id*="inputData"] .select2-dropdown-wrapper {
  display: none !important;
}
