/* ------------------------------------------------ CALENDER */

date-picker {
  margin: 20px 0;
  position: relative;
  display: block;
  z-index: 1;
}

date-picker:focus-within {
  z-index: 1000; /* Increased significantly */
}

.bm-date-input {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #000;
  position: relative;
  z-index: 2;
  background-color: transparent;
  padding-bottom: 10px;
}

.bm-date-input input {
  width: 30px;
  height: 24px; /* Set a fixed height */
  line-height: 24px;
  text-align: center;
  border: none;
  padding: 0;
  margin: 0 2px;
  outline: none;
  background: transparent;
  box-sizing: border-box;
}

.bm-date-input input[placeholder="YYYY"] {
  width: 50px;
}

.bm-date-input input:focus {
  outline: none;
  background-color: rgba(0, 0, 0, 0.05);
}

.bm-date-input input::-moz-focus-inner {
  border: 0;
  padding: 0;
}

.bm-date-input .separator {
  color: #999;
  margin: 0 2px;
  line-height: 24px;
}

.bm-date-input button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--bentley-living-green-50);
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
}

.bm-date-input button svg {
  width: 20px;
  height: 20px;
}

.calendar-popup {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 16px;
  width: 280px;
  font-family: Arial, sans-serif;
  z-index: 1001;
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
}

date-picker:focus-within .calendar-popup {
  z-index: 1002;
}

.calendar-popup.ng-hide-add,
.calendar-popup.ng-hide-remove {
  transition: opacity 0.3s ease-in-out;
}

.calendar-popup.ng-hide {
  opacity: 0;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.month-year {
  font-size: 16px;
  font-weight: 300;
  color: #3c4043;
}

.nav-buttons {
  display: flex;
}

.nav-buttons button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  color: #5f6368;
}

.calendar-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.calendar-table th {
  font-weight: 300;
  color: #5f6368;
  font-size: 11px;
  padding-bottom: 8px;
  text-transform: uppercase;
}

.calendar-table td {
  text-align: center;
  padding: 0;
  font-size: 14px;
  color: #3c4043;
  width: 40px;
  height: 40px;
  line-height: 40px;
  position: relative;
  cursor: pointer;
}

.calendar-table td:not(.current-month) {
  color: #bdc1c6;
}

.calendar-table td.selected::after,
.calendar-table td.today:not(.selected)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  z-index: -1;
}

.calendar-table td.selected::after {
  background-color: var(--bentley-living-green-50);
}

.calendar-table td.selected {
  color: white;
}

.calendar-table td.today:not(.selected)::after {
  border: 1px solid var(--bentley-living-green-50);
}

.calendar-table td.disabled {
  color: #ccc;
  cursor: not-allowed;
}

.month-year-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.month-grid,
.year-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.month-grid div,
.year-grid div {
  padding: 5px;
  text-align: center;
  cursor: pointer;
}

.month-grid div.selected,
.year-grid div.selected {
  background-color: #007bff;
  color: white;
}

.year-selector {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
}

.year-selector .year-list div {
  padding: 5px 10px;
  cursor: pointer;
}

.year-selector .year-list div:hover {
  background-color: #f0f0f0;
}

.year-selector .year-list div.selected {
  background-color: #007bff;
  color: white;
}

.month-grid div.disabled,
.year-list div.disabled {
  color: #ccc;
  cursor: not-allowed;
}

.month-grid div.disabled:hover,
.year-list div.disabled:hover {
  background-color: transparent;
}

.bm-date-input-container {
  position: relative;
}

.validation-message {
  color: #ff0000;
  font-size: 12px;
  margin-top: 4px;
  position: absolute;
  width: 100%;
}

.bm-date-input input.invalid-date {
  border-color: #ff0000;
  background-color: rgba(255, 0, 0, 0.1);
}

/* Keep the shake animation */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-5px);
  }
  40%,
  80% {
    transform: translateX(5px);
  }
}

/* Add a temporary shake animation when the error first appears */
.bm-date-input input.invalid-date.shake {
  animation: shake 0.5s;
}
