#calendar {
  width: 100%;
  margin: 20px 0;
}

/* Professional calendar height based on viewport */
@media (min-width: 1024px) {

  /* Target the main FullCalendar view harness with viewport-based height */
  .fc-view-harness {
    height: 60vh !important;
    max-height: 60vh !important;
    min-height: 500px !important;
  }

  .fc-view-harness-active {
    height: 60vh !important;
    max-height: 60vh !important;
    min-height: 500px !important;
  }

  /* Force the day grid to fit within the harness */
  .fc-daygrid {
    height: 100% !important;
  }

  /* Calculate cell height based on viewport */
  .fc-daygrid-day {
    height: calc(60vh / 6) !important;
    min-height: calc(60vh / 6) !important;
    max-height: calc(60vh / 6) !important;
  }

  .fc-daygrid-day-frame {
    height: calc(60vh / 6) !important;
    min-height: calc(60vh / 6) !important;
    max-height: calc(60vh / 6) !important;
  }

  .fc-daygrid-day-events {
    height: calc(60vh / 6) !important;
    min-height: calc(60vh / 6) !important;
    max-height: calc(60vh / 6) !important;
  }

  /* Adjust event text for responsive cells */
  .fc-event {
    font-size: clamp(8px, 1.2vw, 10px) !important;
  }

  /* Adjust date numbers for responsive cells */
  .fc-daygrid-day-number {
    font-size: clamp(10px, 1.5vw, 12px) !important;
    padding: 1px 2px !important;
  }
}

/* For larger screens, make it even more compact */
@media (min-width: 1440px) {
  .fc-view-harness {
    height: 50vh !important;
    max-height: 50vh !important;
  }

  .fc-view-harness-active {
    height: 50vh !important;
    max-height: 50vh !important;
  }

  .fc-daygrid-day {
    height: calc(50vh / 6) !important;
    min-height: calc(50vh / 6) !important;
    max-height: calc(50vh / 6) !important;
  }

  .fc-daygrid-day-frame {
    height: calc(50vh / 6) !important;
    min-height: calc(50vh / 6) !important;
    max-height: calc(50vh / 6) !important;
  }

  .fc-daygrid-day-events {
    height: calc(50vh / 6) !important;
    min-height: calc(50vh / 6) !important;
    max-height: calc(50vh / 6) !important;
  }
}

/* Let FullCalendar handle the height naturally on mobile/tablet */

/* Fix date text color and make it readable over events */
.fc-daygrid-day-number {
  color: #222;
  font-weight: 600;
  font-size: 14px;
  z-index: 10 !important;
  position: relative !important;
  background-color: rgba(255, 255, 255, 0.9) !important;
  padding: 2px 4px !important;
  border-radius: 3px !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

/* Improve event block appearance */
.fc-event {
  background-color: #f58220 !important;
  border: 1px solid #e6731a !important;
  color: white !important;
  font-size: 9px !important;
  padding: 0 !important;
  border-radius: 0 !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  position: absolute !important;
  overflow: hidden !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  margin: 0 !important;
  z-index: 10 !important;
}

/* Enhanced hover effects */
.fc-event:hover {
  background-color: #1a4a8c;
  color: white;
  border: 2px solid #0f3a6b;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(26, 74, 140, 0.3);
  z-index: 10;
}

/* Add a subtle animation for the hover state */
.fc-event:hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 0.6s ease-in-out;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }

  100% {
    left: 100%;
  }
}

/* Remove the dot indicator */
.fc-event::after {
  display: none !important;
}

/* Enhanced hover class for JavaScript interactions */
.fc-event-hover {
  background-color: #1a4a8c !important;
  color: white !important;
  border: 2px solid #0f3a6b !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 12px rgba(26, 74, 140, 0.3) !important;
  z-index: 10 !important;
}

/* Tooltip styling */
.event-tooltip {
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: tooltipFadeIn 0.2s ease-out;
  pointer-events: none;
}

.event-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.tooltip-content {
  text-align: center;
  line-height: 1.4;
}

.tooltip-content strong {
  display: block;
  margin-bottom: 2px;
  color: #fff;
}

.tooltip-content small {
  color: #ccc;
  font-size: 11px;
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
  #calendar {
    width: 100%;
    font-size: 12px;
    margin: 10px 0;
  }

  /* Let FullCalendar handle mobile height naturally */

  .fc-event {
    font-size: 8px;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  .fc-daygrid-day-number {
    font-size: 10px !important;
    padding: 1px 2px !important;
  }

  .event-tooltip {
    font-size: 11px;
    padding: 6px 10px;
  }

  .tooltip-content small {
    font-size: 10px;
  }
}

/* Additional styling improvements */
.fc-daygrid-event {
  margin: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

/* Make sure the event covers the entire day cell */
.fc-daygrid-event-harness {
  width: 100% !important;
  height: 100% !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 1 !important;
}

.fc-daygrid-event-harness .fc-event {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 1 !important;
}

/* Force the event to cover the full cell */
.fc-daygrid-day-events {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 1 !important;
}

.fc-daygrid-day-events .fc-event {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

/* Force the day cell to allow full coverage */
.fc-daygrid-day {
  position: relative !important;
  overflow: visible !important;
}

/* Target the specific day cell structure */
.fc-daygrid-day-frame {
  position: relative !important;
  overflow: visible !important;
  height: 100% !important;
}

/* Force events to cover the entire cell */
.fc-daygrid-day-events {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 5 !important;
  pointer-events: none !important;
}

.fc-daygrid-day-events .fc-event {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  z-index: 10 !important;
  pointer-events: auto !important;
}

.fc-daygrid-day-events {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.fc-event-title {
  font-weight: 500;
  letter-spacing: 0.3px;
  text-align: center !important;
  width: 100% !important;
}

/* Override FullCalendar's default event positioning */
.fc-daygrid-day-events .fc-event {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 1 !important;
}

/* Additional targeting for full coverage */
.fc-daygrid-day-events .fc-event-harness {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 1 !important;
}

.fc-daygrid-day-events .fc-event-harness .fc-event {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

/* Most aggressive approach - target all possible event containers */
.fc-daygrid-day-events .fc-event-harness,
.fc-daygrid-day-events .fc-event-harness .fc-event,
.fc-daygrid-day-events .fc-event {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  z-index: 20 !important;
}

/* Ensure the event container takes full space */
.fc-daygrid-day-events {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 1 !important;
}

/* Ensure date numbers stay above events */
.fc-daygrid-day-top {
  z-index: 10 !important;
  position: relative !important;
}

.fc-daygrid-day-number {
  z-index: 15 !important;
  position: relative !important;
}

/* Focus states for accessibility */
.fc-event:focus {
  outline: 2px solid #d6006d;
  outline-offset: 2px;
}

/* Active state for better user feedback */
.fc-event:active {
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

/* Selected event styling for admin */
.fc-event-selected {
  background-color: #ff6b6b !important;
  border: 2px solid #ff4757 !important;
  color: white !important;
  box-shadow: 0 0 10px rgba(255, 107, 107, 0.5) !important;
}

/* Admin form styling */
.calblock-forms {
  display: flex;
  gap: 30px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.calblock-form-section {
  flex: 1;
  min-width: 300px;
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.calblock-form-section h3 {
  margin-top: 0;
  color: #333;
  border-bottom: 2px solid #d6006d;
  padding-bottom: 10px;
}

.form-row {
  margin-bottom: 15px;
}

.form-row label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #555;
}

.form-row input,
.form-row select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: #d6006d;
  box-shadow: 0 0 0 2px rgba(214, 0, 109, 0.1);
}

.delete-instructions {
  color: #666;
  line-height: 1.5;
}

.selected-event-info {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 4px;
  padding: 10px;
  margin-top: 10px;
  color: #856404;
}

.selected-event-info strong {
  color: #856404;
}

/* Responsive admin forms */
@media (max-width: 768px) {
  .calblock-forms {
    flex-direction: column;
    gap: 20px;
  }

  .calblock-form-section {
    min-width: auto;
  }
}

/* Notification system */
.calblock-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  max-width: 400px;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

.calblock-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  font-weight: 500;
}

.calblock-notification-success .notification-content {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.calblock-notification-error .notification-content {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.calblock-notification-info .notification-content {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.notification-close {
  background: none;
  border: none;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  margin-left: 10px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.notification-close:hover {
  opacity: 1;
}

/* Button loading state */
input[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Mobile notifications */
@media (max-width: 768px) {
  .calblock-notification {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* Frontend date restrictions */
.fc-day-past {
  background-color: #f8f9fa !important;
  color: #6c757d !important;
  cursor: not-allowed !important;
}

.fc-day-past .fc-daygrid-day-number {
  color: #adb5bd !important;
}

.fc-day-past .fc-daygrid-day-events {
  opacity: 0.5;
}

/* Disable past date interactions */
.fc-day-past:hover {
  background-color: #f8f9fa !important;
}

/* Style navigation buttons for frontend */
.fc-prev-button {
  background-color: #f58220 !important;
  border-color: #f58220 !important;
  color: white !important;
  opacity: 1 !important;
}

.fc-prev-button:hover {
  background-color: #e6731a !important;
  border-color: #e6731a !important;
}

.fc-prev-button:disabled {
  background-color: #f58220 !important;
  border-color: #f58220 !important;
  color: white !important;
  opacity: 1 !important;
  cursor: pointer !important;
}

/* Style the next button for frontend */
.fc-next-button {
  background-color: #f58220 !important;
  border-color: #f58220 !important;
  color: white !important;
}

.fc-next-button:hover {
  background-color: #e6731a !important;
  border-color: #e6731a !important;
}