/* ======================================================
   CUSTOM DATE & TIME PICKER STYLES
   ====================================================== */

/* Wrapper for custom picker controls */
.picker-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.picker-input-container {
  display: flex;
  align-items: center;
  position: relative;
}

.picker-input {
  width: 100%;
  padding: 12px 40px 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
  cursor: pointer;
  background: white;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.picker-input:focus {
  border-color: #3b82f6;
  outline: none;
}

.picker-icon {
  position: absolute;
  right: 12px;
  pointer-events: none;
  font-size: 16px;
  color: #6b7280;
}

/* Date Picker Calendar */
.date-picker-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
  padding: 16px;
  min-width: 320px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.date-picker-container.open {
  display: block;
}

/* Calendar Header */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.calendar-nav-button {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.calendar-nav-button:hover {
  background: #e5e7eb;
}

.calendar-month-year {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  text-align: center;
  flex: 1;
}

/* Month and Year Selectors */
.calendar-month-select,
.calendar-year-select {
  padding: 8px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23111827' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 32px;
}

.calendar-month-select:hover,
.calendar-year-select:hover {
  border-color: #3b82f6;
  background-color: #f9fafb;
}

.calendar-month-select:focus,
.calendar-year-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.calendar-month-select {
  flex: 1;
  margin-right: 8px;
}

.calendar-year-select {
  flex: 1;
  margin-left: 8px;
}

/* Calendar Weekdays */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.calendar-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  padding: 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Calendar Days */
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  transition: all 0.2s ease;
  background: white;
}

.calendar-day:hover:not(.empty):not(.selected) {
  background: #f3f4f6;
  border-color: #e5e7eb;
}

.calendar-day.empty {
  color: #e5e7eb;
  cursor: default;
}

.calendar-day.today {
  border-color: #3b82f6;
  color: #3b82f6;
  font-weight: 700;
}

.calendar-day.selected {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-color: #2563eb;
  font-weight: 700;
}

/* Time Picker Container */
.time-picker-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
  padding: 16px;
  min-width: 280px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.time-picker-container.open {
  display: block;
}

.time-picker-content {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.time-column {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.time-column-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.time-scroller {
  height: 200px;
  overflow-y: scroll;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 0;
  scroll-behavior: smooth;
}

.time-scroller::-webkit-scrollbar {
  width: 6px;
}

.time-scroller::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.time-scroller::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.time-scroller::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.time-option {
  padding: 12px 8px;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.time-option:hover {
  background: #f3f4f6;
  color: #111827;
}

.time-option.selected {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  font-weight: 700;
}

/* Time Picker Separator */
.time-picker-separator {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  padding-top: 50px;
  user-select: none;
}

/* Confirm Button */
.picker-confirm-button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  margin-top: 12px;
  transition: all 0.3s ease;
}

.picker-confirm-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.picker-confirm-button:active {
  transform: translateY(0);
}

/* Overlay for closing picker */
.picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  z-index: 999;
}

.picker-overlay.active {
  display: block;
}


/* ======================================================
   MOBILE OVERRIDES — Prevent iOS zoom + centered overlays
   ====================================================== */
@media (max-width: 768px) {

  /* Prevent iOS zoom: font-size must be >= 16px */
  .picker-input {
    font-size: 16px;
    padding: 10px 36px 10px 12px;
  }

  .picker-icon {
    font-size: 14px;
    right: 10px;
  }

  /* ---- DATE PICKER: Fixed centered overlay ---- */
  .date-picker-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 0;
    width: calc(100vw - 3rem);
    max-width: 320px;
    padding: 14px;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    border: 1px solid #d1d5db;
    z-index: 10001;
  }

  .calendar-header {
    margin-bottom: 10px;
  }

  .calendar-nav-button {
    width: 34px;
    height: 34px;
    font-size: 16px;
    border-radius: 8px;
  }

  .calendar-month-year {
    font-size: 15px;
  }

  .calendar-weekday {
    font-size: 11px;
    padding: 6px 0;
  }

  .calendar-weekdays,
  .calendar-days {
    gap: 3px;
  }

  .calendar-day {
    font-size: 14px;
    border-radius: 6px;
    min-height: 36px;
  }

  /* ---- TIME PICKER: Fixed centered overlay ---- */
  .time-picker-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 0;
    width: calc(100vw - 4rem);
    max-width: 280px;
    padding: 14px;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    border: 1px solid #d1d5db;
    z-index: 10001;
  }

  .time-picker-content {
    gap: 8px;
  }

  .time-scroller {
    height: 180px;
    border-radius: 8px;
  }

  .time-option {
    padding: 10px 6px;
    font-size: 16px;
    min-height: 40px;
  }

  .time-column-label {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .time-picker-separator {
    font-size: 22px;
    padding-top: 45px;
  }

  .picker-confirm-button {
    padding: 12px;
    font-size: 14px;
    margin-top: 10px;
    border-radius: 8px;
    min-height: 44px;
  }

  /* Overlay backdrop for mobile pickers */
  .picker-overlay {
    z-index: 10000;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
}

@media (max-width: 480px) {
  .date-picker-container {
    width: calc(100vw - 2rem);
    max-width: 290px;
    padding: 12px;
  }

  .calendar-day {
    font-size: 13px;
    min-height: 32px;
  }

  .calendar-nav-button {
    width: 30px;
    height: 30px;
  }

  .time-picker-container {
    width: calc(100vw - 2.5rem);
    max-width: 250px;
    padding: 12px;
  }

  .time-scroller {
    height: 150px;
  }

  .time-option {
    font-size: 15px;
    min-height: 36px;
    padding: 8px 4px;
  }
}
