/* ==========================================================================
   RESET BÁSICO Y REGLAS GENERALES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: #f8fafc;
}

/* ==========================================================================
   HEADER PRINCIPAL
   ========================================================================== */
.main-header {
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 60px;
  width: 100%;
}

/* ==========================================================================
   1. ESTILOS DEL LOGO
   ========================================================================== */
.logo-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  user-select: none;
  padding: 2px 4px;
  border-radius: 8px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  flex-shrink: 0;
}

.logo-container:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.flag-icon {
  display: flex;
  width: 30px;
  height: 20px;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.stripe {
  flex: 1;
  height: 100%;
  position: relative;
}

.stripe.green { 
  background-color: #006847; 
}

.stripe.white { 
  background-color: #ffffff; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
}

.stripe.red { 
  background-color: #CE1126; 
}

.eagle-symbol {
  width: 9px;
  height: 9px;
}

.logo-text {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  white-space: nowrap;
}

.text-green { color: #006847; }
.text-white { color: #1a1a1a; }
.text-red   { color: #CE1126; }

/* ==========================================================================
   2. MENÚ DE NAVEGACIÓN (DESKTOP POR DEFECTO)
   ========================================================================== */
.hamburger-btn {
  display: none; /* Oculto en PC */
}

.menu-overlay,
.menu-header {
  display: none;
}

.nav-menu {
  display: flex;
  align-items: center;
}

.menu-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 16px;
}

.menu-links li a {
  text-decoration: none;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 600;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.menu-links li a:hover {
  color: #006847;
}

.menu-divider-vertical {
  width: 1px;
  height: 16px;
  background-color: #cbd5e1;
}

/* ==========================================================================
   3. BLOQUE DERECHO: CONTADOR COMPACTO + BOTÓN CHAT AL LADO
   ========================================================================== */
.header-right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

/* --- Contador de Usuarios (Ultra Compacto) --- */
.live-activity-card {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #f1f5f9;
  padding: 4px 8px;
  border-radius: 50px;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
  user-select: none;
}

.activity-header {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: #10b981;
  border-radius: 50%;
  position: relative;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  width: 12px;
  height: 12px;
  background-color: rgba(16, 185, 129, 0.4);
  border-radius: 50%;
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.activity-title {
  font-size: 0.58rem;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.5px;
}

.activity-body {
  display: flex;
  align-items: center;
  gap: 3px;
}

.counter-number {
  font-size: 0.82rem;
  font-weight: 800;
  color: #0f172a;
  transition: opacity 0.3s ease;
}

.counter-number.updating {
  opacity: 0.2;
}

.counter-label {
  font-size: 0.7rem;
  color: #006847;
  font-weight: 700;
}

/* --- Botón "Entrar al Chat" --- */
.btn-header-chat {
  background: linear-gradient(135deg, #006847, #00965e);
  color: #ffffff;
  padding: 5px 10px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  text-decoration: none;
  border: 1.5px solid #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 104, 71, 0.3);
  transition: transform 0.2s ease, background 0.2s ease;
  animation: blink-btn 1.5s infinite ease-in-out;
}

.btn-header-chat:hover {
  transform: scale(1.04);
  background: linear-gradient(135deg, #ce1126, #e62238);
  box-shadow: 0 4px 10px rgba(206, 17, 38, 0.4);
}

@keyframes blink-btn {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 6px rgba(0, 104, 71, 0.6);
  }
  50% {
    opacity: 0.75;
    box-shadow: 0 0 12px rgba(206, 17, 38, 0.8);
  }
}

/* ==========================================================================
   4. MODAL DEL CHAT
   ========================================================================== */
.chat-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  justify-content: center;
  align-items: center;
}

.chat-modal-overlay.active {
  display: flex;
}

.chat-modal-container {
  width: 98vw;
  height: 85vh;
  background-color: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.chat-modal-header {
  background-color: #111111;
  color: #ffffff;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-modal-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.btn-close-chat {
  background: #ce1126;
  color: #ffffff;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.8rem;
}

.chat-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ==========================================================================
   5. ADAPTACIÓN RESPONSIVA (MÓVILES Y TABLETS)
   ========================================================================== */
@media (max-width: 1023px) {
  .hamburger-btn {
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 100001;
    flex-shrink: 0;
  }

  .hamburger-line {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #0f172a;
    border-radius: 2px;
  }

  .menu-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99998;
  }

  .menu-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100vh;
    background-color: #ffffff;
    z-index: 99999;
    transition: left 0.3s ease;
    flex-direction: column;
    align-items: flex-start;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.15);
  }

  .nav-menu.active {
    left: 0;
  }

  .menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
  }

  .menu-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
  }

  .close-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: #64748b;
    cursor: pointer;
  }

  .menu-links {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 12px 0;
    gap: 0;
  }

  .menu-links li {
    width: 100%;
  }

  .menu-links li a {
    display: block;
    padding: 12px 20px;
    width: 100%;
  }

  .menu-divider-vertical {
    width: 90%;
    height: 1px;
    margin: 8px auto;
  }
}

/* Optimización extra para celulares pequeños Y modo horizontal (landscape) */
@media (max-width: 768px), (max-height: 500px) {
  .header-container {
    padding: 4px 8px;
    gap: 6px;
    min-height: 50px;
  }

  .logo-text {
    font-size: 0.95rem;
  }

  .flag-icon {
    width: 24px;
    height: 16px;
  }

  .header-right-actions {
    gap: 4px;
  }

  .live-activity-card {
    padding: 2px 6px;
    gap: 4px;
  }

  .activity-title {
    display: none;
  }

  .counter-number {
    font-size: 0.75rem;
  }

  .counter-label {
    font-size: 0.65rem;
  }

  .btn-header-chat {
    font-size: 0.68rem;
    padding: 3px 6px;
    gap: 2px;
    border-width: 1px;
  }

  .btn-header-chat svg {
    display: none !important;
  }
}

/* Hero Section & Nick Access */
.hero-section {
  padding: 40px 20px 20px 20px;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

.hero-section h1 {
  font-size: 1.8rem;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: #555;
  margin-bottom: 25px;
}

.chat-access-card {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  max-width: 500px;
  margin: 0 auto;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.nick-label {
  display: block;
  text-align: left;
  font-weight: bold;
  margin-bottom: 8px;
  color: #333;
}

.input-group {
  display: flex;
  gap: 10px;
}

.input-group input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  outline: none;
}

.input-group input:focus {
  border-color: #006847;
}

.btn-primary-chat {
  background: #006847;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.btn-primary-chat:hover {
  background: #004d34;
}

/* Embedded Chat Section */
.embedded-chat-section {
  display: none; 
  width: 100%;
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 15px;
}

.chat-wrapper {
  width: 100%;
  height: 650px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  background: #fff;
}

.inline-chat-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

@media (max-width: 600px) {
  .input-group {
    flex-direction: column;
  }
  .chat-wrapper {
    height: 550px;
  }
}

/* Ocultar elementos cuando el chat está activo */
body.chat-active > *:not(#chat-section):not(#main-footer) {
  display: none !important;
}