/**
 * @file
 * Tournament Schedule Grid styles for public views.
 *
 * Tournament schedules differ from season schedules:
 * - Single day with multiple time slots (rows) vs weeks (columns)
 * - Multiple fields running in parallel (columns)
 * - Lunch break between morning and afternoon
 */

/* ============================================
   TOURNAMENT TABS (Pill Style)
   ============================================ */

.tournament-schedule-tabs,
.tournament-teams-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-bottom: 1.5em;
  padding: 0.5em 0;
}

.tournament-tab {
  display: inline-block;
  padding: 0.6em 1.5em;
  border: 2px solid var(--color-primary);
  border-radius: 25px;
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  font-size: 0.95em;
  transition: all 0.2s ease;
  color: var(--color-primary);
  background: var(--color-white);
}

.tournament-tab:hover {
  background: var(--color-gray-150);
  color: var(--color-primary);
}

.tournament-tab.active {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

.tournament-tab.active:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: var(--color-white);
}

/* ============================================
   TOURNAMENT SCHEDULE HEADER
   ============================================ */

/* Keep gradient as-is - contains primary colors in gradient form */
.tournament-schedule-header {
  text-align: center;
  margin-bottom: 1.5em;
  padding: 1em;
  background: linear-gradient(135deg, #8B0000 0%, #6B0000 100%);
  border-radius: var(--radius-xl);
  color: var(--color-white);
}

.tournament-schedule-header .tournament-name {
  margin: 0 0 0.25em 0;
  font-size: 1.5em;
  font-weight: var(--font-weight-bold);
}

.tournament-schedule-header .tournament-date {
  font-size: 1em;
  opacity: 0.9;
}

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

.tournament-schedule-grid {
  margin: 1em 0;
}

.tournament-schedule-grid .grid-scroll-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
}

.tournament-schedule-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  table-layout: fixed;
}

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

/* ============================================
   TABLE HEADER - Time + Fields
   ============================================ */

.tournament-schedule-table thead {
  /* Header row */
}

.tournament-schedule-table .field-header-row th {
  background: var(--color-gray-800);
  color: var(--color-white);
  font-weight: var(--font-weight-semibold);
  font-size: 0.95em;
  padding: 0.75em 0.5em;
  text-align: center;
  vertical-align: middle;
}

.tournament-schedule-table .time-header-cell {
  background: var(--color-primary);
  width: 90px;
  min-width: 90px;
}

.tournament-schedule-table .field-header-cell {
  min-width: 140px;
}

/* ============================================
   TIME COLUMN (Left Side)
   ============================================ */

.tournament-schedule-table .time-cell {
  background: var(--color-gray-700);
  color: var(--color-white);
  font-weight: var(--font-weight-semibold);
  font-size: 0.9em;
  padding: 0.5em;
  text-align: center;
  vertical-align: middle;
  width: 90px;
  min-width: 90px;
  border-right: 2px solid var(--color-gray-800);
}

.time-display {
  white-space: nowrap;
}

/* ============================================
   GAME CELLS - Home & Away Teams
   ============================================ */

.tournament-schedule-table .game-row {
  /* Row styling */
}

.tournament-schedule-table .game-cell {
  padding: 0;
  text-align: center;
  vertical-align: middle;
  height: 28px;
  min-width: 140px;
}

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

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

/* Empty cells */
.tournament-schedule-table .game-cell.empty-cell {
  background: var(--color-gray-100);
}

.tournament-schedule-table .game-cell.empty-cell.home-team {
  background: var(--color-home-empty);
}

.tournament-schedule-table .game-cell.empty-cell.away-team {
  background: #f8f8f8; /* Keep unique color */
}

/* No game for this slot */
.tournament-schedule-table .game-cell.no-game-cell {
  background: var(--color-gray-200);
}

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

.tournament-schedule-table .team-name {
  display: block;
  font-size: 0.85em;
  font-weight: var(--font-weight-medium);
  padding: 0.4em 0.5em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
}

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

/* User team highlighting */
.tournament-schedule-table .game-cell.user-team-highlight {
  /* Subtle highlight for user's team cell */
}

.tournament-schedule-table .game-cell.user-team-highlight.home-team {
  background: #ffe5e5;
}

.tournament-schedule-table .game-cell.user-team-highlight.away-team {
  background: #fff8f8;
}

/* User team icon (soccer ball) */
.tournament-schedule-table .user-team-icon {
  font-size: 0.8em;
  margin-right: 3px;
}

/* Opponent team styling (in my schedule mode) */
.tournament-schedule-table .game-cell.opponent-cell .team-name {
  color: var(--color-text-muted);
}

/* ============================================
   LUNCH BREAK ROW
   ============================================ */

.tournament-schedule-table .lunch-break-row {
  /* Full-width lunch break */
}

/* Keep gradient as-is - unique to lunch break styling */
.tournament-schedule-table .lunch-break-cell {
  background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
  font-size: 1em;
  padding: 0.75em 1em;
  text-align: center;
  border: none;
}

.lunch-icon {
  font-size: 1.2em;
  margin-right: 0.25em;
}

.lunch-text {
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

.tournament-schedule-table .slot-spacer {
  height: 4px;
}

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

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

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

.tournament-schedule-table .cancelled-game-cell .team-name {
  opacity: 0.5;
}

.tournament-schedule-table .cancelled-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  background: rgba(220, 53, 69, 0.85);
  color: white;
  font-size: 0.7em;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.2em 0.5em;
  border-radius: 3px;
  white-space: nowrap;
}

.tournament-schedule-table .cancelled-away-cell {
  background: var(--color-gray-150);
}

/* ============================================
   TOURNAMENT TEAMS GRID
   ============================================ */

.tournament-teams-grid {
  /* Inherits from .teams-grid in content-pages.css */
}

/* Team captain display */
.tournament-teams-grid .team-captain {
  padding: 0.4em 0.8em;
  background: #f0f0f0; /* Keep unique color */
  border-bottom: 1px solid var(--color-gray-250);
  font-size: 0.85em;
  color: var(--color-text-muted);
  font-style: italic;
}

.tournament-teams-grid .team-card.user-team .team-captain {
  background: rgba(139, 0, 0, 0.1);
  border-bottom-color: rgba(139, 0, 0, 0.2);
  color: var(--color-primary);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.tournament-schedule-empty {
  text-align: center;
  padding: 2em;
  margin: 1em 0;
  background: var(--color-gray-100);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  color: var(--color-text-muted);
}

.tournament-schedule-empty p {
  margin: 0;
  font-size: 1.1em;
}

/* ============================================
   RESPONSIVE - TABLET
   ============================================ */

@media (max-width: 992px) {
  .tournament-schedule-table .field-header-cell {
    min-width: 120px;
  }
  
  .tournament-schedule-table .game-cell {
    min-width: 120px;
  }
  
  .tournament-schedule-table .team-name {
    font-size: 0.8em;
    padding: 0.35em 0.4em;
  }
}

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

@media (max-width: 768px) {
  .tournament-schedule-header {
    padding: 0.75em;
  }

  .tournament-schedule-header .tournament-name {
    font-size: 1.2em;
  }

  .tournament-schedule-header .tournament-date {
    font-size: 0.9em;
  }

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

  .tournament-schedule-table .time-cell {
    width: 70px;
    min-width: 70px;
    font-size: 0.8em;
    padding: 0.4em;
  }

  .tournament-schedule-table .time-header-cell {
    width: 70px;
    min-width: 70px;
  }

  .tournament-schedule-table .field-header-cell {
    min-width: 100px;
    font-size: 0.85em;
    padding: 0.5em 0.3em;
  }

  .tournament-schedule-table .game-cell {
    min-width: 100px;
    height: 24px;
  }

  .tournament-schedule-table .team-name {
    font-size: 0.75em;
    padding: 0.3em;
  }

  .tournament-schedule-table .lunch-break-cell {
    padding: 0.5em;
    font-size: 0.9em;
  }

  .tournament-schedule-table .cancelled-badge {
    font-size: 0.6em;
    padding: 0.15em 0.4em;
  }

  /* Horizontal scroll tabs on mobile */
  .tournament-schedule-tabs,
  .tournament-teams-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
  }

  .tournament-schedule-tabs::-webkit-scrollbar,
  .tournament-teams-tabs::-webkit-scrollbar {
    display: none;
  }

  .tournament-tab {
    padding: 0.5em 1em;
    font-size: 0.85em;
    flex-shrink: 0;
  }
}

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

@media (max-width: 480px) {
  .tournament-schedule-table .time-cell {
    width: 60px;
    min-width: 60px;
    font-size: 0.7em;
  }
  
  .tournament-schedule-table .time-header-cell {
    width: 60px;
    min-width: 60px;
  }
  
  .tournament-schedule-table .field-header-cell {
    min-width: 85px;
    font-size: 0.75em;
  }
  
  .tournament-schedule-table .game-cell {
    min-width: 85px;
  }
  
  .tournament-schedule-table .team-name {
    font-size: 0.65em;
    padding: 0.25em;
  }
  
  .tournament-schedule-header .tournament-name {
    font-size: 1em;
  }
}
