/* ============================================================
   CBA Médico - Estilos
   ============================================================ */

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f4f7f7;
    color: #1f2937;
    line-height: 1.4;
}
.oculto { display: none !important; }

/* ----------- Login ----------- */
.pantalla-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f766e, #0891b2);
}
.caja-login {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 400px;
}
.caja-login h1 { margin: 0 0 5px 0; color: #0f766e; }
.caja-login .subtitulo { color: #666; margin-top: 0; margin-bottom: 24px; }
.caja-login label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; }
.caja-login input[type=password] {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    margin-bottom: 16px;
}
.caja-login button {
    width: 100%;
    padding: 12px;
    background: #0f766e;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
}
.caja-login button:hover { background: #115e59; }
.nota-privacidad { font-size: 12px; color: #888; margin-top: 18px; margin-bottom: 0; line-height: 1.5; }
.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* ----------- Cabecera / nav ----------- */
.cabecera {
    background: #0f766e;
    color: #fff;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    position: sticky; top: 0; z-index: 20;
}
.cabecera h1 { font-size: 19px; margin: 0; white-space: nowrap; }
.cabecera .temporada { font-weight: 400; opacity: .85; font-size: 14px; margin-left: 6px; }
.cabecera nav { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.cabecera .tab {
    background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff;
    padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.cabecera .tab.activo { background: #fff; color: #0f766e; font-weight: 600; border-color: #fff; }
.cabecera .salir { color: #fff; text-decoration: none; font-size: 14px; opacity: .85; margin-left: 6px; }
.cabecera .salir:hover { opacity: 1; text-decoration: underline; }

.buscador { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.buscador input {
    width: 100%; padding: 9px 12px; border-radius: 6px; border: none; font-size: 14px;
}
.resultados-buscar {
    position: absolute; top: 40px; left: 0; right: 0; background: #fff; color: #222;
    border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-height: 320px; overflow-y: auto; z-index: 30;
}
.resultados-buscar .resultado {
    padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #eee; font-size: 14px;
}
.resultados-buscar .resultado:hover { background: #f0fdfa; }
.resultados-buscar .resultado small { color: #666; display: block; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.panel-tab { }
.cabecera-seccion { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.cabecera-seccion h2 { margin: 0; color: #0f766e; }
.ayuda { color: #555; font-size: 14px; max-width: 760px; }
.cargando { color: #888; padding: 30px 0; text-align: center; }

.migas { font-size: 14px; margin-bottom: 14px; color: #555; }
.migas a { color: #0f766e; cursor: pointer; text-decoration: none; }
.migas a:hover { text-decoration: underline; }

/* ----------- Tarjetas de equipos ----------- */
.rejilla-equipos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tarjeta-equipo {
    background: #fff; border-radius: 10px; padding: 16px 18px; box-shadow: 0 1px 4px rgba(0,0,0,.08);
    cursor: pointer; border: 1px solid #e5e7eb; transition: box-shadow .15s, transform .15s;
}
.tarjeta-equipo:hover { box-shadow: 0 6px 18px rgba(0,0,0,.12); transform: translateY(-1px); }
.tarjeta-equipo h3 { margin: 0 0 4px; color: #0f766e; font-size: 16px; }
.tarjeta-equipo .categoria { color: #666; font-size: 13px; }
.tarjeta-equipo .n-jugadores { margin-top: 10px; font-size: 13px; color: #0f766e; font-weight: 600; }
/* Pendiente de reconocimiento (interno o FBM, igual criterio que "Solo pendientes"
   en Listados) o, si no falta nadie, un aviso de que el equipo está al día. */
.tarjeta-equipo .estado-reconocimiento { margin-top: 6px; font-size: 12.5px; font-weight: 600; }
.tarjeta-equipo .estado-reconocimiento.pendiente { color: #b91c1c; }
.tarjeta-equipo .estado-reconocimiento.completo { color: #047857; }
/* Cuando ya no falta nadie, un color de fondo suave para verlo de un vistazo
   sin tener que leer el texto de cada tarjeta. */
.tarjeta-equipo.tarjeta-equipo-completo { background: #ecfdf5; border-color: #a7f3d0; }

/* ----------- Tabla de jugadores (roster) ----------- */
table.tabla-jugadores { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
table.tabla-jugadores th, table.tabla-jugadores td { padding: 10px 12px; text-align: left; font-size: 14px; border-bottom: 1px solid #eee; }
table.tabla-jugadores th { background: #f0fdfa; color: #0f766e; font-weight: 600; }
table.tabla-jugadores tr.fila-jugador { cursor: pointer; }
table.tabla-jugadores tr.fila-jugador:hover { background: #f8fafc; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; margin-right: 4px; }
.badge.si { background: #d1fae5; color: #065f46; }
.badge.no { background: #f3f4f6; color: #6b7280; }

/* ----------- Ficha de jugador ----------- */
.cabecera-jugador { background: #fff; border-radius: 10px; padding: 16px 20px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.cabecera-jugador h2 { margin: 0 0 4px; color: #111; }
.cabecera-jugador .datos-basicos { color: #555; font-size: 14px; }
.caja-reconocimiento-fbm { padding: 10px 14px; border-radius: 8px; font-size: 13px; max-width: 380px; border-left: 4px solid #9ca3af; background: #f3f4f6; color: #4b5563; }
.caja-reconocimiento-fbm.vigente { border-left-color: #059669; background: #ecfdf5; color: #065f46; }
.caja-reconocimiento-fbm.caducado { border-left-color: #dc2626; background: #fef2f2; color: #991b1b; }
.sub-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.sub-tab {
    background: #fff; border: 1px solid #d1d5db; padding: 8px 14px; border-radius: 20px; cursor: pointer; font-size: 13px;
}
.sub-tab.activo { background: #0f766e; color: #fff; border-color: #0f766e; }

/* ----------- Formularios ----------- */
.grupo-form { background: #fff; border-radius: 10px; padding: 16px 20px; margin-bottom: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.grupo-form h4 { margin: 0 0 12px; color: #0f766e; font-size: 14px; text-transform: uppercase; letter-spacing: .03em; }
.rejilla-campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.campo { display: flex; flex-direction: column; gap: 4px; }
.campo.ancho { grid-column: 1 / -1; }
.campo label { font-size: 12.5px; color: #444; font-weight: 600; }
.campo input, .campo select, .campo textarea {
    padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; font-family: inherit;
}
.campo textarea { resize: vertical; min-height: 44px; }
.barra-acciones { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

button.btn-primario, .btn-primario {
    background: #0f766e; color: #fff; border: none; padding: 10px 18px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600;
}
button.btn-primario:hover { background: #115e59; }
button.btn-secundario, .btn-secundario {
    background: #fff; color: #0f766e; border: 1px solid #0f766e; padding: 10px 18px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600;
}
button.btn-secundario:hover { background: #f0fdfa; }
button.btn-peligro {
    background: #fff; color: #b91c1c; border: 1px solid #fca5a5; padding: 7px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
button.btn-peligro:hover { background: #fef2f2; }

/* ----------- Histórico (generales / antropometría / cardiología) ----------- */
.tarjeta-historico { background: #fff; border-radius: 10px; padding: 14px 18px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.tarjeta-historico .cab-historico { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.tarjeta-historico .fecha-historico { font-weight: 700; color: #0f766e; }
.tarjeta-historico .resumen-historico { color: #555; font-size: 13px; margin-top: 4px; }
.tarjeta-historico .acciones-historico { display: flex; gap: 6px; }
.vacio { color: #888; padding: 20px; text-align: center; background: #fff; border-radius: 10px; }

/* ----------- Documentos ----------- */
.bloque-documentos { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.tipo-documento { background: #fff; border-radius: 10px; padding: 16px 18px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.tipo-documento h4 { margin: 0 0 4px; color: #0f766e; }
.tipo-documento .sub { color: #777; font-size: 12.5px; margin-bottom: 10px; }
.lista-docs { list-style: none; padding: 0; margin: 0 0 12px; }
.lista-docs li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 13.5px; gap: 8px; }
.lista-docs a { color: #0f766e; text-decoration: none; word-break: break-word; }
.lista-docs a:hover { text-decoration: underline; }
.form-subida { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-subida input[type=text] { flex: 1; min-width: 120px; padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; }

/* ----------- Listados (estado de reconocimientos) ----------- */
.subvistas-listado { display: flex; gap: 8px; margin: 16px 0 4px; }
.subvista-tab {
    background: #fff; border: 1px solid #d1d5db; color: #374151;
    padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.subvista-tab.activo { background: #0f766e; color: #fff; border-color: #0f766e; }

button.btn-exportar, .btn-exportar {
    background: #fff; color: #0f766e; border: 1px solid #0f766e; padding: 9px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600;
}
button.btn-exportar:hover { background: #f0fdfa; }
.filtros-listado { display: flex; align-items: center; gap: 18px; margin: 14px 0; flex-wrap: wrap; }
.filtros-listado select { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; min-width: 200px; }
.check-pendientes { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; user-select: none; }
table.tabla-listado { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
table.tabla-listado th, table.tabla-listado td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #eee; white-space: nowrap; }
table.tabla-listado th { background: #f0fdfa; color: #0f766e; font-weight: 600; position: sticky; top: 0; z-index: 1; box-shadow: 0 1px 0 #eee; }
table.tabla-listado td.col-ancha { white-space: normal; min-width: 150px; }
table.tabla-listado tbody tr.fila-listado { cursor: pointer; }
table.tabla-listado tbody tr:hover { background: #f8fafc; }
.contenedor-tabla-listado {
    overflow: auto;
    max-height: 70vh;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.pill-estado { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.pill-estado.completo { background: #d1fae5; color: #065f46; }
.pill-estado.pendiente { background: #fee2e2; color: #991b1b; }
.dato-ok { color: #065f46; }
.dato-falta { color: #b91c1c; }
.dato-antiguo { color: #b45309; }

/* ----------- Importar excel de antropometría ----------- */
.form-importar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0 20px; }
.form-importar input[type=file] {
    padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; background: #fff;
}
.resumen-import {
    background: #f0fdfa; border: 1px solid #ccfbf1; border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; font-size: 14px;
}
.estado-import-insertado { color: #065f46; font-weight: 700; }
.estado-import-actualizado { color: #0f766e; font-weight: 700; }
.estado-import-ya_existia { color: #b45309; font-weight: 700; }
.estado-import-no_encontrado { color: #b91c1c; font-weight: 700; }

/* ----------- Modal ----------- */
.modal-fondo { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 100; }
.modal-caja { background: #fff; border-radius: 10px; padding: 22px 24px; max-width: 480px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-caja h3 { margin-top: 0; color: #0f766e; }
.mensaje-flotante {
    position: fixed; bottom: 20px; right: 20px; background: #111827; color: #fff; padding: 12px 18px;
    border-radius: 8px; font-size: 14px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.mensaje-flotante.error { background: #b91c1c; }
