/**
 * @file
 * CTARA Full Calendar CSS styles.
 */

/* Calendar Container */
.ctara-full-calendar-container {
  position: relative;
  margin: 1rem 0;
}

.ctara-full-calendar {
  width: 100%;
  font-family: Arial, sans-serif;
}

/* Loading Indicator */
.calendar-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 1rem 2rem;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
  font-weight: bold;
  color: #007bff;
}

.calendar-loading::before {
  content: "";
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Event Styling by Content Type */
.fc-event.event-type-news {
  background-color: #007bff !important;
  border-color: #0056b3 !important;
  color: white !important;
}

.fc-event.event-type-breaking-news {
  background-color: #dc3545 !important;
  border-color: #c82333 !important;
  color: white !important;
  font-weight: bold;
}

.fc-event.event-type-breaking-news.important-news {
  background-color: #ff0000 !important;
  border-color: #cc0000 !important;
  animation: pulse 2s infinite;
}

.fc-event.event-type-event {
  background-color: #28a745 !important;
  border-color: #1e7e34 !important;
  color: white !important;
}

.fc-event.event-type-seminar {
  background-color: #fd7e14 !important;
  border-color: #e55a00 !important;
  color: white !important;
  font-weight: 500;
}

/* Event Hover Effects */
.fc-event:hover,
.fc-event.event-hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

/* Event Images */
.event-image {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

/* Event Category Badge */
.event-category-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.7em;
  margin-left: 4px;
  vertical-align: middle;
}

/* Modal Styling */
.modal .event-modal-image {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: 4px;
  margin-bottom: 1rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.modal .event-description {
  font-style: italic;
  color: #666;
  margin-bottom: 1rem;
}

.modal .event-body {
  line-height: 1.6;
  margin-bottom: 1rem;
}

.modal .event-body img {
  max-width: 100%;
  height: auto;
}

/* Calendar Page Styling */
.ctara-calendar-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.ctara-calendar-page .page-title {
  text-align: center;
  margin-bottom: 2rem;
  color: #2c3e50;
}

/* FullCalendar Customizations */
.fc .fc-toolbar {
  margin-bottom: 1rem;
}

.fc .fc-toolbar-title {
  color: #2c3e50;
  font-weight: 600;
}

.fc .fc-button-primary {
  background-color: #007bff;
  border-color: #007bff;
}

.fc .fc-button-primary:hover,
.fc .fc-button-primary:focus {
  background-color: #0056b3;
  border-color: #004085;
}

.fc .fc-button-primary.fc-button-active {
  background-color: #0056b3;
  border-color: #004085;
}

.fc .fc-daygrid-event {
  margin-bottom: 2px;
  padding: 2px 4px;
  border-radius: 3px;
}

.fc .fc-event-title {
  font-weight: 500;
  font-size: 0.85em;
}

/* Responsive Design */
@media (max-width: 767px) {
  .ctara-full-calendar-container {
    margin: 0.5rem 0;
  }

  .fc .fc-toolbar {
    flex-direction: column;
    gap: 0.5rem;
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
  }

  .fc .fc-button-group {
    flex-wrap: wrap;
  }

  .fc .fc-event-title {
    font-size: 0.75em;
  }

  .event-image {
    display: none;
  }

  .event-category-badge {
    display: none;
  }

  .modal .event-modal-image {
    max-width: 250px;
  }
}

@media (max-width: 575px) {
  .ctara-calendar-page {
    padding: 0.5rem;
  }

  .fc .fc-toolbar-title {
    font-size: 1.2em;
  }

  .fc .fc-button {
    font-size: 0.8em;
    padding: 0.25rem 0.5rem;
  }
}

/* Print Styles */
@media print {
  .ctara-full-calendar-container {
    break-inside: avoid;
  }

  .fc .fc-toolbar {
    display: none;
  }

  .fc .fc-event {
    background-color: #f8f9fa !important;
    color: #000 !important;
    border: 1px solid #000 !important;
  }
}

/* Accessibility Improvements */
.fc-event:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

.fc-button:focus {
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .fc-event {
    border-width: 2px !important;
  }

  .fc-event.event-type-news {
    background-color: #0000ff !important;
  }

  .fc-event.event-type-breaking-news {
    background-color: #ff0000 !important;
  }

  .fc-event.event-type-event {
    background-color: #008000 !important;
  }

  .fc-event.event-type-seminar {
    background-color: #ff8c00 !important;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .ctara-full-calendar {
    color: #000000;
  }

  .fc .fc-toolbar-title {
    color: #000000;
  }

  .calendar-loading {
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
  }
}

/* Animation for Important Breaking News */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
  }
}

/* Calendar Legend */
.calendar-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9em;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

.legend-color.news {
  background-color: #007bff;
}

.legend-color.breaking-news {
  background-color: #dc3545;
}

.legend-color.event {
  background-color: #28a745;
}