/* css/inscritos.css */
:root {
    --turquoise: #40E0D0;
    --dark-turquoise: #00CED1;
    --purple: #9370DB;
    --dark-purple: #663399;
    --white: #FFFFFF;
    --black: #000000;
    --gray: #F8F9FA;
    --dark-blue: #001845;
    --border: #e5e7eb;
  }
  
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  body {
    font-family: 'Barlow Condensed', 'Montserrat', system-ui, sans-serif;
    color: var(--black);
    background: linear-gradient(135deg, var(--gray), var(--white));
    min-height: 100vh;
  }
  
  /* ============ HEADER ============ */
  .inscritos-header {
    background: linear-gradient(135deg, var(--purple), var(--turquoise));
    color: var(--white);
    padding: 40px 20px;
    text-align: center;
  }
  .inscritos-header h1 {
    font-family: 'Alfa Slab One', cursive;
    font-size: 2.5rem;
    margin: 0 0 8px;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
  }
  .inscritos-header p {
    font-size: 1.1rem;
    opacity: 0.95;
    margin: 0;
  }
  
  /* ============ MAIN ============ */
  .inscritos-main {
    max-width: 100vw;
    margin: 0 auto;
    padding: 40px 20px;
  }
  
  /* ============ ESTADOS ============ */
  .inscritos-loading,
  .inscritos-error,
  .inscritos-privada,
  .inscritos-vacia {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  }
  .inscritos-loading .spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--border);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  
  .inscritos-privada .icon,
  .inscritos-vacia .icon,
  .inscritos-error .icon {
    font-size: 4rem;
    margin-bottom: 16px;
  }
  .inscritos-privada h2,
  .inscritos-vacia h2,
  .inscritos-error h2 {
    font-family: 'Alfa Slab One', cursive;
    color: var(--dark-purple);
    margin: 0 0 12px;
    font-size: 1.5rem;
  }
  .inscritos-privada p,
  .inscritos-vacia p,
  .inscritos-error p {
    color: #6b7280;
    margin: 0 0 20px;
    font-size: 1rem;
  }
  
  /* ============ TOOLBAR ============ */
  .inscritos-toolbar {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
  }
  .inscritos-search {
    flex: 1;
    min-width: 240px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--white);
    transition: border-color 0.15s;
  }
  .inscritos-search:focus {
    outline: none;
    border-color: var(--purple);
  }
  .inscritos-counter {
    background: var(--purple);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
  }
  .inscritos-counter span {
    font-weight: 700;
  }
  
  /* ============ TABLA ============ */
  .inscritos-table-wrapper {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
  }
  .inscritos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
  }
  .inscritos-table thead {
    background: linear-gradient(135deg, var(--purple), var(--turquoise));
    color: var(--white);
  }
  .inscritos-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
  }
  .inscritos-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
  }
  .inscritos-table tbody tr:last-child {
    border-bottom: none;
  }
  .inscritos-table tbody tr:hover {
    background: rgba(147, 112, 219, 0.05);
  }
  .inscritos-table td {
    padding: 12px 16px;
    color: #374151;
  }
  .inscritos-table .col-num {
    color: #9ca3af;
    font-weight: 600;
    width: 60px;
  }
  
  /* ============ FOOTER / BOTÓN ============ */
  .inscritos-footer {
    margin-top: 32px;
    text-align: center;
  }
  .btn-inscribirse {
    display: inline-block;
    padding: 14px 40px;
    background: linear-gradient(135deg, var(--purple), var(--turquoise));
    color: var(--white);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    cursor: pointer;
    font-family: inherit;
  }
  .btn-inscribirse:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(147, 112, 219, 0.3);
  }
  
  /* ============ RESPONSIVE ============ */
  @media (max-width: 640px) {
    .inscritos-header h1 { font-size: 1.8rem; }
    .inscritos-header { padding: 30px 16px; }
    .inscritos-main { padding: 20px 12px; }
    .inscritos-table th,
    .inscritos-table td { padding: 10px 12px; font-size: 0.85rem; }
    .inscritos-toolbar { flex-direction: column; align-items: stretch; }
    .inscritos-counter { text-align: center; }
  }

  /* ============ FILTROS ============ */
.inscritos-filter-group {
    display: flex;
    flex-shrink: 0;
  }
  .inscritos-filter {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--white);
    color: var(--black);
    cursor: pointer;
    transition: border-color 0.15s;
    min-width: 160px;
  }
  .inscritos-filter:focus {
    outline: none;
    border-color: var(--purple);
  }
  .inscritos-filter:hover {
    border-color: var(--purple);
  }
  
  @media (max-width: 640px) {
    .inscritos-filter-group {
      width: 100%;
    }
    .inscritos-filter {
      width: 100%;
    }
  }

  /* ============ DORSALES (badges estilo carrera) ============ */
.col-dorsal {
    white-space: nowrap;
    text-align: center;
    min-width: 120px;
  }
  
  .dorsal-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--purple) 0%, var(--turquoise) 100%);
    color: #ffffff;
    font-family: 'Alfa Slab One', 'Barlow Condensed', cursive;
    font-weight: 700;
    font-size: 1rem;
    padding: 6px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(147, 112, 219, 0.35);
    letter-spacing: 0.5px;
    min-width: 44px;
    text-align: center;
    line-height: 1.1;
  }
  
  .dorsal-sep {
    display: inline-block;
    color: var(--purple);
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 4px;
    opacity: 0.6;
  }
  
  .dorsal-empty {
    color: #9ca3af;
    font-weight: 600;
    font-size: 1rem;
  }
  
  /* Responsive: badges más chicos en móvil */
  @media (max-width: 640px) {
    .dorsal-badge {
      font-size: 0.85rem;
      padding: 4px 8px;
      min-width: 36px;
    }
    .col-dorsal {
      min-width: 90px;
    }
  }

  /* ============ BOTÓN VOLVER AL INICIO ============ */
.back-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #ffffff;
    text-decoration: none;
    font-family: 'Barlow Condensed', 'Montserrat', system-ui, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
  }
  
  .back-home:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
  
  .back-home svg {
    transition: transform 0.2s ease;
  }
  
  .back-home:hover svg {
    transform: translateX(-3px);
  }
  
  /* En móvil, solo la flecha (sin texto) para ahorrar espacio */
  @media (max-width: 640px) {
    .back-home {
      font-size: 0;
      gap: 0;
      padding: 10px;
      border-radius: 50%;
      width: 40px;
      height: 40px;
      justify-content: center;
    }
    .back-home svg {
      width: 20px;
      height: 20px;
    }
  }

  /* ============ CELDA CORREDOR(ES) ============ */
.col-corredor {
  min-width: 220px;
  vertical-align: middle;
}

.corredor-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.corredor-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}

.corredor-line + .corredor-line {
  border-top: 1px dashed rgba(147, 112, 219, 0.25);
  padding-top: 8px;
}

.corredor-nombre {
  color: var(--dark-purple);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.corredor-meta {
  color: #6b7280;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.corredor-vacio {
  color: #9ca3af;
  font-weight: 600;
}

/* ============ RESPONSIVE: TABLA → CARDS EN MÓVIL ============ */
@media (max-width: 900px) {
  /* Ocultar el thead */
  .inscritos-table thead {
    display: none;
  }

  /* Cada fila es una card */
  .inscritos-table tbody tr {
    display: block;
    background: var(--white);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
  }

  .inscritos-table tbody tr:hover {
    box-shadow: 0 6px 20px rgba(147, 112, 219, 0.15);
    border-color: var(--purple);
  }

  /* Flecha ▼ para indicar que se puede expandir */
  .inscritos-table tbody tr::after {
    content: '▼';
    position: absolute;
    top: 16px;
    right: 16px;
    color: var(--purple);
    font-size: 0.75rem;
    transition: transform 0.25s ease;
    opacity: 0.6;
  }

  .inscritos-table tbody tr.expanded::after {
    transform: rotate(180deg);
  }

  /* Celdas: por defecto, solo se ven # (oculto), Dorsal y Corredor */
  .inscritos-table tbody td {
    display: none;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
  }

  .inscritos-table tbody td:last-child {
    border-bottom: none;
  }

  /* Mostrar solo Dorsal y Corredor cuando está colapsada */
  .inscritos-table tbody td.col-num {
    display: none;
  }

  .inscritos-table tbody td.col-dorsal {
    display: flex;
    margin-bottom: 8px;
    padding-bottom: 10px;
    border-bottom: 1px dashed rgba(147, 112, 219, 0.3);
    justify-content: flex-start;
    gap: 6px;
  }

  .inscritos-table tbody td.col-corredor {
    display: block;
    padding: 4px 0 8px;
    border-bottom: none;
  }

  .inscritos-table tbody td.col-corredor::before {
    content: none;
  }

  /* Cuando está expandida, mostrar TODAS las celdas */
  .inscritos-table tbody tr.expanded td {
    display: flex;
  }

  .inscritos-table tbody tr.expanded td.col-num {
    display: none;
  }

  .inscritos-table tbody tr.expanded td.col-dorsal {
    display: flex;
  }

  .inscritos-table tbody tr.expanded td.col-corredor {
    display: block;
  }

  /* Label a la izquierda para las celdas expandidas */
  .inscritos-table tbody tr.expanded td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--purple);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
  }

  /* Corredor: label arriba, contenido abajo */
  .inscritos-table tbody tr.expanded td.col-corredor::before {
    content: none;
  }

  .corredor-cell {
    width: 100%;
  }

  /* Más separación entre las celdas expandidas */
  .inscritos-table tbody tr.expanded td + td {
    margin-top: 2px;
  }
}

/* ============ RESPONSIVE: MUY ANGOSTO ============ */
@media (max-width: 480px) {
  .inscritos-table tbody tr {
    padding: 14px;
    margin-bottom: 10px;
  }

  .inscritos-table tbody tr.expanded td {
    font-size: 0.85rem;
  }

  .corredor-nombre {
    font-size: 0.9rem;
  }

  .corredor-meta {
    font-size: 0.75rem;
  }

  .dorsal-badge {
    font-size: 0.85rem;
    padding: 4px 8px;
    min-width: 36px;
  }

  .inscritos-table tbody tr::after {
    top: 14px;
    right: 14px;
  }
}