/* ============================================================
   MINIVOLEY ONLINE — VISTA ESPECTADOR · DISEÑO RENOVADO
   Autor: Claude · Sustituye sport-specific/minivoley-online.css
   ============================================================ */

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

/* ── VARIABLES (heredadas del tema minivoley, reforzadas) ──── */
body.theme-minivoley {
  --c-local:       #ff4757;
  --c-visitor:     #1e90ff;
  --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%),
    linear-gradient(160deg, #07091c 0%, #0d0a28 40%, #100c30 100%);
  min-height: 100vh;
  margin: 0;
  padding: 15px;
  color: #f0f4ff;
}

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

.header-bg-image {
  opacity: 0.35;
  filter: brightness(0.55) saturate(1.2);
}

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

.header-left .subtitle {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.8);
}

/* ── 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% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(0.7); opacity: 0.6; }
}

/* ── CURRENT SET INFO ──────────────────────────────────────── */
.current-set-info-minivoley {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 10px;
  padding: 9px 14px;
  margin-bottom: 14px;
  font-size: 0.86rem;
  color: rgba(255,255,255,0.75);
  text-align: center;
  backdrop-filter: blur(8px);
}

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

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

.team-minivoley {
  flex: 1;
  border-radius: 18px;
  padding: 20px 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  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);
}

/* Borde superior coloreado */
.team-minivoley#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-minivoley#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-minivoley#team1 {
  background: linear-gradient(160deg, rgba(255,71,87,0.07) 0%, rgba(255,255,255,0.02) 60%);
}

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

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

.score-minivoley {
  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;
}

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

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

/* Animación al actualizar el score */
@keyframes scoreFlash {
  0%   { transform: scale(1.3); opacity: 0.7; }
  100% { transform: scale(1);   opacity: 1; }
}

.score-minivoley.updated {
  animation: scoreFlash 0.4s ease-out;
}

/* Sets container */
.sets-container-minivoley {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0 6px;
  min-height: 24px;
}

.set-minivoley {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(240,244,255,0.4);
  transition: all 0.3s;
}

.set-minivoley.won {
  background: rgba(255,215,0,0.18);
  border-color: #ffd700;
  color: #ffd700;
  box-shadow: 0 0 8px rgba(255,215,0,0.3);
}

/* Ocultar controles en modo solo-lectura */
.score-controls,
.match-controls,
.input-group button,
.btn-new-set,
.btn-reset,
.btn-save {
  display: none !important;
}

.editable {
  pointer-events: none;
}

/* ── ESTADO MATCH ──────────────────────────────────────────── */
#match-status {
  color: #2ecc71;
  font-weight: 700;
}

#match-location-display {
  color: #ffd700;
  font-weight: 600;
}

/* ── HISTORIAL DE EVENTOS ──────────────────────────────────── */
.history-section {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 12px 0;
  backdrop-filter: blur(10px);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.history-header h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(240,244,255,0.45);
  display: flex;
  align-items: center;
  gap: 7px;
}

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

.history-list {
  max-height: 190px;
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(155,89,182,0.4) transparent;
}

.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-thumb {
  background: rgba(155,89,182,0.4);
  border-radius: 4px;
}

.history-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  font-size: 0.82rem;
  color: rgba(240,244,255,0.75);
  border-left: 2px solid transparent;
  animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.history-item.point { border-left-color: rgba(30,144,255,0.5); }
.history-item.set   {
  border-left-color: #ffd700;
  background: rgba(255,215,0,0.06);
}
.history-item.match {
  border-left-color: #ff4757;
  background: rgba(255,71,87,0.07);
}

.history-time {
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.06em;
  color: rgba(240,244,255,0.35);
  font-size: 0.75rem;
  margin-right: 10px;
  min-width: 42px;
  flex-shrink: 0;
}

.history-content strong { color: #f0f4ff; }

/* ── GRÁFICA ───────────────────────────────────────────────── */
.chart-section {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 12px 0;
  backdrop-filter: blur(10px);
}

.chart-section .history-header h3 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(240,244,255,0.45);
}

.chart-section .history-header h3 i {
  color: #1e90ff;
}

.chart-container {
  position: relative;
  height: 220px;
  width: 100%;
}

/* ── COMPARTIR ─────────────────────────────────────────────── */
.control-group {
  background: none;
  border: none;
  padding: 0;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.control-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(240,244,255,0.3);
  margin-bottom: 10px;
  background: none;
  border-radius: 0;
  padding: 0;
  width: auto;
}

.export-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 75px;
  height: 75px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1) !important;
  cursor: pointer;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  gap: 6px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.btn-icon i { font-size: 1.35rem; margin: 0; }

.btn-icon:hover {
  transform: translateY(-3px) scale(1.03);
  border-color: rgba(255,255,255,0.22) !important;
}

.btn-icon::after { display: none; }

.btn-whatsapp {
  background: linear-gradient(145deg, #0e7736, #25d366);
  box-shadow: 0 4px 14px rgba(37,211,102,0.3);
}

.btn-share-current {
  background: linear-gradient(145deg, #6c3483, #9b59b6);
  box-shadow: 0 4px 14px rgba(155,89,182,0.3);
}

/* Share result text button */
#share-result-text {
  background: linear-gradient(145deg, #4a1476, #9b59b6) !important;
}

/* ── TOAST NOTIFICATIONS ───────────────────────────────────── */
.toast-notification {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: rgba(15, 12, 40, 0.92);
  color: #f0f4ff;
  padding: 12px 22px;
  border-radius: 50px;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  z-index: 1002;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease, bottom 0.35s ease, transform 0.35s ease;
  backdrop-filter: blur(16px);
  white-space: nowrap;
}

.toast-notification.show {
  opacity: 1;
  visibility: visible;
  bottom: 40px;
  transform: translateX(-50%) translateY(0);
}

.toast-notification i {
  font-size: 1.1rem;
  color: #ffd700;
}

/* Mensaje del host (naranja) */
.toast-notification.host-message {
  background: linear-gradient(135deg, rgba(180,80,0,0.92), rgba(230,126,34,0.92));
  border-color: rgba(243,156,18,0.35);
  color: #fff;
  bottom: 90px;
}

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

/* ── OVERLAY RESULTADO FINAL ───────────────────────────────── */
.final-summary-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(14px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s, visibility 0.45s;
}

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

.final-card {
  background: linear-gradient(160deg, #141030, #0d0a28);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 40px 36px;
  border-radius: 22px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  max-width: 90%;
  width: 400px;
  color: #f0f4ff;
  transform: scale(0.8);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.final-card h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(240,244,255,0.6);
  margin-bottom: 18px;
}

.final-card h2 i { color: #ffd700; }

.final-winner {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  letter-spacing: 0.06em;
  color: #fff;
  margin: 12px 0;
  padding: 12px 20px;
  background: rgba(255,215,0,0.1);
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 12px;
}

.final-score {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 4.5rem;
  letter-spacing: 0.06em;
  color: #ffd700;
  margin: 8px 0;
  filter: drop-shadow(0 0 16px rgba(255,215,0,0.4));
}

.final-card .btn-primary {
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
  border: none;
  border-radius: 50px;
  color: #fff;
  padding: 12px 30px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s;
}

.final-card .btn-primary:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 20px rgba(155,89,182,0.45);
}

/* ── VISTA LANDING (introducción de ID) ────────────────────── */
.landing-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
  text-align: center;
}

.landing-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.11);
  padding: 36px 32px;
  border-radius: 20px;
  backdrop-filter: blur(20px);
  max-width: 480px;
  width: 92%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.45);
}

.landing-card h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.landing-card h2 i {
  color: #ffd700;
}

.landing-card p {
  color: rgba(240,244,255,0.6);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 4px;
}

.input-group-landing {
  display: flex;
  gap: 8px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.input-group-landing input {
  flex: 1;
  min-width: 180px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: #f0f4ff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.input-group-landing input::placeholder {
  color: rgba(240,244,255,0.35);
}

.input-group-landing input:focus {
  outline: none;
  border-color: rgba(155,89,182,0.55);
  box-shadow: 0 0 0 3px rgba(155,89,182,0.18);
}

#btn-connect {
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #7d3c98, #9b59b6);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

#btn-connect:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(155,89,182,0.45);
}

.landing-note {
  font-size: 0.78rem;
  color: rgba(240,244,255,0.38);
  margin-top: 14px;
}

.landing-note i { color: rgba(240,244,255,0.5); }

/* ── BOTÓN TEMA ────────────────────────────────────────────── */
.theme-toggle-btn {
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  color: rgba(240,244,255,0.7);
  backdrop-filter: blur(10px);
  transition: background 0.2s, transform 0.2s;
}

.theme-toggle-btn:hover {
  background: rgba(155,89,182,0.35);
  transform: scale(1.08);
}

/* ── MODO CLARO ────────────────────────────────────────────── */
body.light-mode {
  background: linear-gradient(160deg, #f0f2f9 0%, #dde4f5 100%) !important;
  color: #1a1a2e;
}

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

body.light-mode .score-minivoley {
  /* colores se mantienen, solo eliminamos el drop-shadow oscuro */
}

body.light-mode .team-minivoley#team1 {
  background: linear-gradient(160deg, rgba(255,71,87,0.06) 0%, rgba(255,255,255,0.9) 60%);
}

body.light-mode .team-minivoley#team2 {
  background: linear-gradient(160deg, rgba(30,144,255,0.06) 0%, rgba(255,255,255,0.9) 60%);
}

body.light-mode .team-name-minivoley {
  color: rgba(30,20,60,0.55);
}

body.light-mode .current-set-info-minivoley {
  background: rgba(255,255,255,0.8);
  border-color: rgba(0,0,0,0.08);
  color: #2c3e50;
}

body.light-mode .history-section,
body.light-mode .chart-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: rgba(30,20,60,0.5);
}

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

body.light-mode .history-time {
  color: rgba(30,20,60,0.35);
}

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

body.light-mode .control-group-label {
  color: rgba(30,20,60,0.35);
}

body.light-mode .landing-card {
  background: rgba(255,255,255,0.85);
  border-color: rgba(0,0,0,0.08);
}

body.light-mode .landing-card h2 { color: #1a1a2e; }
body.light-mode .landing-card p  { color: rgba(30,20,60,0.55); }

body.light-mode .input-group-landing input {
  background: rgba(255,255,255,0.9);
  border-color: rgba(0,0,0,0.12);
  color: #1a1a2e;
}

body.light-mode .toast-notification {
  background: rgba(255,255,255,0.92);
  color: #1a1a2e;
  border-color: rgba(0,0,0,0.1);
}

body.light-mode .toast-notification i { color: #9b59b6; }

body.light-mode .theme-toggle-btn {
  background: rgba(255,255,255,0.8);
  color: #f39c12;
  border-color: rgba(0,0,0,0.1);
}

/* ── BOTÓN DE RECONEXIÓN ───────────────────────────────────── */
.btn-reconnect {
  background: rgba(155,89,182,0.2);
  border: 1px solid rgba(155,89,182,0.35);
  color: rgba(240,244,255,0.8);
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  cursor: pointer;
  margin-left: 8px;
  transition: background 0.2s;
  font-family: 'Outfit', sans-serif;
}

.btn-reconnect:hover {
  background: rgba(155,89,182,0.4);
}

/* ── FOOTER ────────────────────────────────────────────────── */
footer {
  text-align: center;
  margin-top: 24px;
  padding: 16px;
  color: rgba(240,244,255,0.28);
  font-size: 0.76rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

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

  .scoreboard-minivoley { gap: 8px; }

  .score-minivoley {
    font-size: clamp(5.5rem, 26vw, 9rem) !important;
  }

  .toast-notification { white-space: normal; text-align: center; }

  .btn-icon {
    min-width: 65px;
    height: 65px;
    font-size: 0.65rem;
  }
}

/* Landscape — marcador gigante */
@media (max-width: 900px) and (orientation: landscape) {
  body { padding: 5px; }

  .app-header,
  .control-group,
  footer,
  .floating-home-btn { display: none !important; }

  .scoreboard-minivoley {
    height: 88vh;
    margin: 0;
    align-items: stretch;
  }

  .team-minivoley {
    height: 100%;
    justify-content: center;
    border-radius: 12px;
  }

  .score-minivoley {
    font-size: clamp(6rem, 18vh, 12rem) !important;
  }

  .current-set-info-minivoley {
    margin-bottom: 6px;
    padding: 5px 10px;
    font-size: 0.78rem;
  }
}

/* ── HIDDEN UTILITY ────────────────────────────────────────── */
.hidden { display: none !important; }
