/* Mobile optimizations */
@media (max-width: 768px) {

  /* Body and container adjustments */
  body {
    padding: 10px;
  }

  .container {
    margin: 0;
    border-radius: 0;
  }

  /* Header optimizations */
  .header {
    padding: 0.5rem 0 1rem;
  }

  .header h1 {
    font-size: 1.2rem;
  }

  .header p {
    font-size: 0.9rem;
  }

  .header-content {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
  }

  .header-text img {
    height: 35px !important;
    margin-bottom: 0.5rem;
  }

  /* Navigation buttons */
  .return-button {
    position: absolute;
    top: 0;
    left: 0.5rem;
  }

  .return-text {
    display: none;
  }

  .return-link {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  .language-switcher {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
  }

  .lang-btn {
    font-size: 0.8rem;
  }

  /* Calendar container */
  .calendar-container {
    padding: 1rem;
  }

  .calendar-header {
    justify-content: center;
  }

  .calendar-header-intro p {
    text-align: center;
    font-size: 0.75rem;
  }

  .legend-item {
    font-size: 0.8rem;
  }

  /* FullCalendar mobile optimizations */
  .fc-toolbar {
    display: grid !important;
    grid-template-rows: auto auto !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
  }

  .fc-toolbar-chunk {
    justify-content: center !important;
  }

  /* First row: title only - full width */
  .fc-toolbar-chunk:nth-child(2) {
    grid-row: 1;
    grid-column: 1 / -1;
    width: 100%;
  }

  /* Second row: arrow buttons - first column */
  .fc-toolbar-chunk:first-child {
    grid-row: 2;
    grid-column: 1;
    justify-content: flex-start !important;
  }

  /* Second row: view buttons - second column */
  .fc-toolbar-chunk:last-child {
    grid-row: 2;
    grid-column: 2;
    justify-content: flex-end !important;
  }

  .fc-toolbar h2 {
    font-size: 1.5rem !important;
    text-align: center;
    margin: 0;
    font-weight: 600;
  }

  .fc-button-group {
    font-size: 0.7rem;
    gap: 0.2rem;
  }

  .fc-button-primary {
    padding: 0.3rem 0.5rem !important;
    font-size: 0.7rem !important;
    min-width: auto;
  }

  /* Time grid mobile optimizations */
  .fc-timegrid-axis {
    width: 40px;
  }

  .fc-timegrid-slot-label {
    font-size: 0.7rem;
  }

  .fc-timegrid-event .fc-event-time,
  .fc-timegrid-event .fc-event-title {
    font-size: 0.7rem;
    line-height: 1.1;
  }

  .fc-timegrid-event {
    margin: 1px 0;
    min-height: 20px;
  }

  /* Modal mobile optimizations */
  .modal-dialog {
    width: 95%;
    max-width: none;
    max-height: 85vh;
    margin: 1rem;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-title {
    font-size: 1.2rem;
  }

  .modal-body {
    padding: 1rem;
    max-height: 50vh;
  }

  .event-detail {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .event-detail-label {
    font-size: 0.8rem;
  }

  .event-detail-value {
    font-size: 0.9rem;
  }

  .modal-footer {
    padding: 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    justify-content: center;
  }

  /* Calendar height adjustment for mobile */
  .fc {
    height: calc(100vh - 200px) !important;
    overflow-y: auto !important;
  }

  /* Ensure calendar container allows scrolling */
  .calendar-container {
    height: calc(100vh - 200px);
    overflow: hidden;
  }

  /* Hide week numbers on mobile for more space */
  .fc-daygrid-week-number {
    display: none !important;
  }

  /* Improve event readability on mobile */
  .fc-event {
    border-radius: 2px !important;
    margin: 1px 0 !important;
  }

  /* Better touch targets */
  .fc-button {
    min-height: 36px;
    min-width: 36px;
  }

  /* Mobile scrolling optimizations */
  .fc-scroller {
    -webkit-overflow-scrolling: touch;
  }

  /* Ensure proper mobile viewport */
  body {
    overflow-x: hidden;
  }
}

/* Tablet adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
  .container {
    margin: 0 10px;
  }

  .calendar-container {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
  }
}

/* Large screen optimizations */
@media (min-width: 1200px) {
  .container {
    max-width: 1400px;
  }

  .calendar-container {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
  }
}