/* ==========================================================================
   TRONCAL LIVE - NETFLIX SPLASH INTRO & GOOGLE AUTHENTICATION GATE
   ========================================================================== */

/* --- 1. NETFLIX-STYLE SPLASH SCREEN OVERLAY --- */
#tl-netflix-splash {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-color: #05070a;
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.8s ease;
}

#tl-netflix-splash.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  display: none !important;
}

/* Rayas de luz / Ribbons cinematográficos estilo Netflix en Verde Caña y Rojo */
.tl-splash-ribbons {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(141, 174, 83, 0.18) 0%, rgba(211, 36, 36, 0.15) 30%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  animation: tl-ribbons-glow 2.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tl-ribbons-glow {
  0% {
    transform: scale(0.3) rotate(-15deg);
    opacity: 0;
  }
  35% {
    opacity: 0.9;
    transform: scale(1.1) rotate(0deg);
  }
  75% {
    opacity: 0.7;
    transform: scale(1.6) rotate(10deg);
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.tl-splash-logo-box {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: tl-netflix-logo-anim 2.6s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.tl-splash-logo-img {
  width: 320px;
  max-width: 80vw;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 30px rgba(141, 174, 83, 0.6)) drop-shadow(0 0 50px rgba(211, 36, 36, 0.5));
}

@keyframes tl-netflix-logo-anim {
  0% {
    transform: scale(0.5);
    opacity: 0;
    filter: blur(20px) brightness(0.2);
  }
  30% {
    transform: scale(1.05);
    opacity: 1;
    filter: blur(0px) brightness(1.2);
  }
  60% {
    transform: scale(1);
    opacity: 1;
    filter: blur(0px) brightness(1);
  }
  85% {
    transform: scale(1.3);
    opacity: 0.95;
    filter: brightness(1.6) drop-shadow(0 0 60px rgba(141, 174, 83, 0.9));
  }
  100% {
    transform: scale(2);
    opacity: 0;
    filter: blur(30px) brightness(2);
  }
}

.tl-splash-sound-hint {
  position: absolute;
  bottom: 40px;
  color: #64748b;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.7;
  animation: tl-pulse 1.5s infinite;
}

/* --- 2. GOOGLE LOGIN AUTHENTICATION GATE (ESTRICTO) --- */
#tl-auth-gate {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #06080b;
  background-image: 
    radial-gradient(circle at 50% 20%, rgba(141, 174, 83, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(211, 36, 36, 0.12) 0%, transparent 60%),
    linear-gradient(180deg, rgba(6, 8, 11, 0.85) 0%, #06080b 100%),
    url('https://images.unsplash.com/photo-1574375927938-d5a98e8ffe85?w=1600&auto=format&fit=crop&q=80');
  background-size: cover;
  background-position: center;
  backdrop-filter: blur(16px);
  padding: 20px;
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s ease;
}

#tl-auth-gate.is-authenticated {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.04);
}

body.auth-locked {
  overflow: hidden !important;
  height: 100vh !important;
}

/* Tarjeta Central Glassmorphism - Compacta y Responsiva */
.tl-auth-card {
  width: 100%;
  max-width: 400px;
  background: rgba(15, 19, 25, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--tl-border-hover);
  border-radius: var(--tl-radius-lg);
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(141, 174, 83, 0.12);
  animation: tl-auth-card-entrance 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tl-auth-card-entrance {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tl-auth-logo-wrap {
  margin-bottom: 12px;
}

.tl-auth-logo {
  height: 46px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}

.tl-auth-title {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.2px;
  margin-bottom: 4px;
}

.tl-auth-desc {
  font-size: 12.5px;
  color: var(--tl-text-secondary);
  line-height: 1.45;
  margin-bottom: 14px;
}

/* --- VERIFICACIÓN ANTI-BOT: CAPTCHA MATEMÁTICO COMPACTO & INLINE --- */
.tl-captcha-box {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(141, 174, 83, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 14px;
  text-align: left;
}

.tl-captcha-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.tl-captcha-title {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--tl-primary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tl-captcha-refresh-btn {
  background: transparent;
  border: none;
  color: var(--tl-text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 1px 4px;
  border-radius: 4px;
  transition: transform 0.2s ease, color 0.2s ease;
  line-height: 1;
}

.tl-captcha-refresh-btn:hover {
  color: #fff;
  transform: rotate(180deg);
}

.tl-captcha-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tl-captcha-display {
  background: #000;
  border: 1px dashed rgba(141, 174, 83, 0.6);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 1.5px;
  user-select: none;
  min-width: 85px;
  text-align: center;
  box-shadow: inset 0 0 6px rgba(141, 174, 83, 0.15);
  white-space: nowrap;
}

.tl-captcha-input {
  flex: 1;
  height: 32px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--tl-border);
  border-radius: 6px;
  color: #fff;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: var(--tl-transition);
  min-width: 60px;
}

.tl-captcha-input:focus {
  border-color: var(--tl-primary);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 8px var(--tl-primary-glow);
}

.tl-captcha-input.is-error {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
  animation: tl-shake 0.3s ease;
}

.tl-captcha-input.is-success {
  border-color: #22c55e !important;
  background: rgba(34, 197, 94, 0.1) !important;
}

.tl-captcha-feedback {
  font-size: 11px;
  margin-top: 4px;
  min-height: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.tl-captcha-feedback.is-error {
  color: #f87171;
}

.tl-captcha-feedback.is-success {
  color: #4ade80;
}

@keyframes tl-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Botón Oficial Google Sign-In */
.tl-google-signin-btn {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #ffffff;
  color: #1f2937;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--tl-radius-full);
  padding: 0 16px;
  cursor: pointer;
  border: none;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease, background-color 0.2s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.tl-google-signin-btn:hover {
  background: #f8fafc;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.25), 0 0 20px rgba(141, 174, 83, 0.3);
}

.tl-google-signin-btn:active {
  transform: translateY(0) scale(0.99);
}

.tl-google-g-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Indicador de Seguridad */
.tl-auth-security-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--tl-text-muted);
  font-size: 11px;
}

.tl-auth-security-notice svg {
  color: var(--tl-primary);
}

/* --- 3. PERFIL DE USUARIO LOGUEADO EN EL HEADER --- */
.tl-user-profile-menu {
  position: relative;
  display: inline-block;
}

.tl-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--tl-bg-card);
  border: 1px solid var(--tl-border);
  border-radius: var(--tl-radius-full);
  padding: 4px 14px 4px 5px;
  color: #fff;
  cursor: pointer;
  transition: var(--tl-transition);
}

.tl-user-btn:hover {
  border-color: var(--tl-primary);
  box-shadow: 0 0 12px var(--tl-primary-glow);
}

.tl-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--tl-primary);
}

.tl-user-name {
  font-size: 13px;
  font-weight: 700;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Menú Desplegable */
.tl-user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  background: var(--tl-bg-card);
  border: 1px solid var(--tl-border-hover);
  border-radius: var(--tl-radius-md);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.7);
  padding: 10px;
  z-index: 1000;
  display: none;
  animation: tl-slide-in-mini 0.2s ease forwards;
}

.tl-user-dropdown.is-open {
  display: block;
}

.tl-user-dropdown-info {
  padding: 8px 10px 12px;
  border-bottom: 1px solid var(--tl-border);
  margin-bottom: 8px;
}

.tl-user-email {
  font-size: 12px;
  color: var(--tl-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.tl-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: transparent;
  color: #f87171;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: var(--tl-transition);
}

.tl-logout-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

/* --- OPTIMIZACIÓN RESPONSIVA ULTRA-COMPACTA PARA MÓVILES (Evita desbordes) --- */
@media (max-width: 640px) {
  .tl-auth-gate {
    padding: 12px;
  }
  .tl-auth-card {
    max-width: 100%;
    padding: 18px 14px;
    border-radius: 14px;
  }
  .tl-auth-logo-wrap {
    margin-bottom: 8px;
  }
  .tl-auth-logo {
    height: 36px;
  }
  .tl-auth-title {
    font-size: 17px;
    margin-bottom: 2px;
  }
  .tl-auth-desc {
    font-size: 11.5px;
    margin-bottom: 10px;
    line-height: 1.35;
  }
  .tl-captcha-box {
    padding: 6px 8px;
    margin-bottom: 10px;
  }
  .tl-captcha-title {
    font-size: 9.5px;
  }
  .tl-captcha-display {
    padding: 4px 6px;
    font-size: 13px;
    min-width: 65px;
    letter-spacing: 1px;
  }
  .tl-captcha-input {
    height: 28px;
    font-size: 12px;
    padding: 2px 6px;
  }
  .tl-google-signin-btn {
    height: 38px;
    font-size: 13px;
    gap: 8px;
  }
  .tl-google-g-icon {
    width: 18px;
    height: 18px;
  }
  .tl-auth-security-notice {
    margin-top: 8px;
    font-size: 10px;
  }
}
