/**
 * Request Calendar Module CSS
 * Styles for custom time request functionality
 */

/* Request Calendar Container */
#requestCalendar {
  height: 400px;
  background: #fff;
  border-radius: 8px;
  padding: 10px;
}

/* Note: #customRequestCalendar styles are in custom-time-request.css */

/* Day cell improvements for better click area */
#requestCalendar .fc-daygrid-day-events,
#customRequestCalendar .fc-daygrid-day-events {
  position: absolute;
  bottom: 2px;
  left: 2px;
  right: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  pointer-events: none; /* Allow clicks to pass through to day cell */
  z-index: 1; /* Keep above day cell but below click area */
}

/* But make individual events NOT clickable for custom calendar */
#requestCalendar .fc-daygrid-event {
  pointer-events: auto;
  position: static !important;
  margin: 0 !important;
}

#customRequestCalendar .fc-daygrid-event {
  pointer-events: none !important; /* Don't intercept clicks */
  position: static !important;
  margin: 0 !important;
}

/* Calendar customization for request calendar */
#requestCalendar .fc,
#customRequestCalendar .fc {
  font-family: inherit;
}

#requestCalendar .fc-toolbar,
#customRequestCalendar .fc-toolbar {
  margin-bottom: 1rem;
}

#requestCalendar .fc-toolbar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
}

#requestCalendar .fc-button {
  background-color: #007bff;
  border-color: #007bff;
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  font-weight: 500;
}

#requestCalendar .fc-button:hover {
  background-color: #0056b3;
  border-color: #0056b3;
}

#requestCalendar .fc-button-primary:not(:disabled):active,
#requestCalendar .fc-button-primary:not(:disabled).fc-button-active,
#customRequestCalendar .fc-button-primary:not(:disabled):active,
#customRequestCalendar .fc-button-primary:not(:disabled).fc-button-active {
  background-color: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Table headers */
#requestCalendar .fc-col-header-cell,
#customRequestCalendar .fc-col-header-cell {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  font-size: 0.8rem;
}

/* Grid lines */
#requestCalendar .fc-scrollgrid,
#customRequestCalendar .fc-scrollgrid {
  border-color: rgba(255, 255, 255, 0.1);
}

#requestCalendar .fc-scrollgrid td,
#requestCalendar .fc-scrollgrid th,
#customRequestCalendar .fc-scrollgrid td,
#customRequestCalendar .fc-scrollgrid th {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Day cells */
#requestCalendar .fc-daygrid-day {
  cursor: pointer;
  transition: background-color 0.2s;
}

#requestCalendar .fc-daygrid-day:hover {
  background-color: #f0f0f0;
}

#requestCalendar .fc-day-past {
  background-color: #f8f9fa;
  cursor: not-allowed;
}

#requestCalendar .fc-day-other {
  opacity: 0.3;
}

/* Events (selected time slots) */
#requestCalendar .fc-event,
#customRequestCalendar .fc-event {
  cursor: pointer;
  font-size: 0.75rem;
  border-radius: 4px;
  padding: 1px 3px;
  margin: 1px;
  position: relative;
  z-index: 1;
}

/* Make events smaller so more day cell area is clickable */
#requestCalendar .fc-event-main,
#customRequestCalendar .fc-event-main {
  padding: 2px 4px;
  font-size: 0.75rem;
  min-width: 20px;
  text-align: center;
}

/* Make event numbers circular and small */
#customRequestCalendar .fc-event {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px auto;
  font-weight: bold;
}

/* Ensure day cells remain clickable even with events */
#requestCalendar .fc-daygrid-day-frame,
#customRequestCalendar .fc-daygrid-day-frame {
  position: relative;
  z-index: 0;
}

/* Ensure day numbers don't block clicks */
#requestCalendar .fc-daygrid-day-number,
#customRequestCalendar .fc-daygrid-day-number {
  pointer-events: none;
  z-index: 2;
}

/* Make the entire day cell clickable */
#requestCalendar .fc-daygrid-day-top,
#customRequestCalendar .fc-daygrid-day-top {
  position: relative;
  z-index: 3;
  cursor: pointer;
}

#requestCalendar .fc-event:hover,
#customRequestCalendar .fc-event:hover {
  opacity: 0.8;
  z-index: 2;
}

/* Time slot modal */
#timeSlotModal .modal-content {
  background-color: #0a3622;
  color: #fff;
}

#timeSlotModal .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

#timeSlotModal .modal-footer {
  border-top-color: rgba(255, 255, 255, 0.1);
}

#timeSlotModal .btn-close {
  filter: invert(1);
}

/* Time slots grid */
.time-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  padding: 10px 0;
}

.time-slot-btn {
  padding: 12px 8px;
  font-size: 0.9rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  background-color: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  pointer-events: auto;
}

.time-slot-btn:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

.time-slot-btn.btn-success {
  background-color: #28a745;
  border-color: #28a745;
  color: #fff;
}

.time-slot-btn.btn-warning {
  background-color: #ffc107;
  border-color: #ffc107;
  color: #212529;
}

.time-slot-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Selected slots list */
.selected-request-slots,
.custom-selected-request-slots {
  margin-top: 20px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.selected-request-slots h6,
.custom-selected-request-slots h6 {
  margin-bottom: 10px;
  color: #333;
  font-weight: 600;
}

#selectedSlotsList,
#customSelectedSlotsList {
  /* max-height: 200px; */
  overflow-y: auto;
}

#selectedSlotsList .list-group-item,
#customSelectedSlotsList .list-group-item {
  background-color: #fff;
  border: 1px solid #dee2e6;
  color: #333;
  padding: 10px 15px;
  margin-bottom: 5px;
  border-radius: 4px;
}

/* Remove button styling for both lists */
#selectedSlotsList .remove-slot-btn,
#customSelectedSlotsList .remove-slot-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #dc3545;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
  transition: all 0.2s;
  cursor: pointer;
  text-align: center;
}

#selectedSlotsList .remove-slot-btn:hover,
#customSelectedSlotsList .remove-slot-btn:hover {
  background-color: #c82333;
  transform: scale(1.15);
}

/* Use × character instead of icon */
#selectedSlotsList .remove-slot-btn::before,
#customSelectedSlotsList .remove-slot-btn::before {
  content: "×";
  font-size: 18px;
  font-weight: normal;
  display: block;
  margin-top: -2px;
}

/* Send request button */
#sendRequestBtn,
#sendCustomRequestBtn {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-weight: 500;
  /* margin-top: 20px; */
}

#sendRequestBtn:disabled,
#sendCustomRequestBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Request modal container */
.request-calendar-modal .modal-dialog {
  max-width: 800px;
}

.request-calendar-modal .modal-content {
  background-color: #fff;
  color: #333;
}

.request-calendar-modal .modal-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.request-calendar-modal .modal-body {
  padding: 20px;
}

/* Info messages */
.request-info-message {
  background-color: #e7f3ff;
  border: 1px solid #b3d9ff;
  color: #004085;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.request-info-message i {
  margin-right: 8px;
}

/* Custom request calendar specific */
#customRequestModal .modal-dialog {
  max-width: 900px;
}

#customRequestModal .modal-content {
  max-height: 90vh;
  overflow-y: auto;
}

/* Calendar height adjustments */
@media (max-width: 768px) {
  #requestCalendar,
  #customRequestCalendar {
    height: 350px;
  }
  
  .time-slots-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }
  
  .time-slot-btn {
    padding: 10px 6px;
    font-size: 0.85rem;
  }
}

/* Dark theme adjustments for consistency */
.dark-theme #requestCalendar,
.dark-theme #customRequestCalendar {
  background-color: #1a1a1a;
}

.dark-theme #requestCalendar .fc-toolbar-title,
.dark-theme #customRequestCalendar .fc-toolbar-title {
  color: #fff;
}

.dark-theme #requestCalendar .fc-daygrid-day:hover,
.dark-theme #customRequestCalendar .fc-daygrid-day:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.dark-theme .selected-request-slots,
.dark-theme .custom-selected-request-slots {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark-theme .selected-request-slots h6,
.dark-theme .custom-selected-request-slots h6 {
  color: #fff;
}

.dark-theme #selectedSlotsList .list-group-item,
.dark-theme #customSelectedSlotsList .list-group-item {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Loading state */
.request-calendar-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 400px;
  color: #666;
}

.request-calendar-loading i {
  font-size: 2rem;
  margin-right: 10px;
}

/* Selected count info */
.selected-count-info {
  text-align: center;
  padding: 10px;
  background-color: rgba(0, 123, 255, 0.1);
  border-radius: 6px;
  margin-top: 15px;
}

.selected-count-info small {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Hide past weeks functionality */
#requestCalendar .fc-daygrid-week,
#customRequestCalendar .fc-daygrid-week {
  transition: all 0.3s ease;
}

/* Ensure proper spacing for hidden weeks */
#requestCalendar .fc-scrollgrid-section,
#customRequestCalendar .fc-scrollgrid-section {
  height: auto !important;
}

#requestCalendar .fc-scrollgrid-section-body,
#customRequestCalendar .fc-scrollgrid-section-body {
  height: auto !important;
}

/* Priority slot indicator */
.priority-icon {
  color: #ffc107;
  font-size: 0.8rem;
  margin-left: 4px;
}

/* Animation for slot selection */
@keyframes slotPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.time-slot-btn.btn-success {
  animation: slotPulse 0.3s ease;
}

/* Tooltip styling */
.request-calendar-tooltip {
  position: absolute;
  background-color: #333;
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.875rem;
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
}

.request-calendar-tooltip::before {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #333;
}

/* Max slots reached styling */
#customRequestCalendar.max-slots-reached .fc-daygrid-day:not(.fc-day-past) {
  position: relative;
}

#customRequestCalendar.max-slots-reached .fc-daygrid-day:not(.fc-day-past):not(.has-slots)::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.1);
  pointer-events: none;
}

/* Visual indicator for days that have slots when max is reached */
#customRequestCalendar.max-slots-reached .fc-daygrid-day.has-slots {
  box-shadow: inset 0 0 0 2px #28a745;
}