/* ============================================================
   VOLEIBOL ONLINE — VISTA ESPECTADOR · DISEÑO RENOVADO
   Estilo Dark Glassmorphism para retransmisión en tiempo real
   Adaptado del estándar Minivoleibol para Voleibol (5 sets)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Outfit:wght@300;400;500;600;700&display=swap');

/* ── VARIABLES ─────────────────────────────────────────────── */
body.theme-voleibol {
  --c-local:       #ff4757;
  --c-local-glow:  rgba(255, 71, 87, 0.4);
  --c-visitor:     #1e90ff;
  --c-visitor-glow:rgba(30, 144, 255, 0.4);
  --c-gold:        #ffd700;
  --c-glass:       rgba(255, 255, 255, 0.05);
  --c-glass-border:rgba(255, 255, 255, 0.1);
  --c-text:        #f0f4ff;
  --c-muted:       rgba(240, 244, 255, 0.5);
  --font-display:  'Bebas Neue', sans-serif;
  --font-body:     'Outfit', 'Segoe UI', sans-serif;
}

/* ── BODY: SOLO LECTURA ────────────────────────────────────── */
body {
  font-family: 'Outfit', sans-serif;
  background:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(106, 17, 203, 0.3) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 85%, rgba(37, 117, 252, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(155, 89, 182, 0.1) 0%, transparent 60%),
    linear-gradient(160deg, #07091c 0%, #0d0a28 40%, #100c30 100%) !important;
  min-height: 100vh;
  margin: 0;
  padding: 15px;
  color: #f0f4ff;
}

/* ── HEADER ────────────────────────────────────────────────── */
.app-header {
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 16px;
  min-height: 110px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.07);
  position: relative;
}

.header-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
}

.header-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
  filter: brightness(0.55) saturate(1.2);
}

.header-content {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: linear-gradient(180deg, rgba(7, 9, 28, 0.4) 0%, rgba(7, 9, 28, 0.8) 100%);
}

.header-left h1 {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-left h1 i {
  color: #ffd700;
}

.header-left .subtitle {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 4px 0;
}

.game-rules-voleibol {
  font-size: 0.78rem;
  color: rgba(255, 215, 0, 0.85);
  margin: 2px 0 0 0;
}

/* ── ESTADO DE CONEXIÓN ────────────────────────────────────── */
.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: rgba(240, 244, 255, 0.7);
  backdrop-filter: blur(8px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(189, 195, 199, 0.6);
  box-shadow: 0 0 5px rgba(189, 195, 199, 0.3);
  flex-shrink: 0;
  transition: background 0.4s, box-shadow 0.4s;
}

.status-dot.good {
  background: #2ecc71;
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.8);
  animation: dotPulse 2s ease-in-out infinite;
}

.status-dot.laggy {
  background: #f39c12;
  box-shadow: 0 0 8px rgba(243, 156, 18, 0.7);
}

.status-dot.bad {
  background: #e74c3c;
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.7);
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}

/* ── BOTONES FLOTANTES ─────────────────────────────────────── */
.floating-home-btn,
.theme-toggle-btn {
  position: fixed;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 25, 45, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f0f4ff;
  font-size: 1.1rem;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.25s ease;
  text-decoration: none;
}

.floating-home-btn { top: 16px; left: 16px; }
.theme-toggle-btn  { top: 16px; right: 16px; }

.floating-home-btn:hover,
.theme-toggle-btn:hover {
  transform: translateY(-2px);
  background: rgba(30, 45, 75, 0.9);
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.4);
}

/* ── VISTA DE ENTRADA (LANDING) ────────────────────────────── */
.landing-view {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  padding: 20px 0;
}

.landing-card {
  max-width: 520px;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 36px 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.landing-card h2 {
  font-size: 1.6rem;
  margin-top: 0;
  margin-bottom: 12px;
  color: #ffd700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.landing-card p {
  color: rgba(240, 244, 255, 0.75);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.input-group-landing {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.input-group-landing input {
  flex: 1;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1rem;
  color: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group-landing input:focus {
  border-color: #1e90ff;
  box-shadow: 0 0 12px rgba(30, 144, 255, 0.3);
}

.input-group-landing .btn {
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  background: linear-gradient(135deg, #e53935 0%, #b71c1c 100%);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.input-group-landing .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(229, 57, 53, 0.4);
}

.landing-note {
  font-size: 0.8rem !important;
  color: rgba(240, 244, 255, 0.45) !important;
  margin-top: 14px;
  margin-bottom: 0 !important;
}

/* ── INFO SET ACTUAL ───────────────────────────────────────── */
.current-set-info-voleibol {
  text-align: center;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  color: rgba(240, 244, 255, 0.85);
}

.current-set-info-voleibol strong {
  color: #ffd700;
}

/* ── SCOREBOARD SOLO LECTURA ───────────────────────────────── */
.scoreboard-voleibol {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: stretch;
}

.team-voleibol {
  flex: 1;
  border-radius: 18px;
  padding: 20px 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;

  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  transition: opacity 0.2s ease;
}

/* Bordes superiores coloreados */
.team-voleibol#team1::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #ff4757, rgba(255, 71, 87, 0.3));
  border-radius: 18px 18px 0 0;
}

.team-voleibol#team2::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #1e90ff, rgba(30, 144, 255, 0.3));
  border-radius: 18px 18px 0 0;
}

.team-voleibol#team1 {
  background: linear-gradient(160deg, rgba(255, 71, 87, 0.07) 0%, rgba(255, 255, 255, 0.02) 60%);
}

.team-voleibol#team2 {
  background: linear-gradient(160deg, rgba(30, 144, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 60%);
}

.team-name-voleibol {
  font-size: clamp(0.85rem, 2vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(240, 244, 255, 0.7);
  text-align: center;
  padding: 4px 8px;
  margin-bottom: 6px;
  word-break: break-word;
  pointer-events: none;
}

.score-voleibol {
  font-family: 'Bebas Neue', sans-serif !important;
  font-size: clamp(6rem, 22vw, 11rem) !important;
  line-height: 1 !important;
  margin: 8px 0 !important;
  letter-spacing: 0.02em;
  user-select: none;
}

.team-voleibol#team1 .score-voleibol {
  color: #ff4757;
  filter: drop-shadow(0 0 20px rgba(255, 71, 87, 0.4));
}

.team-voleibol#team2 .score-voleibol {
  color: #1e90ff;
  filter: drop-shadow(0 0 20px rgba(30, 144, 255, 0.4));
}

/* Sets container */
.sets-container-voleibol {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
  min-height: 28px;
}

/* ── SECCIONES DE GRÁFICAS E HISTORIAL ─────────────────────── */
.chart-section,
.history-section {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 18px 20px;
  margin-bottom: 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.history-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-header h3 i {
  color: #ffd700;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 6px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 0 8px 8px 0;
  font-size: 0.86rem;
  animation: fadeIn 0.3s ease;
}

.history-item.point {
  border-left-color: #ffd700;
}

.history-item.set {
  border-left-color: #2ecc71;
  background: rgba(46, 204, 113, 0.08);
}

.history-item.match {
  border-left-color: #9b59b6;
  background: rgba(155, 89, 182, 0.12);
  font-weight: 600;
}

.history-item.host-message {
  border-left-color: #3498db;
  background: rgba(52, 152, 219, 0.1);
}

.history-time {
  font-size: 0.74rem;
  color: rgba(240, 244, 255, 0.45);
  font-family: monospace;
}

.history-content {
  color: rgba(240, 244, 255, 0.85);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── BOTONES DE COMPARTIR ──────────────────────────────────── */
.control-group {
  margin-bottom: 20px;
}

.control-group-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(240, 244, 255, 0.5);
  margin-bottom: 8px;
  text-align: center;
}

.export-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  border: none;
}

.btn-share-current {
  background: linear-gradient(135deg, #1e90ff 0%, #0050b3 100%);
  border: none;
}

/* ── TOAST NOTIFICATIONS ───────────────────────────────────── */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 25, 45, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 12px 24px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
  pointer-events: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.toast-notification i {
  color: #ffd700;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-notification.host-message {
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.95), rgba(15, 25, 45, 0.95));
  border-color: rgba(30, 144, 255, 0.4);
}

.toast-notification.host-message i {
  color: #fff;
}

/* ── RESUMEN FINAL (OVERLAY) ───────────────────────────────── */
.final-summary-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(7, 9, 28, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  padding: 20px;
}

.final-summary-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.final-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.15);
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.final-summary-overlay.active .final-card {
  transform: scale(1);
}

.final-card h2 {
  font-size: 1.8rem;
  color: #ffd700;
  margin-top: 0;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.final-winner {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin: 12px 0;
}

.final-score {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 4rem;
  color: #ffd700;
  line-height: 1;
  margin: 12px 0;
  letter-spacing: 0.05em;
}

.final-card p {
  color: rgba(240, 244, 255, 0.7);
  font-size: 0.9rem;
  margin: 0;
}

/* ── MODO CLARO ────────────────────────────────────────────── */
body.light-mode {
  background:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(200, 220, 255, 0.6) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 85%, rgba(255, 220, 220, 0.5) 0%, transparent 55%),
    linear-gradient(160deg, #eef2f7 0%, #e3e8f0 100%) !important;
  color: #2c3e50;
}

body.light-mode .app-header {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

body.light-mode .header-content {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.95) 100%);
}

body.light-mode .header-left h1 {
  color: #1a252f;
  text-shadow: none;
}

body.light-mode .header-left .subtitle {
  color: #555;
}

body.light-mode .team-voleibol {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

body.light-mode .team-name-voleibol {
  color: #2c3e50;
}

body.light-mode .current-set-info-voleibol,
body.light-mode .chart-section,
body.light-mode .history-section {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.08);
  color: #2c3e50;
}

body.light-mode .history-header h3 {
  color: #1a252f;
}

body.light-mode .history-item {
  background: rgba(0, 0, 0, 0.03);
  color: #2c3e50;
}

body.light-mode .history-content {
  color: #2c3e50;
}

body.light-mode .landing-card {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.1);
  color: #2c3e50;
}

body.light-mode .landing-card p {
  color: #555;
}

body.light-mode .input-group-landing input {
  background: #fff;
  border-color: #ccc;
  color: #2c3e50;
}

body.light-mode .connection-status {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.1);
  color: #2c3e50;
}

body.light-mode .floating-home-btn,
body.light-mode .theme-toggle-btn {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.1);
  color: #2c3e50;
}

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 600px) {
  body {
    padding: 10px;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
  }

  .scoreboard-voleibol {
    gap: 8px;
  }

  .team-voleibol {
    padding: 14px 8px 12px;
  }

  .score-voleibol {
    font-size: clamp(4.5rem, 18vw, 7rem) !important;
  }

  .input-group-landing {
    flex-direction: column;
  }

  .input-group-landing .btn {
    justify-content: center;
  }
}

.hidden {
  display: none !important;
}
