/* ====== Variables ====== */
:root {
    --verde: #2ecc71;
    --verde-oscuro: #27ae60;
    --azul-claro: #2761ae;
    --azul-bajo: #1a5a9a;
    --azul-oscuro: #1e2a38;
    --gris-claro: #ecf0f1;
    --texto: #ffffff;
    --texto-secundario: #bdc3c7;
    --borde: #34495e;
  }
  
  /* ====== Base ====== */
  body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--azul-oscuro);
    color: var(--texto);
    min-height: 100vh;
    padding-top: 60px; /* Add space for fixed navbar */
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }

  /* NAVBAR BASE */
  .navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(30, 42, 56, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 999;
    box-sizing: border-box;
    border-bottom: 1px solid var(--borde);
  }
  
  /* Elementos */

  /* Logo centrado */
  .logo {
    width: 150px;
    margin-bottom: 20px;
    padding: 20px;
  }

  .name {
    color: rgb(19, 208, 16);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.5rem;
  }
  .nav-left {
    display: flex;
    align-items: center;
  }
  
  .user-icon {
    color: white;
    text-decoration: none;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
  }

  .user-icon i {
    font-size: 20px;
  }

  .user-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--verde);
  }

  .navbar-center {
    display: flex;
    align-items: center;
  }

  .navbar-center .name {
    height: 40px;
    width: auto;
  }
  
  /* Enlace derecho */
  .nav-right {
    display: flex;
    align-items: center;
  }
  
  /* Menú toggle (hamburguesa) */
  .menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    display: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
  }
  
  .menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
  }
  
  .nav-right .add-court-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
  }
  
  .nav-right .add-court-link:hover {
    color: var(--verde);
    background: rgba(255, 255, 255, 0.1);
  }
  
  .container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    box-sizing: border-box;
  }
  
  h1, h2 {
    color: var(--verde);
    margin-bottom: 1rem;
  }
  
  /* ====== Formulario ====== */
  form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    background-color: #243447;
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--borde);
    margin-bottom: 2rem;
  }
  
  form input,
  form select,
  form button {
    padding: 0.6rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
  }
  
  form input,
  form select {
    background-color: var(--azul-oscuro);
    color: var(--texto);
    border: 1px solid var(--borde);
  }
  
  button.agregar-jugador {
    grid-column: span 2;
    background-color: var(--verde);
    color: #fff;
    cursor: pointer;
    transition: background 0.3s;
  }
  button.formar-equipos {
    grid-column: span 2;
    background-color: var(--azul-claro);
    color: #fff;
    cursor: pointer;
    transition: background 0.3s;
  }
  
  button.agregar-jugador:hover {
    background-color: var(--verde-oscuro);
  }

  button.formar-equipos:hover {
    background-color: var(--azul-bajo);
  }

  .acciones-formulario {
    grid-column: span 2;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
  }
  
  .acciones-formulario button {
    flex: 1;
  }
  
  /* ====== Tabla de jugadores ====== */
  .lista-jugadores table {
    width: 100%;
    border-collapse: collapse;
    background-color: #2c3e50;
    border-radius: 10px;
    overflow: hidden;
  }
  
  .lista-jugadores th,
  .lista-jugadores td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--borde);
  }
  
  .lista-jugadores th {
    background-color: #34495e;
    color: var(--texto-secundario);
  }
  
  .lista-jugadores tr:last-child td {
    border-bottom: none;
  }
  
  /* ====== Responsive ====== */
  @media (max-width: 768px) {
    .menu-toggle {
      display: block;
    }

    .nav-right {
      display: none;
    }

    .navbar-center .name {
      height: 30px;
    }

    .container {
      padding: 1rem;
    }

    form {
      grid-template-columns: 1fr;
    }

    .acciones-formulario {
      flex-direction: column;
      gap: 0.5rem;
      grid-column: span 1;
    }

    .lista-jugadores {
      overflow-x: auto;
    }

    .lista-jugadores table {
      min-width: 600px;
    }

    .modal-content {
      width: 98%;
      margin: 0.5rem;
      padding: 0.5rem;
    }

    .modal-header, .modal-body, .modal-footer {
      padding: 0.5rem;
    }

    .equipos-info {
      flex-direction: column;
      gap: 0.5rem;
      align-items: stretch;
    }

    .equipos-table th, .equipos-table td {
      padding: 0.5rem 0.3rem;
      font-size: 0.95rem;
    }
  }

  @media (max-width: 480px) {
    body {
      padding: 0;
      padding-top: 60px;
    }

    .container {
      padding: 0.5rem;
    }

    .navbar {
      padding: 0 10px;
    }

    .navbar-center .name {
      height: 25px;
    }

    h1 {
      font-size: 1.1rem;
    }

    h2 {
      font-size: 1rem;
    }

    .modal-content {
      width: 100vw;
      min-width: unset;
      max-width: 100vw;
      border-radius: 0;
      margin: 0;
      padding: 0.2rem;
    }

    .modal-header, .modal-body, .modal-footer {
      padding: 0.2rem;
    }

    .equipos-info {
      flex-direction: column;
      gap: 0.2rem;
      align-items: stretch;
    }

    .equipos-table {
      font-size: 0.9rem;
    }

    .equipos-table th, .equipos-table td {
      padding: 0.3rem 0.1rem;
    }

    .equipos-table {
      min-width: 320px;
    }
  }

  /* ====== Modal de Equipos ====== */
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .modal-overlay.show {
    opacity: 1;
  }

  .modal-content {
    background: var(--azul-oscuro);
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.7);
    transition: transform 0.3s ease;
    border: 1px solid var(--borde);
  }

  .modal-overlay.show .modal-content {
    transform: scale(1);
  }

  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--borde);
  }

  .modal-header h2 {
    margin: 0;
    color: var(--verde);
  }

  .close-btn {
    background: none;
    border: none;
    color: var(--texto-secundario);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
  }

  .close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--texto);
  }

  .modal-body {
    padding: 1.5rem;
  }

  .equipos-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
  }

  .equipo-stats {
    text-align: center;
  }

  .equipo-nombre {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--verde);
    margin-bottom: 0.5rem;
  }

  .equipo-total {
    display: block;
    font-size: 1.1rem;
    color: var(--texto-secundario);
  }

  .equipos-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
  }

  .equipos-table th,
  .equipos-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--borde);
  }

  .equipos-table th {
    background: var(--borde);
    color: var(--verde);
    font-weight: bold;
  }

  .equipos-table tr:last-child td {
    border-bottom: none;
  }

  .modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--borde);
    text-align: center;
  }

  .btn-guardar {
    background: var(--verde);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }

  .btn-guardar:hover {
    background: var(--verde-oscuro);
    transform: translateY(-2px);
  }

  /* ====== Responsive para Modal ====== */
  @media (max-width: 768px) {
    .modal-content {
      width: 95%;
      margin: 1rem;
    }

    .modal-header {
      padding: 1rem;
    }

    .modal-body {
      padding: 1rem;
    }

    .modal-footer {
      padding: 1rem;
    }

    .equipos-info {
      flex-direction: column;
      gap: 1rem;
    }

    .equipos-table th,
    .equipos-table td {
      padding: 0.75rem 0.5rem;
      font-size: 0.9rem;
    }
  }

  /* Tarjetas de equipos para móviles */
  .equipo-card {
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--borde);
    border-radius: 10px;
    margin-bottom: 1rem;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  }
  .equipo-header {
    font-weight: bold;
    color: var(--verde);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .equipo-lista {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  .equipo-lista li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--borde);
    color: var(--texto);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
  }
  .equipo-lista li:last-child {
    border-bottom: none;
  }
  .equipo-lista .nivel {
    color: var(--texto-secundario);
    font-size: 0.95em;
  }
  @media (max-width: 768px) {
    .equipo-card {
      margin-bottom: 0.7rem;
      padding: 0.7rem;
    }
    .equipo-header {
      font-size: 1rem;
    }
    .equipo-lista li {
      font-size: 0.97rem;
      padding: 0.3rem 0;
    }
  }
  @media (max-width: 480px) {
    .equipo-card {
      margin-bottom: 0.5rem;
      padding: 0.5rem;
      border-radius: 6px;
    }
    .equipo-header {
      font-size: 0.98rem;
    }
    .equipo-lista li {
      font-size: 0.93rem;
      padding: 0.2rem 0;
    }
  }