/* ============================================================
   cjv2-header.css — Header v2 CloudJersey
   Mobile-first. Prefijo: cjv2-
   ============================================================ */

/* === VARIABLES === */
:root {
  --cjv2-hdr-h:      60px;
  --cjv2-ob-h:       0px;  /* sobreescrito por PHP cuando oferta_activa = true */
  --cjv2-hdr-bg:     #fff;
  --cjv2-hdr-border: #e3e7f2;
  --cjv2-blue:       #002041;
  --cjv2-blue-light: rgba(0, 32, 65, 0.06);
  --cjv2-text:       #1a1a1a;
  --cjv2-muted:      #6b7280;
  --cjv2-radius:     8px;
  --cjv2-shadow:     0 4px 24px rgba(0, 0, 0, 0.10);
}

/* === SAFETY NET: ocultar el header de Astra si quedó vacío === */
header#masthead {
  display: none !important;
}

/* === BODY OFFSET === */
body {
  padding-top: calc(var(--cjv2-hdr-h) + var(--cjv2-ob-h)) !important;
}
body.admin-bar {
  padding-top: calc(var(--cjv2-hdr-h) + var(--cjv2-ob-h)) !important;
}

/* === OFFER BAR === */
.cjv2-offerbar {
  height: 40px;
  background: linear-gradient(90deg, #001628 0%, #002a50 50%, #001628 100%);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  overflow: hidden;
  flex-shrink: 0;
}
.cjv2-offerbar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}
.cjv2-ob-badge {
  background: #f59e0b;
  color: #000;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 2px 10px;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
}
.cjv2-ob-msg {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cjv2-ob-countdown {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.cjv2-ob-unit {
  display: flex;
  align-items: baseline;
  gap: 1px;
}
.cjv2-ob-unit b {
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f59e0b;
  min-width: 1.6ch;
  text-align: right;
}
.cjv2-ob-unit small {
  font-size: 0.6rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cjv2-ob-sep {
  color: #334155;
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
  margin: 0 1px;
  user-select: none;
}
@media (max-width: 479px) {
  .cjv2-ob-countdown { display: none; }
}

/* === LOGO === */
.cjv2-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  text-decoration: none;
}
.cjv2-logo-img {
  height: 30px !important;
  width: auto;
  display: block;
}
.cjv2-logo-text {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--cjv2-blue);
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

/* === BUSCADOR === */
.cjv2-search {
    flex: 1;
    display: flex;
    align-items: center;
    max-width: 480px;
    height: 30px;
    border: 1.5px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.18s, background 0.18s;
    gap: 0;
}
.cjv2-search:focus-within {
  background: #fff;
  border-color: #bbbbbb;
}
input.cjv2-search-input{
    border: none;
    background: #fdfdfd;
    padding: 12px 10px;
}

.cjv2-search-icon {
  display: none !important;
  flex-shrink: 0;
  align-items: center;
  padding: 0 8px 0 14px;
  color: #9ca3af;
  pointer-events: none;
}
.cjv2-search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.875rem;
  color: var(--cjv2-text);
  min-width: 0;
  padding: 0 12px 0 0;
  -webkit-appearance: none;
}
.cjv2-search-input::placeholder {
  color: #9ca3af;
}
.cjv2-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Lupa derecha del buscador */
.cjv2-search-submit {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 100%;
  background: none;
  border: none;
  border-left: 1px solid #e5e5e5;
  cursor: pointer;
  color: #6b7280;
  transition: color 0.15s;
  padding: 0 8px;
}
.cjv2-search-submit:hover {
  color: var(--cjv2-blue);
}

/* === NAV DESKTOP === */
.cjv2-nav {
  display: none; /* oculto en mobile */
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
@media (min-width: 1024px) {
  .cjv2-nav { display: flex; }
}

.cjv2-nav-btn {
  display: flex;
  align-items: center;
  box-shadow: none !important;
  gap: 5px;
  padding: 8px 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--cjv2-text);
  background: none !important;
  border: none;
  border-radius: var(--cjv2-radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.cjv2-nav-btn:hover,
.cjv2-nav-btn.is-active {
  color: var(--cjv2-blue);
}
.cjv2-nav-arrow {
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
}
.cjv2-nav-btn.is-active .cjv2-nav-arrow {
  transform: rotate(180deg);
}

/* === ACTIONS (cuenta + carrito) === */
.cjv2-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 16px;
}

#cjv2-header > div > div > a.cjv2-cart-btn{
    border: none;
}

/* Estilo pill unificado para ambos botones — override del header.css original */
.cjv2-actions .cj-login-btn,
.cjv2-actions .cj-account-btn,
.cjv2-cart-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 3px 12px;
    height: 28px;
    border: 1.5px solid #d1d5db;
    border-radius: 100px;
    background: #fff;
    color: #001c39 !important;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    box-sizing: border-box;
}
.cjv2-actions .cj-login-btn:hover,
.cjv2-actions .cj-account-btn:hover,
.cjv2-cart-btn:hover {
  border-color: var(--cjv2-blue);
  color: var(--cjv2-blue);
  background: var(--cjv2-blue-light);
}

#cjv2-header > div > div > a.cj-account-btn > span{
    font-weight: 700;
}

/* Icono SVG dentro del botón de cuenta */
.cjv2-actions .cj-ico {
  width: 15px;
  height: 15px;
  display: inline-block;
  flex-shrink: 0;
}

/* Icono + badge del carrito */
.cjv2-cart-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.cjv2-cart-count {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  background: var(--cjv2-blue);
  color: #fff;
  border-radius: 100px;
  box-sizing: border-box;
}

/* === HAMBURGER (mobile) — fixed bottom-right === */
.cjv2-hamburger {
  display: none; /* oculto en desktop */
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: #e7e9eb;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--cjv2-blue);
  box-shadow: 0 0 20px rgba(0,0,0,0.25);
  position: fixed;
  bottom: 3rem;
  right: 2rem;
  z-index: 99999;
  transition: background 0.2s ease, color 0.2s ease;
}
.cjv2-hamburger:hover {
  background: #d1d5db;
}
@media (max-width: 1023px) {
  .cjv2-hamburger { display: flex; }
}

/* Iconos dentro del botón flotante */
.cjv2-ham-icon,
.cjv2-close-icon {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}
.cjv2-close-icon { display: none; }

/* === HAMBURGUESA — menú mobile abierto === */
.cjv2-hamburger.is-active {
  background: #dc2626;
  color: #fff;
}
.cjv2-hamburger.is-active .cjv2-ham-icon   { display: none; }
.cjv2-hamburger.is-active .cjv2-close-icon { display: block; }

/* ============================================================
   MEGAMENÚ DESKTOP
   ============================================================ */

.cjv2-mega {
  position: fixed;
  top: calc(var(--cjv2-hdr-h) + var(--cjv2-ob-h));
  left: 0;
  right: 0;
  z-index: 9998;
  background: #fff;
  border-top: 1px solid var(--cjv2-hdr-border);
  box-shadow: var(--cjv2-shadow);
  display: none;
  max-height: calc(100vh - var(--cjv2-hdr-h) - var(--cjv2-ob-h));
  overflow-y: auto;
}
.cjv2-mega.is-open {
  display: block;
}
.admin-bar .cjv2-mega {
  top: calc(var(--cjv2-hdr-h) + var(--cjv2-ob-h) + 32px);
}

.cjv2-mega-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 20px;
}

/* --- TABS DE LIGAS --- */
.cjv2-liga-tabs-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--cjv2-hdr-border);
  margin-bottom: 16px;
}
.cjv2-liga-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 12px 0;
  flex: 1;
}
.cjv2-liga-tabs::-webkit-scrollbar {
  display: none;
}

.cjv2-liga-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.cjv2-liga-tab:hover {
  border-color: var(--cjv2-blue);
  color: var(--cjv2-blue);
  background: var(--cjv2-blue-light);
}
.cjv2-liga-tab.is-active {
  border-color: var(--cjv2-blue);
  color: var(--cjv2-blue);
  background: var(--cjv2-blue-light);
}
.cjv2-liga-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}

/* Flecha scroll derecha */
.cjv2-scroll-arrow {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  color: var(--cjv2-text);
  margin-left: 6px;
  transition: background 0.15s;
}
.cjv2-scroll-arrow:hover {
  background: var(--cjv2-blue-light);
}
.cjv2-scroll-arrow[hidden] {
  display: none;
}

/* --- GRID DE EQUIPOS --- */
.cjv2-teams-area {
  min-height: 80px;
}
.cjv2-teams-grid {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.cjv2-teams-grid.is-active {
  display: grid;
}

.cjv2-team-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  height: 44px;
  border-radius: var(--cjv2-radius);
  text-decoration: none;
  color: var(--cjv2-text);
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.12s;
  overflow: hidden;
}
.cjv2-team-card:hover {
  background: var(--cjv2-blue-light);
  color: var(--cjv2-blue);
}
.cjv2-team-shield {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}
.cjv2-team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- GRID NACIONALES (5 cols) --- */
.cjv2-national-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: 8px 0;
}

/* --- MEGAMENÚ JUGADORES (tabs país + grid) --- */
/* Reutiliza .cjv2-liga-tabs-wrap, .cjv2-liga-tab, .cjv2-teams-grid */
.cjv2-player-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  height: 44px;
  border-radius: var(--cjv2-radius);
  text-decoration: none;
  color: var(--cjv2-text);
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.12s;
}
.cjv2-player-card:hover {
  background: var(--cjv2-blue-light);
  color: var(--cjv2-blue);
}
.cjv2-player-photo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.cjv2-player-flag {
  width: 16px;
  height: 11px;
  object-fit: cover;
  flex-shrink: 0;
}
.cjv2-players-grid {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 8px 0;
}
.cjv2-players-grid.is-active {
  display: grid;
}

/* ============================================================
   RESPONSIVE MOBILE — Header
   ============================================================ */
@media (max-width: 1023px) {
  /* Ocultar nav desktop */
  .cjv2-nav { display: none !important; }

  /* Buscador: crece todo lo posible, sin encogerse */
  .cjv2-search {
    max-width: none;
    flex: 1 1 0;
    min-width: 0;
  }

  /* Iconos más juntos */
  .cjv2-actions {
    gap: 0;
    margin-left: 4px;
  }

  /* Botones de cuenta y carrito: solo icono (sin texto, sin borde) */
  .cjv2-actions .cj-login-btn,
  .cjv2-actions .cj-account-btn,
  .cjv2-cart-btn {
    padding: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    border-radius: 50%;
    justify-content: center;
  }
  .cjv2-actions .cj-login-btn:hover,
  .cjv2-actions .cj-account-btn:hover,
  .cjv2-cart-btn:hover {
    background: var(--cjv2-blue-light);
    border: none;
  }
  /* Ocultar textos */
  .cjv2-actions .cj-text,
  .cjv2-cart-label {
    display: none;
  }
  /* Icono SVG de cuenta en mobile */
  .cjv2-actions .cj-ico {
    width: 20px;
    height: 20px;
    margin-right: 0;
  }
}

/* ============================================================
   MOBILE — megamenú no se muestra en mobile
   ============================================================ */
@media (max-width: 1023px) {
  .cjv2-mega { display: none !important; }
}

/* ============================================================
   WooCommerce cart fragments — mantener el contador actualizado
   ============================================================ */
.cjv2-cart-count {
  /* La clase es target de woocommerce_add_to_cart_fragments */
}
