@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@600;700;900&family=Inter:wght@400;500;600;700&display=swap');

.nba-header {
  background-color: #0c0d10; /* Fondo ultra oscuro deportivo */
  position: sticky;
  top: 0;
  z-index: 1100;
  border-bottom: 2px solid #1a1d24;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
  font-family: 'Inter', sans-serif;

  .navbar {
    width: 100%;
    padding: 0 30px;
    box-sizing: border-box;
    height: 72px; /* Altura idéntica a cabeceras de alta competición */
    display: flex;
    align-items: center;

    .nav-container {
      width: 100%;
      max-width: 1400px;
      margin: 0 auto;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
  }

  /* MARCA Y LOGO */
  .brand-group {
    display: flex;
    align-items: center;
    gap: 14px;

    .logo-wrapper {
      width: 42px;
      height: 42px;
      display: flex;
      align-items: center;
      justify-content: center;
      filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));

      img {
        width: 100%;
        height: 100%;
        object-fit: contain;
      }
    }

    .animated-logo {
      font-family: 'Oswald', sans-serif;
      font-size: 1.4rem;
      font-weight: 900;
      text-decoration: none;
      letter-spacing: 1px;
      text-transform: uppercase;
      background: linear-gradient(270deg, #008000, #ffffff, #ff0000, #0000ff, #008000);
      background-size: 400% 400%;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      animation: banderaWave 12s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    }
  }

  /* VÍAS DE ENLACE DE NAVEGACIÓN */
  .nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 72px;
    margin: 0;
    padding: 0;

    li {
      height: 100%;
      display: flex;
      align-items: center;
      position: relative;

      & > a {
        color: #9ca3af;
        font-size: 0.9rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        text-decoration: none;
        padding: 0 16px;
        height: 100%;
        display: flex;
        align-items: center;
        gap: 6px;
        transition: color 0.2s ease, background-color 0.2s ease;

        &::after {
          content: '';
          position: absolute;
          bottom: -2px; /* Alineado justo encima del borde del header */
          left: 0;
          width: 100%;
          height: 3px;
          background-color: #870000; /* Rojo FIBA/NBA */
          transform: scaleX(0);
          transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        }

        &:hover {
          color: #ffffff;
          &::after { transform: scaleX(1); }
        }

        &.active {
          color: #ffffff;
          font-weight: 700;
          &::after {
            transform: scaleX(1);
            background-color: #870000;
          }
        }
      }
    }

    /* DROPDOWN COMPLEJO "MÁS" */
    .mas-container {
      .mas-btn {
        .arrow-icon {
          font-size: 0.75rem;
          transition: transform 0.2s ease;
          color: #4b5563;
        }
      }

      &:hover, &:focus-within {
        .mas-btn {
          color: #ffffff;
          background-color: #14171c;
          
          .arrow-icon {
            transform: rotate(180deg);
            color: #ffffff;
          }
        }

        .mas-links {
          opacity: 1;
          visibility: visible;
          transform: translateY(0);
        }
      }

      .mas-links {
        position: absolute;
        top: 72px;
        right: 0;
        width: 260px;
        background-color: #111317;
        border: 1px solid #1a1d24;
        border-top: none;
        border-radius: 0 0 6px 6px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
        list-style: none;
        padding: 8px 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;

        li {
          width: 100%;
          height: auto;
          display: block;

          a {
            color: #9ca3af;
            font-size: 0.85rem;
            font-weight: 500;
            text-transform: none;
            letter-spacing: 0px;
            padding: 12px 20px;
            width: 100%;
            box-sizing: border-box;
            display: flex;
            align-items: center;
            gap: 12px;
            text-decoration: none;
            transition: all 0.2s ease;

            i {
              width: 16px;
              text-align: center;
              color: #4b5563;
              font-size: 0.95rem;
              transition: color 0.2s ease;
            }

            &:hover, &.active {
              color: #ffffff;
              background-color: #1a1d24;
              padding-left: 24px;

              i { color: #870000; }
            }
          }
        }

       
        .badge-link {
          position: relative;
          display: flex;
          align-items: center;
          justify-content: space-between;

          a { width: 75%; }
          
          img {
            width: 46px;
            height: 22px;
            object-fit: cover;
            border-radius: 2px;
            margin-right: 20px;
            border: 1px solid #232832;
            pointer-events: none;
          }
        }

       
        .admin-panel-link {
          border-top: 1px solid #1a1d24;
          margin-top: 6px;
          padding-top: 6px;
          
          a i { color: rgba(135, 0, 0, 0.6); }
          a:hover i { color: #ff0000; }
        }
      }
    }
  }

  /* BOTÓN HAMBURGUESA VECTORIAL */
  .menu-toggle {
    display: none;
    background: none;
    border: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    cursor: pointer;
    padding: 0;

    .bar {
      width: 100%;
      height: 2px;
      background-color: #ffffff;
      border-radius: 2px;
      transition: all 0.25s ease;
    }

    
    &.open {
      .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
      .bar:nth-child(2) { opacity: 0; }
      .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
    }
  }
}

@keyframes banderaWave {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* RESPONSIVE DESIGN (BREAKPOINT NBA ESTÁNDAR) */
@media screen and (max-width: 992px) {
  .nba-header {
    .navbar {
      height: 64px;
      padding: 0 20px;
    }

    .brand-group .animated-logo {
      font-size: 1.25rem;
    }

    .menu-toggle {
      display: flex;
    }

    .nav-links {
      position: absolute;
      top: 64px;
      left: 0;
      width: 100%;
      height: calc(100vh - 64px);
      background-color: #0c0d10;
      border-top: 1px solid #1a1d24;
      flex-direction: column;
      align-items: flex-start;
      justify-content: flex-start;
      gap: 0;
      padding: 20px;
      box-sizing: border-box;
      display: none; /* Oculto por defecto */

      &.active {
        display: flex;
      }

      li {
        width: 100%;
        height: auto;
        display: block;

        & > a {
          padding: 16px 10px;
          width: 100%;
          box-sizing: border-box;
          border-bottom: 1px solid #14171c;

          &::after { display: none; } /* Remover efectos de línea base en móviles */
        }
      }

      /* Reajuste del Dropdown en Móviles para que se despliegue hacia abajo continuamente */
      .mas-container {
        width: 100%;

        .mas-links {
          position: static;
          width: 100%;
          opacity: 1;
          visibility: visible;
          transform: none;
          box-shadow: none;
          background-color: #111317;
          border: none;
          padding: 0 0 0 20px;
          max-height: 0;
          overflow: hidden;
          transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
        }

        &:hover .mas-links, &:focus-within .mas-links {
          max-height: 500px; /* Permite una transición fluida hacia abajo */
        }
        
        .mas-btn .arrow-icon {
          margin-left: auto; /* Empuja la flecha hacia el extremo derecho */
        }
      }
    }
  }
}