/* ========================================
   ARIC Events Calendar - Enhanced Styles
   Version: 1.3.26
   ======================================== */

/* --- Base List Styles --- */
.aric-list-loading {
  padding: 20px;
  text-align: center;
  color: #666;
  font-style: italic;
}

.aric-list { 
  list-style: none; 
  padding: 0; 
  margin: 0; 
}

/* --- Enhanced Month/Week Groupings --- */
.aric-list__month, 
.aric-list__week { 
  margin: 24px 0 12px; 
}

.aric-list__month-label,
.aric-list__group-label {
  font-weight: 800;
  font-size: 1.1em;
  padding: 10px 12px;
  background: #f8f8f8;
  border-left: 4px solid #f36c21;
  border-radius: 4px;
  letter-spacing: 0.3px;
  color: #333;
}

.aric-list__day { 
  margin: 10px 0 6px; 
}

.aric-list__day-label { 
  font-weight: 800; 
  font-size: 0.95em; 
  opacity: 0.9; 
}

.aric-list__item { 
  margin: 0 0 12px 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Smooth fade out for filtered items */
.aric-list__item[style*="display: none"] {
  opacity: 0;
  transform: scale(0.98);
}

/* --- Enhanced List Cards --- */
.aric-list__link {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 2px solid #f36c21;
  border-left-width: 2px;
  background: #fff;
  padding: 14px 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.aric-list__link:hover {
  border-color: #d95715;
  border-left-width: 5px;
  padding-left: 13px; /* Compensate for thicker left border */
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(243, 108, 33, 0.15);
}

.aric-list__link:focus {
  outline: none;
  border-color: #d95715;
  box-shadow: 0 0 0 3px rgba(243, 108, 33, 0.2);
}

.aric-list__line { 
  line-height: 1.4; 
}

/* Enhanced Meta Styling */
.aric-list__meta { 
  font-size: 0.9em; 
  font-weight: 600; 
  color: #555;
  display: block; 
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

/* Enhanced Title with Icon */
.aric-list__title { 
  font-weight: 600; 
  font-size: 1.05em;
  display: block;
  color: #222;
  line-height: 1.4;
}

.aric-event-icon {
  display: inline-block;
  margin-right: 4px;
  font-size: 1.1em;
  vertical-align: middle;
}

/* --- Calendar Styles --- */
.aric-cal-event { 
  line-height: 1.2;
  padding: 2px 4px;
}

.aric-cal-time { 
  font-weight: 700; 
  white-space: nowrap;
  font-size: 0.85em;
}

.aric-cal-title { 
  display: block; 
  white-space: normal; 
  overflow-wrap: anywhere; 
  word-break: break-word;
  font-size: 0.9em;
  margin-top: 2px;
}

/* FullCalendar event wrapping fixes */
.fc .fc-daygrid-event,
.fc .fc-daygrid-event .fc-event-main,
.fc .fc-daygrid-event .fc-event-main-frame {
  overflow: hidden !important;
  white-space: normal !important;
  max-width: 100% !important;
}

.fc .aric-cal-event { 
  max-width: 100%; 
  overflow: hidden; 
}

.fc .aric-cal-title { 
  overflow: hidden; 
}

/* --- Modal Styles --- */
.aric-modal { 
  position: fixed; 
  inset: 0; 
  display: none; 
  z-index: 99999; 
}

.aric-modal.is-open { 
  display: block; 
}

.aric-modal__overlay { 
  position: absolute; 
  inset: 0; 
  background: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.aric-modal__panel {
  position: absolute; 
  left: 50%; 
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translate(-50%, -45%);
  }
  to { 
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.aric-modal__close { 
  position: absolute; 
  right: 16px; 
  top: 16px; 
  font-size: 28px; 
  background: transparent; 
  border: 0; 
  cursor: pointer; 
  line-height: 1;
  color: #666;
  transition: color 0.2s ease;
}

.aric-modal__close:hover {
  color: #f36c21;
}

.aric-modal__title { 
  margin: 0 40px 12px 0;
  font-size: 1.5em;
  color: #222;
}

.aric-modal__meta { 
  font-size: 0.95em; 
  color: #666;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

body.aric-modal-open { 
  overflow: hidden; 
}

/* FullCalendar spillover fixes */
.fc .fc-daygrid-day-frame,
.fc .fc-daygrid-day-events,
.fc .fc-daygrid-day,
.fc .fc-scrollgrid-section-body td {
  overflow: hidden !important;
}

.fc .fc-daygrid-event-harness,
.fc .fc-daygrid-event {
  max-width: 100% !important;
  overflow: hidden !important;
}

.fc .fc-daygrid-event .fc-event-main,
.fc .fc-daygrid-event .fc-event-main-frame,
.fc .fc-daygrid-event .fc-event-title-container {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.fc .fc-daygrid-event .fc-event-title,
.fc .fc-event-title {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

/* --- Enhanced Filter Bar --- */
.aric-filterbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  flex-wrap: wrap;
  padding: 16px;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  transition: all 0.3s ease;
}

.aric-filterbar__label {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  white-space: nowrap;
}

.aric-filterbar__select {
  min-width: 280px;
  max-width: 100%;
  height: 44px;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.3;
  border: 2px solid #ddd;
  border-radius: 6px;
  background-color: #fff;
  transition: all 0.2s ease;
  cursor: pointer;
}

.aric-filterbar__select:hover {
  border-color: #f36c21;
}

.aric-filterbar__select:focus {
  outline: none;
  border-color: #f36c21;
  box-shadow: 0 0 0 3px rgba(243, 108, 33, 0.12);
}

/* Active filter state - NO "(Active)" text, just visual cues */
.aric-filterbar.is-filtered {
  background: #fff5f0;
  border-color: #f36c21;
}

.aric-filterbar.is-filtered .aric-filterbar__select {
  border-color: #f36c21;
  border-width: 2px;
  background-color: #fff;
  font-weight: 600;
}

/* Event count display */
.aric-event-count {
  font-size: 14px;
  color: #333; /* Changed to black for better readability */
  font-weight: 600;
  margin-left: auto;
  padding: 6px 12px;
  background: #fff;
  border-radius: 4px;
  border: 1px solid #e5e5e5;
}

.aric-filterbar.is-filtered .aric-event-count {
  color: #333; /* Keep black even when filtered */
  font-weight: 700;
  border-color: #f36c21;
  background: #fff;
}

/* Screen reader only */
.aric-sr-live {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Filter inside FullCalendar header */
.aric-calendar .fc-header-toolbar .aric-fc-midchunk {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.aric-calendar .fc-header-toolbar .aric-fc-midchunk .aric-filterbar {
  margin: 8px 0;
}

.aric-calendar .fc-header-toolbar .aric-fc-midchunk .aric-filterbar__label {
  margin: 0;
}

/* --- Mobile Optimizations --- */
@media (max-width: 768px) {
  .aric-filterbar {
    padding: 12px;
    margin-bottom: 16px;
  }

  .aric-filterbar__select {
    min-width: 100%;
    width: 100%;
  }

  .aric-event-count {
    width: 100%;
    text-align: center;
    margin-left: 0;
    margin-top: 8px;
  }

  .aric-list__link {
    padding: 16px;
  }

  .aric-list__link:hover {
    padding-left: 16px;
    border-left-width: 2px; /* Keep border consistent on mobile */
    transform: none; /* Disable lift on mobile for better touch */
  }

  .aric-modal__panel {
    padding: 20px;
    border-radius: 8px;
  }

  .aric-list__title {
    font-size: 1em;
  }

  .aric-list__group-label {
    font-size: 1em;
    padding: 8px 10px;
  }
}

@media (max-width: 520px) {
  .aric-filterbar__select {
    font-size: 14px;
    height: 42px;
  }

  .aric-event-icon {
    font-size: 1em;
  }
}

/* --- Accessibility Enhancements --- */
@media (prefers-reduced-motion: reduce) {
  .aric-list__item,
  .aric-list__link,
  .aric-filterbar,
  .aric-modal__overlay,
  .aric-modal__panel {
    transition: none !important;
    animation: none !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .aric-list__link {
    border-width: 3px;
  }
  
  .aric-filterbar {
    border-width: 2px;
  }
}

/* Focus visible for keyboard navigation */
.aric-list__link:focus-visible {
  outline: 3px solid #f36c21;
  outline-offset: 2px;
}

.aric-filterbar__select:focus-visible {
  outline: 3px solid #f36c21;
  outline-offset: 2px;
}

/* --- Print Styles --- */
@media print {
  .aric-filterbar {
    display: none;
  }
  
  .aric-list__link {
    border: 1px solid #000;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  
  .aric-modal {
    display: none !important;
  }
}
