/* PrimeSport Matches - Frontend Styles */

/* Page spacing - remove margin to header */
.ps-wrap {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Tournament blocks spacing */
.ps-tournament {
  margin-bottom: 32px !important;
}

.ps-tournament:last-child {
  margin-bottom: 0 !important;
}

.ps-tournamentTitle {
  margin-bottom: 16px !important;
}

/* Match card design - blue shadow from logo */
.ps-match.ps-card {
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.15), 0 0 3px rgba(0, 123, 255, 0.1) !important;
  transition: box-shadow 0.3s ease !important;
}

.ps-match.ps-card:hover {
  box-shadow: 0 0 12px rgba(0, 123, 255, 0.2), 0 0 6px rgba(0, 123, 255, 0.15) !important;
}

.ps-headerRow {
  margin-bottom: 24px; /* Reasonable spacing */
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.ps-pageTitle {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Date carousel styling */
.ps-dateCarousel {
  display: flex;
  align-items: stretch; /* Stretch arrows to match card height */
  justify-content: center;
  gap: 8px; /* Consistent 8px gap between all elements */
  margin: 24px auto;
  position: relative;
  max-width: 1200px;
  padding: 0 20px;
  z-index: 1; /* Ensure carousel is above other content */
}

.ps-dateCarousel * {
  position: relative;
  z-index: inherit;
}

.ps-dateCarouselContainer {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  flex: 0 0 auto; /* Don't grow or shrink - exact content size */
  justify-content: flex-start; /* Start from left, no centering that creates internal space */
  margin: 0 !important; /* No margin - gap is handled by parent */
  padding: 0 !important; /* No padding */
  box-sizing: border-box;
  min-width: 0; /* Allow flex item to shrink below content size */
  width: fit-content; /* Only as wide as content */
  max-width: 100%; /* But don't exceed parent */
}

/* Remove all margins - gap property handles spacing */
#psDateCarouselPrev,
.ps-dateCarousel .ps-dateCarouselArrow:first-child,
.ps-dateCarousel > .ps-dateCarouselArrow:first-child {
  margin: 0 !important;
}

#psDateCarouselContainer,
.ps-dateCarousel .ps-dateCarouselContainer,
.ps-dateCarousel > .ps-dateCarouselContainer {
  margin: 0 !important; /* No margin at all */
  padding: 0 !important; /* No padding */
  border: none !important; /* No border */
}

#psDateCarouselNext,
.ps-dateCarousel .ps-dateCarouselArrow:last-of-type,
.ps-dateCarousel > .ps-dateCarouselArrow:last-of-type {
  margin: 0 !important;
}

.ps-datePickerWrapper {
  margin: 0 !important; /* No margin - gap handles spacing */
}

.ps-dateCarouselContainer::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.ps-dateCarouselArrow {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer !important;
  transition: all 0.2s ease;
  flex-shrink: 0;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  pointer-events: auto !important;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  touch-action: manipulation;
  box-sizing: border-box;
  z-index: 1000;
  opacity: 1 !important;
}

/* Ensure enabled arrows always show pointer cursor and are clickable */
.ps-dateCarouselArrow:not(:disabled):not(.ps-arrow-disabled),
.ps-dateCarouselArrow:not([disabled]):not(.ps-arrow-disabled) {
  pointer-events: auto !important;
  cursor: pointer !important;
  opacity: 1 !important;
}

.ps-dateCarouselArrow:hover:not(:disabled) {
  background: rgba(0, 123, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.ps-dateCarouselArrow:disabled {
  opacity: 0.3;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.ps-dateCarouselArrow.ps-arrow-disabled {
  opacity: 0.3;
  /* Keep pointer cursor even when visually disabled - still clickable */
  cursor: pointer !important;
  pointer-events: auto !important;
}

.ps-dateCarouselArrow:disabled {
  pointer-events: none !important; /* Only disable if actually disabled attribute */
}

.ps-dateCard {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 75px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.ps-dateCard:hover {
  background: rgba(0, 123, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.ps-dateCard.active {
  background: rgba(0, 123, 255, 0.15);
  border-color: rgba(0, 123, 255, 0.5);
  font-weight: 600;
}

.ps-dateCardToday {
  font-size: 0.4em;
  opacity: 0.9;
  margin-bottom: 2px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ps-dateCardDay {
  font-size: 0.7em;
  opacity: 0.8;
  margin-bottom: 2px;
  text-transform: capitalize;
}

.ps-dateCardDate {
  font-size: 0.75em;
  font-weight: 500;
  line-height: 1.2;
}

.ps-datePickerWrapper {
  display: flex;
  align-items: stretch; /* Stretch to match arrow height */
  gap: 0;
  margin: 0;
  flex-shrink: 0;
  align-self: stretch; /* Match height of other carousel elements */
}

.ps-datePickerWrapper input[type="date"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.ps-datePickerDisplay {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px !important;
  padding: 10px 12px !important;
  min-width: 75px !important;
  width: 75px !important;
  height: 100% !important; /* Fill wrapper height */
  min-height: 0 !important;
  max-height: none !important;
  text-align: center !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  user-select: none !important;
  box-sizing: border-box !important;
  color: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
  margin: 0 !important;
  /* Match date card styling exactly - all properties must match */
  align-self: stretch !important; /* Match arrow alignment */
}

.ps-datePickerDisplay:hover {
  background: rgba(0, 123, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.ps-datePickerDisplay .ps-calendarIcon {
  font-size: 1.5em !important;
  line-height: 1 !important;
  opacity: 0.9 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Retired status column styling */
.ps-retired {
  text-align: right !important;
  font-weight: normal !important;
  font-size: 0.75em !important; /* Smaller font size */
  padding-right: 4px;
  color: rgba(255, 255, 255, 0.7);
}

.ps-h-retired {
  /* Empty header for retired column */
}

/* Serve indicator - bouncing tennis ball */
.ps-serve {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.84em; /* 30% smaller than 1.2em (1.2 * 0.7 = 0.84) */
  line-height: 1;
  min-height: 20px;
  position: relative;
}

.ps-serve-bounce {
  animation: ps-bounce-tennis 2s ease-in-out infinite;
}

@keyframes ps-bounce-tennis {
  0% {
    transform: translateY(0);
    animation-timing-function: ease-out;
  }
  25% {
    transform: translateY(-8px);
    animation-timing-function: ease-in;
  }
  50% {
    transform: translateY(0);
    animation-timing-function: ease-out;
  }
  75% {
    transform: translateY(-4px);
    animation-timing-function: ease-in;
  }
  100% {
    transform: translateY(0);
    animation-timing-function: ease-out;
  }
}

/* Button styling to match card design - same font size as player names */
.ps-actionBtn {
  /* Match player names (.ps-name) font size exactly */
  font-family: inherit !important;
  font-size: 0.8em !important; /* Smaller font to match player names exactly */
  font-weight: inherit !important;
  line-height: inherit !important;
  letter-spacing: inherit !important;
  text-transform: inherit !important;
  
  /* Layout */
  text-align: center;
  width: 100%;
  padding: 12px 16px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px; /* Rounded edges like match card */
  
  /* Visual styling to match card elements */
  background-color: rgba(255, 255, 255, 0.05);
  color: inherit !important;
  
  /* Interaction */
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
  
  /* Font rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.ps-actionBtn:hover:not(:disabled) {
  background-color: rgba(0, 123, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.ps-actionBtn:active:not(:disabled) {
  background-color: rgba(0, 123, 255, 0.15);
  border-color: rgba(0, 123, 255, 0.5);
}

.ps-actionBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: rgba(255, 255, 255, 0.02);
}

/* Match timeBox styling - same as button */
.ps-timeBox {
  font-family: inherit !important;
  font-size: 0.8em !important; /* Match player names size */
  font-weight: inherit !important;
  line-height: inherit !important;
  color: inherit !important;
  text-align: center;
  padding: 12px 16px;
}

/* Card footer alignment */
.ps-cardFooter {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ps-cardFooter .ps-timeBox,
.ps-cardFooter .ps-actionBtn {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

/* Ensure button text matches player name size exactly */
.ps-card .ps-actionBtn {
  font-size: 0.8em !important; /* Match player names (.ps-name) - smaller font */
  font-weight: 400;
  line-height: 1.5;
}

/* Align round label with match status */
/* Match status starts at card's left edge (accounting for card padding) */
.ps-cardStatus {
  padding-left: 0 !important;
  margin-left: 0 !important;
}

/* Grid starts with photo column (64px), then name column (1fr) */
/* Round label is in name column, so we need to account for photo column width */
.ps-scoreGrid {
  padding-left: 0 !important;
  margin-left: 0 !important;
}

/* Round label should start at the same position as match status */
/* Since it's in the name column (after photo column), we need negative margin or adjust grid */
.ps-h-round {
  padding-left: 0 !important;
  margin-left: 0 !important;
  text-align: left !important;
  /* Account for photo column width to align with cardStatus */
  position: relative;
  left: -76px;
  padding-right: 76px;
}

/* ======================================================
   MOBILE RESPONSIVE - Scale down ALL content by 20% (multiply by 0.8)
   ====================================================== */
@media (max-width: 768px) {
  /* Global scaling: Scale down ALL site content by 20% using transform */
  /* This scales everything including fonts, spacing, images, etc. */
  html {
    font-size: 80% !important; /* 20% reduction = 80% of original */
  }
  
  body {
    font-size: 80% !important;
    transform: scale(0.8);
    transform-origin: top left;
    width: calc(100vw / 0.8);
    overflow-x: hidden;
  }
  
  /* Ensure viewport meta tag doesn't interfere */
  @supports (transform: scale(1)) {
    body {
      transform: scale(0.8);
      transform-origin: top left;
      width: calc(100vw / 0.8);
      min-height: calc(100vh / 0.8);
    }
  }
  
  /* Page spacing */
  .ps-wrap {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  /* Tournament blocks spacing */
  .ps-tournament {
    margin-bottom: calc(32px * 0.8) !important;
  }

  .ps-tournamentTitle {
    margin-bottom: calc(16px * 0.8) !important;
  }

  .ps-headerRow {
    margin-bottom: calc(24px * 0.8);
  }

  /* Date carousel */
  .ps-dateCarousel {
    margin: calc(24px * 0.8) auto;
    padding: 0 calc(20px * 0.8);
    gap: calc(8px * 0.8);
  }

  .ps-dateCarouselContainer {
    gap: calc(8px * 0.8);
  }

  /* Date carousel arrows */
  .ps-dateCarouselArrow {
    padding: calc(10px * 0.8) calc(12px * 0.8);
    min-width: calc(40px * 0.8);
    font-size: calc(20px * 0.8);
    border-radius: calc(8px * 0.8);
  }

  /* Date cards */
  .ps-dateCard {
    padding: calc(10px * 0.8) calc(12px * 0.8);
    min-width: calc(75px * 0.8);
    border-radius: calc(8px * 0.8);
  }

  .ps-dateCardToday {
    font-size: calc(0.4em * 0.8);
    margin-bottom: calc(2px * 0.8);
  }

  .ps-dateCardDay {
    font-size: calc(0.7em * 0.8);
    margin-bottom: calc(2px * 0.8);
  }

  .ps-dateCardDate {
    font-size: calc(0.75em * 0.8);
  }

  /* Date picker display */
  .ps-datePickerDisplay {
    padding: calc(10px * 0.8) calc(12px * 0.8) !important;
    min-width: calc(75px * 0.8) !important;
    width: calc(75px * 0.8) !important;
    border-radius: calc(8px * 0.8) !important;
  }

  .ps-datePickerDisplay .ps-calendarIcon {
    font-size: calc(1.5em * 0.8) !important;
  }

  /* Retired status */
  .ps-retired {
    font-size: calc(0.75em * 0.8) !important;
    padding-right: calc(4px * 0.8);
  }

  /* Serve indicator */
  .ps-serve {
    font-size: calc(0.84em * 0.8);
    min-height: calc(20px * 0.8);
  }

  @keyframes ps-bounce-tennis {
    0% {
      transform: translateY(0);
      animation-timing-function: ease-out;
    }
    25% {
      transform: translateY(calc(-8px * 0.8));
      animation-timing-function: ease-in;
    }
    50% {
      transform: translateY(0);
      animation-timing-function: ease-out;
    }
    75% {
      transform: translateY(calc(-4px * 0.8));
      animation-timing-function: ease-in;
    }
    100% {
      transform: translateY(0);
      animation-timing-function: ease-out;
    }
  }

  /* Action button */
  .ps-actionBtn {
    font-size: calc(0.8em * 0.8) !important;
    padding: calc(12px * 0.8) calc(16px * 0.8);
    border-radius: calc(8px * 0.8);
  }

  /* Time box */
  .ps-timeBox {
    font-size: calc(0.8em * 0.8) !important;
    padding: calc(12px * 0.8) calc(16px * 0.8);
  }

  /* Card footer */
  .ps-cardFooter {
    margin-top: calc(12px * 0.8);
    padding-top: calc(12px * 0.8);
  }

  /* Match card shadow - scaling handled globally */
  .ps-match.ps-card {
    box-shadow: 0 0 calc(8px * 0.8) rgba(0, 123, 255, 0.15), 0 0 calc(3px * 0.8) rgba(0, 123, 255, 0.1) !important;
  }

  /* Round label alignment */
  .ps-h-round {
    left: calc(-76px * 0.8);
    padding-right: calc(76px * 0.8);
  }

  .ps-match.ps-card:hover {
    box-shadow: 0 0 calc(12px * 0.8) rgba(0, 123, 255, 0.2), 0 0 calc(6px * 0.8) rgba(0, 123, 255, 0.15) !important;
  }
}
