/* =======================================
   MOBILE CALENDAR - MODERN STYLES
========================================== */

@media screen and (max-width: 768px) {
    .calendar {
      display: none;
    }
    
    .calendar-mobile {
      display: block;
    }
    
    .day-container {
    background: white;
    border-radius: var(--radius-md, 10px);
    margin-bottom: var(--space-md, 16px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
      overflow: hidden;
    border: 1px solid #e5e7eb;
    }
    
    .day-header {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: white;
    padding: var(--space-sm, 10px) var(--space-md, 16px);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    }
    
    .day-content {
    padding: var(--space-sm, 10px);
    background: #fafafa;
    }
  
  /* Expanded View - All days visible */
  .calendar-mobile.expanded-view .day-content {
    display: block !important;
  }
  
  /* Collapsed View - Click to expand */
  .calendar-mobile.collapsed-view .day-header {
    cursor: pointer;
    transition: background 0.25s ease;
  }
  
  .calendar-mobile.collapsed-view .day-header:hover {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
  }
  
  .calendar-mobile.collapsed-view .day-header::after {
    content: "▼";
    font-size: 0.7rem;
    opacity: 0.7;
    transition: transform 0.25s ease;
  }
  
  .calendar-mobile.collapsed-view .day-container.open .day-header::after {
    transform: rotate(180deg);
  }
  
  .calendar-mobile.collapsed-view .day-content {
    display: none;
  }
  
  .calendar-mobile.collapsed-view .day-container.open .day-content {
    display: block;
  }

  .shift-summary {
    margin-bottom: var(--space-sm, 8px);
    border-radius: var(--radius-md, 10px);
    overflow: hidden;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
  
    .shift-type {
    font-weight: 700;
    padding: var(--space-sm, 10px) var(--space-md, 14px);
    text-align: center;
    font-size: 0.9rem;
    color: var(--gray-800, #1f2937);
  }

  .volunteers-list {
    padding: var(--space-xs, 6px) var(--space-sm, 8px);
    font-size: 0.8rem;
    }
  
    .volunteers-list ul {
      list-style-type: none;
    padding: 0;
    margin: 0;
    }
  
    .volunteers-list li {
    padding: 2px 0;
    font-size: 0.8rem;
    }
  
  .weekdays,
   .weekdays_stage_b {
    display: none;
    }
  
    .day-summary {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
  }
  
  .day-summary.mismatch {
    color: #fca5a5;
    font-weight: 600;
    }
  
    .button {
    font-size: 0.8rem;
    padding: 6px 12px;
    }
  
    .shift-legend {
    font-size: 0.75rem;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
  }
  
  .shift-legend .shift-label {
    padding: 4px 8px;
    font-size: 0.7rem;
    }
  
    .calendar-mobile .shift-type a {
      display: block;
    padding: var(--space-sm, 10px);
      color: inherit;
      text-decoration: none;
    border-radius: var(--radius-sm, 6px);
    transition: all 0.2s ease;
    }
  
    .calendar-mobile .shift-type a:hover,
    .calendar-mobile .shift-type a:active {
    opacity: 0.9;
    }
  
  /* Unit Colors for Mobile - Clean single color approach */
  .shift-summary.unit-1,
  .shift-summary.unit-2,
  .shift-summary.unit-3 {
    border: none;
    background: transparent;
    }
  
  .shift-type.unit-1 {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    border-radius: var(--radius-sm, 6px);
  }
  
  .shift-type.unit-2 {
    background: linear-gradient(135deg, #ddd6fe 0%, #c4b5fd 100%);
    border-radius: var(--radius-sm, 6px);
  }
  
  .shift-type.unit-3 {
    background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
    border-radius: var(--radius-sm, 6px);
    }
  
  /* Ensure links inside shift-type inherit background */
  .calendar-mobile .shift-type a {
    background: transparent !important;
    }
  
  /* Buttons layout on mobile - keep in rows */
  .view-toggle {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
  }
  
  .view-toggle .button {
    flex: 1;
    max-width: 50%;
    padding: 10px 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    }
    
  .period-navigation {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
  }
  
  /* First row: prev/next buttons side by side */
  .period-navigation > a:nth-child(1),
  .period-navigation > a:nth-child(2) {
    flex: 1;
    max-width: 45%;
    padding: 10px 8px;
    font-size: 0.8rem;
    }
  
  /* Second row: current week button centered */
  .period-navigation > a:nth-child(3),
  .period-navigation > #currentWeekBtn {
    width: auto;
    padding: 10px 16px;
    font-size: 0.8rem;
  }
  
  .admin-controls {
    flex-wrap: wrap;
    gap: 6px;
  }
  
  /* Hide some less important mobile elements for cleaner view */
  .calendar-mobile .volunteers-list span[style*="underline"] {
    font-size: 0.75rem;
  }
  }
  
  @media screen and (min-width: 769px) {
    .calendar-mobile {
    display: none !important;
    }
  }

/* Force Desktop View on Mobile */
.force-desktop {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.force-desktop .calendar {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  font-size: 0.75rem;
  min-width: max-content;
}

.force-desktop .calendar-mobile {
  display: none !important;
}

.force-desktop .calendar-day {
  min-width: 140px;
  padding: 6px;
}

.force-desktop .shift-type {
  font-size: 0.7rem;
  padding: 4px;
}

.force-desktop .volunteers-list {
  font-size: 0.7rem;
}

.force-desktop .volunteers-list li {
  white-space: nowrap;
}

.force-desktop .volunteer-name {
  white-space: nowrap;
}

.force-desktop .smaller-text {
  font-size: 0.6rem;
  white-space: nowrap;
}

.force-desktop .unit-badge {
  font-size: 0.55rem;
  padding: 1px 4px;
}

/* Week Summary Table */
.week-summary {
  background: white;
  border-radius: var(--radius-md, 10px);
  padding: var(--space-lg, 24px);
  margin-top: var(--space-lg, 24px);
  overflow-x: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
  
  .week-summary-table {
    width: 100%;
    border-collapse: collapse;
  font-size: 0.9rem;
  }
  
  .week-summary-table th,
  .week-summary-table td {
  border: 1px solid #e5e7eb;
  padding: var(--space-md, 16px);
    text-align: center;
  }
  
  .week-summary-table th {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  color: white;
  font-weight: 600;
  }
  
  .week-summary-table tr:nth-child(even) {
  background-color: #f9fafb;
  }
  
  .week-summary-table tr:last-child {
  font-weight: 700;
  background-color: #f3f4f6;
  }
  
  @media screen and (max-width: 768px) {
    .week-summary-table {
    font-size: 0.8rem;
    }
  
    .week-summary-table th,
    .week-summary-table td {
    padding: 8px;
    }
  }

/* Stage B Pair Styling */
  .stage-b-pair {
  border: 1px solid #e5e7eb;
  padding: var(--space-sm, 8px);
  margin-bottom: var(--space-sm, 8px);
  border-radius: var(--radius-sm, 6px);
  background-color: #f0f9ff;
}

/* Mobile Days Grid */
  @media (max-width: 768px) {
  .days-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
  }

  .day-cell {
    width: auto;
    min-width: unset;
    max-width: unset;
    padding: 8px;
    min-height: 140px;
  }
}
