/* Date Picker Container */
.date-picker-container {
  position: relative;
  width: 100%;
}

.date-picker-input {
  cursor: pointer;
  background-color: #fff !important;
  /* Ensure it looks writable/interactable */
  caret-color: transparent;
  /* Hide cursor */
}

/* Modal Overlay */
.date-picker-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
  z-index: 1050;
  display: none;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.date-picker-modal-overlay.show {
  opacity: 1;
}

/* Modal Content (Apple Style) */
.date-picker-modal {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 320px;
  padding: 20px;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.date-picker-modal-overlay.show .date-picker-modal {
  transform: scale(1);
}

/* Header */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.calendar-title-container {
  display: flex;
  gap: 10px;
  font-weight: 600;
  font-size: 1.1rem;
  color: #1d1d1f;
}

.calendar-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 10px;
  color: #007aff;
  /* Apple Blue */
  font-size: 1.2rem;
  transition: opacity 0.2s;
  border-radius: 8px;
}

.calendar-nav-btn:hover {
  background-color: rgba(0, 122, 255, 0.1);
}

/* Year/Month Selection (Dropdowns/Scrollers can be implied or actual selects styled hidden) */
.calendar-title-select {
  appearance: none;
  background: transparent;
  border: none;
  font-weight: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
  padding: 0 5px;
  border-radius: 5px;
}

.calendar-title-select:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  text-align: center;
}

.calendar-weekday {
  font-size: 0.8rem;
  color: #86868b;
  /* Apple Gray */
  font-weight: 500;
  margin-bottom: 10px;
}

.calendar-day {
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  /* Circle */
  font-size: 0.95rem;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.calendar-day:hover:not(.empty) {
  background-color: #f5f5f7;
}

.calendar-day.selected {
  background-color: #007aff;
  color: white;
  font-weight: 600;
}

.calendar-day.today {
  color: #007aff;
  font-weight: 600;
}

.calendar-day.today.selected {
  color: white;
}

.calendar-day.empty {
  cursor: default;
}

/* Year & Month Selection Styles */
.calendar-years,
.calendar-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
}

.calendar-year-item,
.calendar-month-item {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 0.95rem;
  color: #1d1d1f;
}

.calendar-year-item:hover,
.calendar-month-item:hover {
  background-color: #f5f5f7;
}

.calendar-year-item.selected,
.calendar-month-item.selected {
  background-color: #007aff;
  color: white;
  font-weight: 600;
}

/* Ensure title is clickable to switch views */
.calendar-title-container {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background-color 0.2s;
}

.calendar-title-container:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Footer Actions */
.calendar-footer {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.calendar-btn {
  padding: 8px 16px;
  border-radius: 20px;
  /* Capsule */
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  font-weight: 500;
  transition: transform 0.1s;
}

.calendar-btn-clear {
  background-color: #f5f5f7;
  color: #1d1d1f;
}

.calendar-btn-confirm {
  background-color: #007aff;
  color: white;
}

.calendar-btn:active {
  transform: scale(0.96);
}

/* Mobile Optimization */
@media (max-width: 768px) {
  .date-picker-modal {
    width: 90%;
    max-width: 360px;
    /* Prevent it from being too wide on tablets, but 90% on smaller phones */
  }

  .calendar-day,
  .calendar-year-item,
  .calendar-month-item {
    /* Slightly larger touch targets on mobile */
    min-height: 44px;
  }
}