/* ==========================================================================
   REBOLEO ¡VAMOS! - STYLESHEET (CLEAN LIGHT & FRESH SPORTS THEME)
   ========================================================================== */

:root {
  --bg-app: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  
  --brand-green: #00A86B;
  --brand-green-dark: #064E3B;
  --brand-green-light: #E8F5E9;
  --brand-orange: #FF7A00;
  --brand-orange-light: #FFF3E0;
  --brand-teal: #0C4A42;
  
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  
  --border-light: #E2E8F0;
  --border-subtle: #F1F5F9;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.12);
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bottom-bar-height: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ==========================================================================
   TOP FLOATING HEADER (LOGO, SEARCH & CHIPS)
   ========================================================================== */
.top-header-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 12px 16px 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.88) 85%, rgba(255, 255, 255, 0) 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Fila Superior: Logo Oficial & Menú Hamburguesa */
.brand-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px;
  gap: 6px;
}

.brand-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.official-logo-img {
  height: 52px;
  max-width: 175px;
  object-fit: contain;
  mix-blend-mode: multiply;
  display: block;
  filter: contrast(1.05);
}

.menu-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s ease;
}
.menu-btn:active {
  background: #F1F5F9;
}

/* Avatar de Usuario Circular con Foto */
.user-avatar-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  position: relative;
  cursor: pointer;
  overflow: visible;
  transition: transform 0.2s ease;
}

.user-avatar-circle:active {
  transform: scale(0.94);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.user-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  background: var(--brand-green);
  border: 2px solid #FFFFFF;
  border-radius: 50%;
}

.menu-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Barra de Búsqueda: ¿A dónde quieres ir? */
.search-pill-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
}

.search-pill-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 15px;
  margin-left: 10px;
}

.search-pill-box input::placeholder {
  color: var(--text-muted);
}

.filter-tune-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* Chips de Filtro Horizontales (Cerca de mí, Techadas, Con luz) */
.filter-chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 2px 6px;
}
.filter-chips-row::-webkit-scrollbar {
  display: none;
}

.clean-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.clean-chip.active {
  background: var(--brand-green);
  border-color: var(--brand-green);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 168, 107, 0.3);
}

/* ==========================================================================
   CANVAS DE MAPA (CLARO & NÍTIDO)
   ========================================================================== */
#map {
  width: 100%;
  height: 100%;
  background: #F1F5F9;
  z-index: 1;
}

.leaflet-container {
  background: #F1F5F9 !important;
}
.leaflet-bar {
  display: none !important;
}

/* ==========================================================================
   PINES MINIMALISTAS (VERDE ESMERALDA & NARANJA CON CENTRO BLANCO)
   ========================================================================== */
.clean-pin-container {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.clean-drop-pin {
  width: 32px;
  height: 38px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clean-drop-pin:hover, .clean-drop-pin.selected {
  transform: scale(1.2) translateY(-4px);
}

/* Ubicación GPS del Usuario (Punto Azul con Halo Concétrico) */
.user-gps-pulse {
  width: 20px;
  height: 20px;
  background: #2563EB;
  border-radius: 50%;
  border: 3.5px solid #FFFFFF;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.6);
  position: relative;
}
.user-gps-pulse::after {
  content: '';
  position: absolute;
  top: -12px;
  left: -12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.22);
  animation: gps-wave 2s infinite ease-out;
}

@keyframes gps-wave {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Botón Flotante Circular de Navegación / Brújula */
.floating-compass-btn {
  position: absolute;
  right: 16px;
  bottom: calc(var(--bottom-bar-height) + 230px);
  z-index: 999;
  width: 44px;
  height: 44px;
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--brand-teal);
  transition: transform 0.2s ease;
}
.floating-compass-btn:active {
  transform: scale(0.92);
}

/* ==========================================================================
   TARJETA FLOTANTE INFERIOR ("CANCHA LA MAGDALENA")
   ========================================================================== */
/* Botón X de Cierre de Tarjeta */
.card-close-btn {
  background: #F1F5F9;
  border: none;
  color: #64748B;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-left: 6px;
}

.card-close-btn:hover {
  background: #E2E8F0;
  color: #0F172A;
}

.card-close-btn:active {
  transform: scale(0.9);
}

.bottom-card-container {
  position: absolute;
  bottom: calc(var(--bottom-bar-height) + 12px);
  left: 14px;
  right: 14px;
  z-index: 1000;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.bottom-card-container.hidden {
  transform: translateY(140%);
  opacity: 0;
  pointer-events: none;
}
.bottom-card-container > * {
  pointer-events: auto;
}

.match-sheet-card {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 16px 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(226, 232, 240, 0.8);
  transition: all 0.3s ease;
}

/* Fila 1: Badge ¡LISTO PARA SALIR! & Tiempo de llegada */
.sheet-top-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.ready-pill-badge {
  background: var(--brand-orange);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 5px 12px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(255, 122, 0, 0.3);
}

.eta-status-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eta-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-green);
}

.transport-badge {
  background: #F1F5F9;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}

/* Fila 2: Título de Cancha */
.court-name-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}

/* Fila 3: Ubicación y Horario con Iconos */
.court-meta-row {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Fila 4: Roles en Cancha (Volador naranja, Ponedor gris, Servidor verde) */
.sheet-roles-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.role-chip-card {
  flex: 1;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.role-chip-card.needed {
  background: #FFF3E0;
  border: 1px solid #FFE0B2;
  color: #D97706;
}

.role-chip-card.pending {
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  color: #475569;
}

.role-chip-card.confirmed {
  background: var(--brand-green);
  color: #FFFFFF;
}

/* Fila 5: Botón Grande CTA Verde */
.action-play-btn {
  width: 100%;
  background: var(--brand-green);
  color: #FFFFFF;
  border: none;
  border-radius: 16px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 168, 107, 0.35);
  transition: all 0.2s ease;
}
.action-play-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(0, 168, 107, 0.25);
}

/* ==========================================================================
   BOTTOM NAVIGATION BAR (BLANCA)
   ========================================================================== */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-bar-height);
  background: #FFFFFF;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.03);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  padding: 6px 0;
  transition: all 0.2s ease;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.nav-item.active {
  color: var(--brand-green);
}

/* Modal 3-Toques */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open {
  display: flex;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  background: #FFFFFF;
  border-radius: 24px 24px 0 0;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.25s ease-out;
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}
.modal-close {
  background: #F1F5F9;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
}

.step-label {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--brand-green);
  font-weight: 800;
  margin-bottom: 6px;
}
.form-group {
  margin-bottom: 16px;
}
.form-select {
  width: 100%;
  background: #F8FAFC;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text-main);
  font-size: 14px;
}
.chips-selector {
  display: flex;
  gap: 8px;
}
.touch-chip {
  flex: 1;
  background: #F8FAFC;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  border-radius: 12px;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.touch-chip.selected {
  background: var(--brand-green-light);
  border-color: var(--brand-green);
  color: var(--brand-green);
}
