/**
 * @file
 * Shared Schedule Grid styles for admin and public views.
 */

/* ============================================
   WEEK NAVIGATION - TOP BAR
   ============================================ */

.week-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--color-gray-200);
  border-radius: var(--radius-md);
}

.nav-btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  background: var(--color-primary);
  color: var(--color-white) !important;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none !important;
  font-weight: var(--font-weight-medium);
}

.nav-btn:hover {
  background: var(--color-primary-dark);
  color: var(--color-white) !important;
  text-decoration: none !important;
}

.nav-btn.disabled {
  background: var(--color-text-muted);
  cursor: not-allowed;
  opacity: 0.65;
}

.week-label {
  font-weight: var(--font-weight-semibold);
  min-width: 150px;
  text-align: center;
}

/* ============================================
   FLOATING NAVIGATION ARROWS
   ============================================ */

.schedule-grid-wrapper {
  position: relative;
}

.floating-nav {
  display: block; /* Always visible */
}

.floating-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 64px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--color-white);
  border: none;
  cursor: pointer;
  font-size: 1.75rem;
  font-weight: var(--font-weight-bold);
  z-index: var(--z-floating-nav);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-base),
              opacity var(--transition-base),
              transform var(--transition-base);
  -webkit-tap-highlight-color: transparent;
}

.floating-nav-btn:hover {
  background: rgba(0, 0, 0, 0.75);
}

.floating-nav-btn:active {
  background: rgba(0, 0, 0, 0.85);
  transform: translateY(-50%) scale(0.95);
}

.floating-nav-btn.disabled {
  opacity: 0.2;
  cursor: not-allowed;
  pointer-events: none;
}

/* Fade out when not near schedule */
.floating-nav-btn.nav-hidden {
  opacity: 0;
  pointer-events: none;
}

.floating-nav-btn.prev {
  left: 0;
  border-radius: 0 var(--radius-2xl) var(--radius-2xl) 0;
}

.floating-nav-btn.next {
  right: 0;
  border-radius: var(--radius-2xl) 0 0 var(--radius-2xl);
}

/* Arrow characters */
.floating-nav-btn .arrow {
  line-height: 1;
}

/* ============================================
   SCHEDULE GRID CONTAINER
   ============================================ */

.schedule-grid {
  margin-top: 1rem;
}

.grid-scroll-container {
  overflow-x: hidden;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-md);
}

.schedule-table {
  width: auto;
  border-collapse: collapse;
  background: var(--color-white);
  table-layout: fixed;
}

.schedule-table th,
.schedule-table td {
  border: 1px solid var(--color-gray-250);
}

/* ============================================
   TIME/DATE HEADER ROW
   ============================================ */

.schedule-table .time-date-row {
  /* Row containing time + dates */
}

.schedule-table .time-header-cell {
  background: var(--color-primary);
  color: var(--color-white);
  font-weight: var(--font-weight-bold);
  font-size: 0.95rem;
  padding: 0.5rem;
  text-align: center;
  min-width: 80px;
  width: 80px;
  border-right: 2px solid var(--color-primary-dark);
}

.schedule-table .date-header-cell {
  background: var(--color-gray-800);
  color: var(--color-white);
  padding: 0.5rem;
  font-weight: var(--font-weight-bold);
  text-align: center;
  vertical-align: middle;
  min-width: 110px;
  border-left: 2px solid var(--color-gray-700);
  border-right: 2px solid var(--color-gray-700);
}

.schedule-table .date-header-cell.bye-week-header,
.schedule-table .date-header-cell.future-week-header {
  background: var(--color-gray-600);
  color: var(--color-white);
}

.week-date {
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  font-size: 0.9rem;
}

/* ============================================
   LEFT COLUMN - FIELD LABELS
   ============================================ */

.schedule-table .field-label-cell {
  background: var(--color-success);
  padding: 0;
  vertical-align: middle;
  text-align: center;
  min-width: 80px;
  width: 80px;
  border-right: 2px solid var(--color-success-darker);
}

.schedule-table .field-label-cell .field-label {
  color: var(--color-white);
  font-weight: var(--font-weight-semibold);
  font-size: 0.85rem;
  padding: 0.5rem;
}

/* ============================================
   GAME CELLS - HOME & AWAY TEAMS
   ============================================ */

.schedule-table .game-row {
  /* No special row styling needed */
}

.schedule-table .game-cell {
  padding: 0;
  text-align: center;
  vertical-align: middle;
  height: 26px;
  border-left: 3px solid var(--color-white);
  border-right: 3px solid var(--color-white);
}

/* Home team cells - red/pink background */
.schedule-table .game-cell.home-team {
  background: var(--color-home-bg);
  border-bottom: 1px solid #e8c4c4;
}

/* Away team cells - white background */
.schedule-table .game-cell.away-team {
  background: var(--color-white);
  border-bottom: 2px solid var(--color-gray-250);
}

/* Empty cells - maintain background colors */
.schedule-table .game-cell.empty-cell.home-team {
  background: #fce4e4;
}

.schedule-table .game-cell.empty-cell.away-team {
  background: #f8f8f8;
}

/* Bye week / Future week cells */
.schedule-table .game-cell.bye-week-cell,
.schedule-table .game-cell.future-week-cell {
  background: var(--color-gray-200);
  vertical-align: middle;
}

.no-games-text {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

/* ============================================
   TEAM NAMES
   ============================================ */

.team-name {
  display: block;
  font-size: 0.95rem;
  font-weight: var(--font-weight-semibold);
  padding: 0.35rem 0.5rem;
  transition: background-color var(--transition-fast);
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-name.unknown-team {
  color: var(--color-danger);
  font-style: italic;
}

.team-name.empty-team {
  color: var(--color-gray-500);
}

/* User team icon (soccer ball) */
.user-team-icon {
  font-size: 0.75rem;
  margin-right: 2px;
}

/* Opponent team styling (My Schedule only).
   My Schedule shows both teams in the user's own games; the opponent is muted
   so the user's team — marked with the soccer ball — reads as the subject of
   the row. Mirrors the equivalent rule in tournament-schedule-grid.css. */
.game-cell.opponent-cell .team-name {
  color: var(--color-text-muted, #6c757d);
  font-weight: var(--font-weight-normal, 400);
}

/* ============================================
   TIME SLOT SPACER
   ============================================ */

.slot-spacer {
  height: 4px;
}

.slot-spacer td {
  background: var(--color-gray-800) !important;
  border: none !important;
  padding: 0;
  height: 4px;
}

/* ============================================
   CANCELLED GAME CELLS
   ============================================ */

.schedule-table .cancelled-game-cell {
  position: relative;
  background: var(--color-home-bg);
  vertical-align: middle;
}

/* Container for team names (shown faded behind overlay) */
.cancelled-teams {
  opacity: 0.4;
  padding: 0.25rem 0.5rem;
}

.cancelled-home-team,
.cancelled-away-team {
  font-size: 0.85rem;
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.15rem 0;
}

.cancelled-home-team {
  /* Home team styling - top of cell */
}

.cancelled-away-team {
  /* Away team styling - bottom of cell */
}

/* Semi-transparent overlay */
.cancelled-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(220, 53, 69, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}

.cancelled-text {
  color: var(--color-white);
  font-weight: 900;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  transform: rotate(-25deg);
  white-space: nowrap;
}

/* ============================================
   SMOOTH COLUMN TRANSITIONS (Phase 2)
   ============================================ */

.schedule-table .date-header-cell,
.schedule-table .game-cell {
  transition: opacity var(--transition-fast);
}

/* Column fade-out/in during navigation */
.schedule-table .date-header-cell.column-transitioning,
.schedule-table .game-cell.column-transitioning {
  opacity: 0;
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
  /* Simplify top navigation on mobile */
  .week-navigation {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .week-navigation .nav-btn {
    display: none; /* Hide top buttons on mobile - use floating instead */
  }

  .week-navigation .week-label {
    font-size: 1.1rem;
  }

  /* Sticky field label column on mobile */
  .schedule-table .field-label-cell,
  .schedule-table .time-header-cell {
    position: sticky;
    left: 0;
    z-index: 5;
  }

  /*
   * Mobile schedule: switch from fixed to auto table layout so that
   * hidden columns (display:none) don't affect width calculations.
   * The visible game columns expand to fill the screen naturally.
   */

  .schedule-table {
    table-layout: auto;
    width: 100%;
  }

  /* Left column: wider for readability */
  .schedule-table .time-header-cell {
    font-size: 0.85rem;
    font-weight: var(--font-weight-bold);
    padding: 0.4rem;
    width: 80px;
    min-width: 80px;
    white-space: nowrap;
  }

  .schedule-table .field-label-cell {
    width: 80px;
    min-width: 80px;
  }

  .schedule-table .field-label-cell .field-label {
    font-size: 0.85rem;
    font-weight: var(--font-weight-bold);
    padding: 0.4rem;
    white-space: nowrap;
  }

  /* Game columns: take all remaining space, large readable text */
  .schedule-table .date-header-cell {
    min-width: 0;
    font-size: 1rem;
    padding: 0.5rem;
  }

  .week-date {
    font-size: 1rem;
  }

  /* Large, bold team names */
  .team-name {
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    padding: 0.4rem 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Taller game cells */
  .schedule-table .game-cell {
    height: 34px;
  }

  .cancelled-text {
    font-size: 0.9rem;
    letter-spacing: 0.5px;
  }

  .cancelled-home-team,
  .cancelled-away-team {
    font-size: 0.9rem;
  }

  /* Larger floating nav touch targets on mobile */
  .floating-nav-btn {
    width: 52px;
    height: 72px;
    font-size: 2rem;
  }
}
