.custom-datepicker {
  cursor: pointer;
  padding-right: 45px !important;
}

.custom-datepicker-container {
  position: relative;
  width: 100%;
}

.calendar-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  pointer-events: none;
  z-index:999;
}

[dir="rtl"] .custom-datepicker {
  padding-left: 45px !important;
  padding-right: 12px !important;
}

[dir="rtl"] .calendar-icon {
  right: auto;
  left: 12px;
}

/* RTL Calendar Dropdown */
[dir="rtl"] .calendar-dropdown {
  direction: rtl;
}

[dir="rtl"] .calendar-header {
  direction: rtl;
}

[dir="rtl"] .calendar-days-header {
  direction: rtl;
}

[dir="rtl"] .calendar-days-grid {
  direction: rtl;
}

.calendar-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 999999 !important;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 20px;
  width: 360px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  border: 1px solid #ddd;
}

.calendar-dropdown.show {
  opacity: 1;
  visibility: visible;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.calendar-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: #161616;
}

.calendar-nav-btn:hover:not(:disabled) {
  background-color: #f3f4f6;
}

.calendar-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.calendar-month-year {
  font-weight: 600;
  font-size: 18px;
  color: #161616;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
}

.calendar-month-year:hover {
  background-color: #f3f4f6;
}

.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.calendar-day-name {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  padding: 8px 0;
  width: 42px;
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  border: 2px solid transparent;
  background: none;
  border-radius: 50%;
  font-size: 14px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  color: #161616;
}

.calendar-day:hover:not(:disabled) {
  background-color: #f3f4f6;
}

.calendar-day.other-month {
  opacity: 0.4;
  color: #9ca3af;
}

.calendar-day.today {
  border-color: #1b8354;
  color: #1b8354;
  font-weight: 600;
}

.calendar-day.selected {
  background-color: #1b8354 !important;
  color: white !important;
  font-weight: 600;
}

.calendar-day:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.month-year-selector {
  display: none;
}

.month-year-selector.show {
  display: block;
}

.year-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.year-display {
  font-weight: 600;
  font-size: 18px;
  color: #161616;
}

.months-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.month-btn {
  padding: 12px;
  border: 2px solid #e5e7eb;
  background: white;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  color: #161616;
}

.month-btn:hover:not(:disabled) {
  background-color: #f3f4f6;
  border-color: #1b8354;
  color: #161616;
}

.month-btn.selected {
  background-color: #1b8354;
  color: white;
  border-color: #1b8354;
}

.month-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.years-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.year-btn {
  padding: 10px;
  border: 2px solid #e5e7eb;
  background: white;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  color: #161616;
}

.year-btn:hover {
  background-color: #f3f4f6;
  border-color: #1b8354;
}

.year-btn.selected {
  background-color: #1b8354;
  color: white;
  border-color: #1b8354;
}

@media (max-width: 991px) {
  .calendar-dropdown {
    width: 300px;
    padding: 15px;
    bottom: calc(100% + 5px);
    top: auto;
  }

  .calendar-day {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .calendar-day-name {
    width: 36px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .calendar-dropdown {
    width: 280px;
    padding: 12px;
    bottom: calc(100% + 5px);
    top: auto;
  }

  .calendar-day {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .calendar-day-name {
    width: 32px;
    font-size: 10px;
  }

  .calendar-month-year {
    font-size: 16px;
  }

  .calendar-nav-btn {
    padding: 6px;
  }

  .month-btn {
    padding: 8px 6px;
    font-size: 12px;
  }

  .year-btn {
    padding: 6px;
    font-size: 12px;
  }
}
