/* TezArenaSelect component styles */

.tez-arena-select-container {
  /* Extends shared styles from form-fields.css */
}

.tez-arena-select-content {
  width: 100%;
}

.tez-arena-select-label-container {
  margin-bottom: 0.5rem;
}

.tez-arena-select-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 0.75rem;
  max-height: 47vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
  touch-action: pan-y pinch-zoom;
  position: relative;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-overflow-scrolling: auto;
  scroll-behavior: auto;
  
  /* Hide scrollbar but keep scroll functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

/* Hide scrollbar for WebKit browsers (Chrome, Safari, Edge) */
.tez-arena-select-grid::-webkit-scrollbar {
  display: none;
}

/* Prevent any touch events from propagating to Telegram */
.tez-arena-select-grid * {
  touch-action: pan-y pinch-zoom;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Add a wrapper to prevent body scroll when scrolling arena grid */
.tez-arena-select-grid::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  touch-action: none;
  overscroll-behavior: none;
}

.loading-arenas {
  text-align: center;
  padding: 2rem;
  font-style: italic;
  color: #a8b3c0;
}



/* Arena item styles */
.arena-item {
  background-color: rgba(40, 40, 40, 0.7);
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  margin-bottom: 10px;
  min-height: 120px;
  height: auto;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.arena-item.selected {
  background-color: rgba(50, 60, 70, 0.85);
  border: 1px solid #3498db;
  box-shadow: 0 0 15px rgba(52, 152, 219, 0.3);
  transform: translateY(-2px);
}

.arena-item.selected .arena-name {
  color: #3498db;
  text-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.arena-item.selected .arena-preview {
  border-color: rgba(52, 152, 219, 0.5);
  box-shadow: inset 0 0 15px rgba(52, 152, 219, 0.3), 0 0 10px rgba(52, 152, 219, 0.2);
}

.arena-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}

.arena-item:after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #e74c3c, transparent);
  transition: all 0.6s;
}

.arena-item:hover:after {
  left: 100%;
}

/* Checkbox styles for multiselect mode */
.arena-checkbox {
  position: absolute;
  top: 4px;
  right: 22px;
  z-index: 2;
  display: none;
}

.arena-checkbox.show {
  display: block;
}

.arena-checkbox-input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.arena-checkbox-custom {
  position: absolute;
  top: 0;
  left: 0;
  height: 18px;
  width: 18px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  transition: all 0.2s;
}

.arena-checkbox-input:checked ~ .arena-checkbox-custom {
  background-color: #3498db;
  border-color: #3498db;
}

.arena-checkbox-custom:after {
  content: "";
  position: absolute;
  display: none;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.arena-checkbox-input:checked ~ .arena-checkbox-custom:after {
  display: block;
}

.arena-rank {
  position: absolute;
  top: -5px;
  left: -5px;
  background: #e74c3c;
  color: white;
  font-weight: bold;
  padding: 5px 8px;
  border-radius: 0 0 8px 0;
  font-size: 12px;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.arena-content {
  display: flex;
  width: 100%;
  gap: 12px;
}

.arena-preview {
  width: 100px;
  height: 100px;
  background-color: #333;
  border-radius: 4px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.arena-preview:before {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  background-color: rgba(46, 204, 113, 0.3);
  top: -50%;
  left: 0;
  box-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
  animation: scanline 3s linear infinite;
}

@keyframes scanline {
  0% {
    top: -10%;
  }
  100% {
    top: 110%;
  }
}

.arena-details {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

.arena-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 5px;
  font-family: 'Orbitron', sans-serif;
}

.arena-description {
  font-size: 13px;
  color: #aaa;
  flex-grow: 1;
  margin-bottom: 10px;
  line-height: 1.4;
}

/* Arena rating display */
.arena-rating {
  display: flex;
  align-items: center;
  margin-top: 8px;
  border-radius: 4px;
}

.rating-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #a8b3c0;
}

.rating-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  padding-left: 5px;
  font-weight: 700;
  color: #3498db;
  text-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
  opacity: 0.8;
}

/* ============================================
   Picker Mode: grid inside full-screen overlay
   (no max-height, formPage-body handles scroll)
   ============================================ */
.tez-arena-select-grid.picker-mode {
  max-height: none;
  overflow-y: visible;
}

.tez-arena-select-grid.picker-mode::before {
  display: none;
}

/* ============================================
   Compact Trigger Card (pickerMode = true)
   ============================================ */
.arena-trigger-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: rgba(40, 40, 40, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  min-height: 64px;
}

.arena-trigger-card:active {
  transform: scale(0.98);
}

.arena-trigger-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #e74c3c, transparent);
  transition: all 0.6s;
}

.arena-trigger-card:active::after {
  left: 100%;
}

.arena-trigger-card.has-selection {
  border-color: rgba(52, 152, 219, 0.5);
  background-color: rgba(50, 60, 70, 0.85);
}

.arena-trigger-preview {
  width: 56px;
  height: 56px;
  background-color: rgba(60, 60, 60, 0.6);
  border-radius: 4px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: rgba(255, 255, 255, 0.3);
}

.arena-trigger-card.has-selection .arena-trigger-preview {
  border-color: rgba(52, 152, 219, 0.4);
}

.arena-trigger-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.arena-trigger-name {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  font-family: 'Rajdhani', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arena-trigger-card.has-selection .arena-trigger-name {
  color: #3498db;
  font-family: 'Orbitron', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 13px;
}

.arena-trigger-description {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.arena-trigger-chevron {
  font-size: 24px;
  color: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  line-height: 1;
}

/* Error state on trigger card */
.tez-arena-select-container.error .arena-trigger-card {
  border-color: #e74c3c;
}
