/* ============================================================
   ODRAF · Plataforma de Ligas Deportivas de Cundinamarca
   Sistema de diseño compartido
   ============================================================ */

:root{
  --azul: #0B5FCC;
  --azul-oscuro: #06306E;
  --azul-claro: #4FA8FF;
  --amarillo: #FFC72C;
  --rojo: #E4312B;
  --marino: #0A1E3D;
  --marino-2: #102a52;
  --texto: #16213E;
  --texto-suave: #5b6785;
  --borde: #e3e8f2;
  --blanco: #ffffff;
  --exito: #16a34a;
  --alerta: #d97706;
  --peligro: #dc2626;
  --radio: 16px;
  --sombra: 0 10px 30px rgba(10, 30, 61, 0.12);
  --sombra-lg: 0 20px 60px rgba(10, 30, 61, 0.25);
  --transicion: all .25s cubic-bezier(.4,0,.2,1);
}

*{ box-sizing: border-box; }

html,body{
  margin:0; padding:0;
  font-family: 'Segoe UI', 'Poppins', system-ui, -apple-system, Arial, sans-serif;
  color: var(--texto);
  background: var(--marino);
}

::selection{ background: var(--amarillo); color: var(--marino); }

/* ---------- Fondo animado institucional ---------- */
.fondo-animado{
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: radial-gradient(120% 120% at 10% 0%, #0e3a7a 0%, var(--marino) 55%), var(--marino);
}
.fondo-animado span{
  position:absolute; border-radius: 50%;
  filter: blur(60px); opacity:.35;
  animation: flotar 16s ease-in-out infinite;
}
.fondo-animado span:nth-child(1){ width:420px;height:420px; background:var(--azul); top:-100px; left:-100px; }
.fondo-animado span:nth-child(2){ width:340px;height:340px; background:var(--amarillo); bottom:-80px; right:-60px; animation-delay: -4s; opacity:.22;}
.fondo-animado span:nth-child(3){ width:300px;height:300px; background:var(--rojo); top:40%; right:10%; animation-delay: -9s; opacity:.18;}
.fondo-animado .franja{
  position:absolute; left:0; right:0; bottom:0; height:6px;
  background: linear-gradient(90deg, var(--azul-claro), var(--amarillo), var(--rojo));
}
@keyframes flotar{
  0%,100%{ transform: translate(0,0) scale(1); }
  50%{ transform: translate(30px,-30px) scale(1.08); }
}

/* ---------- Layout genérico ---------- */
.contenedor{ max-width: 1180px; margin: 0 auto; padding: 0 24px; }

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 16px 28px; color:#fff; position:relative; z-index:2;
}
.marca{ display:flex; align-items:center; gap:12px; }
.marca .logo-texto{ line-height:1.05; }
.marca .logo-texto b{ font-size:17px; letter-spacing:.5px; display:block;}
.marca .logo-texto small{ opacity:.75; font-size:11px; letter-spacing:.5px; text-transform:uppercase;}

.badge-inst{ display:flex; align-items:center; gap:8px; opacity:.85; font-size:12.5px; }
.badge-inst img{ height:28px; }

/* ---------- Tarjetas / Glass ---------- */
.card{
  background: var(--blanco);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  border: 1px solid var(--borde);
}
.glass{
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--radio);
  color: #fff;
}

/* ---------- Botones ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding: 13px 22px; border-radius: 12px; border:none; cursor:pointer;
  font-weight:600; font-size:14.5px; letter-spacing:.2px;
  transition: var(--transicion);
}
.btn-primario{ background: linear-gradient(135deg, var(--azul), var(--azul-oscuro)); color:#fff; box-shadow: 0 8px 20px rgba(11,95,204,.35);}
.btn-primario:hover{ transform: translateY(-2px); box-shadow: 0 12px 26px rgba(11,95,204,.45); }
.btn-secundario{ background:#fff; color: var(--azul); border: 1.5px solid var(--azul); }
.btn-secundario:hover{ background: rgba(11,95,204,.08); transform: translateY(-2px); }
.btn-amarillo{ background: linear-gradient(135deg, var(--amarillo), #e6a800); color: var(--marino);}
.btn-amarillo:hover{ transform: translateY(-2px); }
.btn-peligro{ background: #fee2e2; color: var(--peligro); }
.btn-peligro:hover{ background:#fecaca; }
.btn-ghost{ background:transparent; color:#fff; border:1.5px solid rgba(255,255,255,.4); }
.btn-ghost:hover{ background: rgba(255,255,255,.12); }
.btn-sm{ padding: 8px 14px; font-size:13px; border-radius: 9px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; transform:none !important; }
.btn-block{ width:100%; }

/* ---------- Formularios ---------- */
.form-group{ display:block; margin-bottom: 18px; position:relative; }
.form-group span.etiqueta{
  display:block; font-size: 12.5px; font-weight:600; color: var(--texto-suave);
  text-transform: uppercase; letter-spacing:.4px; margin-bottom:6px;
}
.form-control{
  width:100%; padding: 12px 14px; border-radius:10px;
  border: 1.5px solid var(--borde); font-size:14.5px; color: var(--texto);
  background:#fbfcff; transition: var(--transicion);
  font-family: inherit;
}
.form-control:focus{
  outline:none; border-color: var(--azul); background:#fff;
  box-shadow: 0 0 0 4px rgba(11,95,204,.12);
}
textarea.form-control{ resize: vertical; min-height: 80px; }
.ayuda{ font-size:12px; color: var(--texto-suave); margin-top:5px; display:block;}
.fila{ display:grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 0 20px; }

/* ---------- Badges de estado ---------- */
.pill{ display:inline-flex; align-items:center; gap:6px; padding: 5px 12px; border-radius:999px; font-size:12px; font-weight:700; letter-spacing:.3px; }
.pill-verde{ background:#dcfce7; color:#15803d; }
.pill-ambar{ background:#fef3c7; color:#b45309; }
.pill-rojo{ background:#fee2e2; color:#b91c1c; }
.pill-azul{ background:#dbeafe; color:#1d4ed8; }
.pill-gris{ background:#eef1f8; color:#64748b; }

/* ---------- Grupos repetibles (comités, clubes) ---------- */
.entrada{
  padding: 20px; margin-bottom: 14px; border-radius: 14px;
  border: 1.5px solid var(--borde); background: #f8faff;
  position: relative; transition: var(--transicion);
}
.entrada:hover{ border-color:#c9d8f5; }
.entrada .num-entrada{
  position:absolute; top:-10px; left:16px; background: var(--azul); color:#fff;
  font-size:11px; font-weight:700; padding:3px 10px; border-radius:999px;
}
.entrada .eliminar-entrada{
  position:absolute; top:14px; right:14px; background:#fee2e2; color:#b91c1c;
  border:none; border-radius:8px; width:30px; height:30px; cursor:pointer; font-size:14px;
}
.entrada .eliminar-entrada:hover{ background:#fecaca; }
.bloque-titulo{
  display:flex; align-items:center; justify-content:space-between; margin: 30px 0 14px;
}
.bloque-titulo h3{ margin:0; font-size:16.5px; color: var(--azul-oscuro); }
.bloque-titulo p.nota{ font-size:12.5px; color: var(--texto-suave); margin:2px 0 0; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar{ width:10px; }
::-webkit-scrollbar-thumb{ background:#c7d3ec; border-radius:10px; }

/* ---------- Utilidades ---------- */
.center{ text-align:center; }
.mt-0{margin-top:0} .mt-8{margin-top:8px} .mt-16{margin-top:16px} .mt-24{margin-top:24px} .mt-32{margin-top:32px}
.mb-0{margin-bottom:0} .mb-8{margin-bottom:8px} .mb-16{margin-bottom:16px} .mb-24{margin-bottom:24px}
.flex{ display:flex; } .flex-between{ display:flex; align-items:center; justify-content:space-between; }
.gap-8{gap:8px} .gap-12{gap:12px} .gap-16{gap:16px}
.oculto{ display:none !important; }
.fade-in{ animation: fadeIn .5s ease both; }
@keyframes fadeIn{ from{ opacity:0; transform: translateY(10px);} to{opacity:1; transform:translateY(0);} }

/* ---------- Toast ---------- */
#toast-contenedor{ position: fixed; top: 20px; right: 20px; z-index: 9999; display:flex; flex-direction:column; gap:10px; }
.toast{
  min-width: 260px; max-width: 360px; padding: 14px 18px; border-radius: 12px;
  background:#fff; box-shadow: var(--sombra-lg); border-left: 5px solid var(--azul);
  font-size: 13.5px; animation: toastIn .3s ease both;
}
.toast.exito{ border-color: var(--exito); }
.toast.error{ border-color: var(--peligro); }
@keyframes toastIn{ from{ opacity:0; transform: translateX(30px);} to{opacity:1; transform:translateX(0);} }

/* ---------- Responsive ---------- */
@media (max-width: 720px){
  .topbar{ padding: 14px 16px; }
  .contenedor{ padding: 0 14px; }
}

/* Campo precargado desde base de datos: visible, pero no editable por la liga */
.campo-bloqueado{ background:#eef2fb !important; color:#26364a !important; cursor:not-allowed; opacity:1 !important; }


/* ---------- Branding institucional mejorado ---------- */
body{ overflow-x:hidden; }
.topbar{
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #072a61 0%, #0a3d8c 60%, #0c4da8 100%);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 30px rgba(5, 22, 48, .20);
}
.marca-brand{ flex:1 1 260px; min-width:240px; }
.marca-logo-principal{
  height: 76px; width: auto; object-fit: contain; display:block;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.18));
}
.topbar-derecha{
  display:flex; align-items:center; gap:16px; flex-wrap:wrap; justify-content:flex-end; flex: 1 1 420px;
}
.grupo-institucional{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.badge-inst-imagen{
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.08));
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  padding: 10px 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10), 0 10px 20px rgba(0,0,0,.10);
}
.badge-inst-imagen img{
  display:block; width:auto; object-fit:contain;
}
.badge-inst-imagen:nth-child(1) img{ height: 40px; }
.badge-inst-imagen:nth-child(2) img{ height: 44px; }
.topbar-sesion{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
#topbar-liga{
  max-width: 280px; white-space: nowrap; overflow:hidden; text-overflow:ellipsis;
  background: rgba(255,255,255,.96); color: var(--azul-oscuro); font-weight:800; padding: 12px 18px; border-radius: 999px; box-shadow: 0 10px 24px rgba(0,0,0,.12);
}

/* Mascota flotante fija */
.mascota-widget{
  position: fixed; right: 18px; bottom: 10px; z-index: 90;
  width: 132px; pointer-events:none; user-select:none;
  display:flex; flex-direction:column; align-items:flex-end; gap:8px;
}
.mascota-widget img{
  width:100%; height:auto;
  filter: drop-shadow(0 18px 28px rgba(10,30,61,.28));
  transform-origin: 72% 24%;
  animation: ositoFlota 4.8s ease-in-out infinite, ositoSaluda 2.6s ease-in-out infinite;
}
.mascota-burbuja{
  background:#fff; color: var(--azul-oscuro); border-radius:999px; padding:6px 12px;
  font-size:12px; font-weight:700; box-shadow: 0 8px 18px rgba(10,30,61,.16);
  border:1px solid rgba(11,95,204,.12); margin-right: 18px; animation: burbujaPulse 3s ease-in-out infinite;
}
@keyframes ositoFlota{
  0%,100%{ transform: translateY(0px); }
  50%{ transform: translateY(-10px); }
}
@keyframes ositoSaluda{
  0%,100%{ rotate: 0deg; }
  25%{ rotate: 2deg; }
  50%{ rotate: -1.5deg; }
  75%{ rotate: 2deg; }
}
@keyframes burbujaPulse{
  0%,100%{ transform: translateY(0px); opacity:1; }
  50%{ transform: translateY(-4px); opacity:.92; }
}

/* Hero de acceso con logos bonitos */
.hero-izq .brand-ribbon{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin: 18px 0 8px; }
.hero-izq .brand-ribbon img{ display:block; object-fit:contain; }
.hero-izq .brand-ribbon .odraf-small{ height:52px; }
.hero-izq .brand-ribbon .inst-small{ height:36px; background:rgba(255,255,255,.10); border:1px solid rgba(255,255,255,.16); border-radius:12px; padding:6px 10px; }

@media (max-width: 980px){
  .topbar{ justify-content:center; text-align:center; }
  .topbar-derecha, .grupo-institucional, .topbar-sesion{ justify-content:center; }
  .marca-brand{ display:flex; justify-content:center; }
}
@media (max-width: 720px){
  .marca-logo-principal{ height: 48px; }
  .badge-inst-imagen:nth-child(1) img{ height: 28px; }
  .badge-inst-imagen:nth-child(2) img{ height: 32px; }
  .mascota-widget{ width: 92px; right: 8px; bottom: 6px; }
  .mascota-burbuja{ font-size:10px; padding:5px 9px; margin-right: 6px; }
}

/* ============================================================
   v15 · Encabezado institucional legible + ficha con panel visible
   ============================================================ */
.topbar{
  min-height: 108px;
  padding: 10px 24px;
  gap: 18px;
  flex-wrap: nowrap;
  align-items: center;
  background: linear-gradient(120deg, #071f46 0%, #07346f 52%, #0a4b99 100%);
}

.marca-brand{
  flex: 0 0 220px;
  min-width: 220px;
  display:flex;
  align-items:center;
}
.logo-card{
  display:flex;
  align-items:center;
  justify-content:center;
}
.logo-card-odraf{
  width:220px;
  height:86px;
  padding:7px 10px;
  border-radius:18px;
  background:rgba(255,255,255,.98);
  border:1px solid rgba(255,255,255,.72);
  box-shadow:0 10px 22px rgba(0,0,0,.16);
  overflow:hidden;
}
.marca-logo-principal{
  width:100%;
  height:100%;
  max-width:none;
  object-fit:contain;
  filter:none;
}

.topbar-derecha{
  min-width:0;
  flex:1 1 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:nowrap;
}
.grupo-institucional{
  flex:0 1 500px;
  min-width:390px;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:12px;
  flex-wrap:nowrap;
}
.badge-inst-imagen{
  height:74px;
  padding:8px 12px;
  border-radius:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(180deg, rgba(255,255,255,.15), rgba(255,255,255,.07));
  border:1px solid rgba(255,255,255,.22);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.10), 0 8px 18px rgba(0,0,0,.11);
  overflow:hidden;
}
.badge-inst-imagen.badge-gobernacion{ width:260px; }
.badge-inst-imagen.badge-indeportes{ width:228px; }
.badge-inst-imagen img,
.badge-inst-imagen:nth-child(1) img,
.badge-inst-imagen:nth-child(2) img{
  width:100%;
  height:58px;
  max-width:100%;
  object-fit:contain;
}

.topbar-sesion{
  flex:1 1 520px;
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:nowrap;
}
#topbar-liga{
  max-width:230px;
  min-width:0;
  padding:10px 14px;
  font-size:12.5px;
}
.topbar .btn-sm{
  padding:10px 13px;
  font-size:12.5px;
  white-space:nowrap;
}
.btn-volver-panel{
  background:#ffffff;
  color:#063b80;
  border:1px solid rgba(255,255,255,.85);
  font-weight:800;
  box-shadow:0 7px 16px rgba(0,0,0,.15);
}
.btn-volver-panel:hover{
  background:#eef5ff;
  color:#052e67;
  transform:translateY(-1px);
}

/* Ficha: nunca ocultar el panel izquierdo. */
.pagina-ficha #topbar{
  position:sticky;
  top:0;
  z-index:1000;
}
.pagina-ficha .layout{
  grid-template-columns:260px minmax(0,1fr);
}
.pagina-ficha .stepper{
  display:block !important;
  visibility:visible !important;
  opacity:1 !important;
  position:sticky;
  top:126px !important;
  z-index:30;
  padding:14px;
  max-height:calc(100vh - 142px);
  overflow:auto;
}
.stepper-volver{
  width:100%;
  border:1.5px solid #0b5fcc;
  background:#eef5ff;
  color:#063b80;
  border-radius:11px;
  min-height:42px;
  padding:9px 10px;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:9px;
  font-family:inherit;
  font-size:12.5px;
  font-weight:800;
  cursor:pointer;
  transition:var(--transicion);
  margin-bottom:10px;
}
.stepper-volver:hover{
  background:#dbeafe;
  transform:translateY(-1px);
}
.stepper-volver-icono{
  width:25px;
  height:25px;
  flex:0 0 25px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fff;
  background:#0b5fcc;
  font-size:17px;
  line-height:1;
}
.stepper-separador{
  height:1px;
  background:var(--borde);
  margin:10px 0;
}

@media (max-width:1450px){
  .topbar{ padding-left:18px; padding-right:18px; gap:12px; }
  .marca-brand{ flex-basis:190px; min-width:190px; }
  .logo-card-odraf{ width:190px; height:78px; }
  .grupo-institucional{ flex-basis:430px; min-width:350px; gap:8px; }
  .badge-inst-imagen.badge-gobernacion{ width:225px; }
  .badge-inst-imagen.badge-indeportes{ width:198px; }
  .badge-inst-imagen{ height:68px; padding:7px 9px; }
  .badge-inst-imagen img,
  .badge-inst-imagen:nth-child(1) img,
  .badge-inst-imagen:nth-child(2) img{ height:52px; }
  .topbar-sesion{ flex-basis:470px; gap:6px; }
  #topbar-liga{ max-width:190px; padding:9px 11px; }
  .topbar .btn-sm{ padding:9px 10px; font-size:12px; }
}

@media (max-width:1180px){
  .topbar{
    min-height:auto;
    flex-wrap:wrap;
    justify-content:center;
    padding:10px 14px 12px;
  }
  .marca-brand{ flex:0 0 200px; min-width:200px; justify-content:center; }
  .logo-card-odraf{ width:200px; height:78px; }
  .topbar-derecha{
    flex:1 1 720px;
    width:100%;
    justify-content:center;
    flex-wrap:wrap;
  }
  .grupo-institucional{
    flex:0 1 auto;
    min-width:0;
    justify-content:center;
  }
  .topbar-sesion{
    flex:1 1 100%;
    justify-content:center;
    flex-wrap:wrap;
  }
  .pagina-ficha #topbar{ position:relative; }
  .pagina-ficha .stepper{ top:20px !important; max-height:none; }
}

@media (max-width:900px){
  .pagina-ficha .layout{ grid-template-columns:1fr; }
  .pagina-ficha .stepper{
    position:static !important;
    display:flex !important;
    overflow-x:auto;
    overflow-y:hidden;
    max-height:none;
    gap:8px;
    align-items:center;
  }
  .pagina-ficha .stepper-volver{ width:auto; min-width:190px; margin:0; }
  .pagina-ficha .stepper-separador{ width:1px; height:36px; min-width:1px; margin:0 2px; }
}

@media (max-width:720px){
  .grupo-institucional{ width:100%; }
  .badge-inst-imagen.badge-gobernacion,
  .badge-inst-imagen.badge-indeportes{ width:min(46vw, 225px); }
  .badge-inst-imagen{ height:60px; }
  .badge-inst-imagen img,
  .badge-inst-imagen:nth-child(1) img,
  .badge-inst-imagen:nth-child(2) img{ height:44px; }
  #topbar-liga{ max-width:86vw; }
}

/* ---------- Ajustes de vigencias y alertas (v16) ---------- */
.campo-calculado{
  background:#f1f5f9 !important;
  color:#334155 !important;
  font-weight:600;
  cursor:not-allowed;
}
.estado-vigente{
  background:#ecfdf3 !important;
  border-color:#86efac !important;
  color:#166534 !important;
}
.estado-alerta{
  background:#fffbeb !important;
  border-color:#fcd34d !important;
  color:#92400e !important;
}
.estado-vencido{
  background:#fef2f2 !important;
  border-color:#fca5a5 !important;
  color:#991b1b !important;
}
.alerta-vigencia{ font-weight:600; }
.alerta-vigencia.alerta-activa{ color:#b45309; }
.alerta-vigencia.alerta-vencida{ color:#b91c1c; }
