/* =====================================================================
 * style.css — Comunidad Segura
 * Estilo SaaS profesional. Paleta: azul oscuro / azul / blanco / gris.
 * ===================================================================== */
:root {
    --navy:      #1B2E4B;   /* azul oscuro (marca / sidebar) */
    --navy-2:    #16263e;
    --azul:      #1E88E5;   /* azul de acción */
    --azul-osc:  #1565C0;
    --gris-bg:   #f4f6fa;   /* fondo de trabajo */
    --gris-bord: #e3e8f0;
    --gris-txt:  #5b6b82;
    --tinta:     #1f2937;
    --verde:     #2e9e5b;
    --amarillo:  #e0a106;
    --rojo:      #d64545;
    --radio:     14px;
    --sombra:    0 6px 24px rgba(27, 46, 75, .08);
    font-synthesis: none;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    color: var(--tinta);
    background: var(--gris-bg);
}
a { text-decoration: none; }

/* ====================== BOTONES BASE ====================== */
.btn-primario {
    background: var(--azul); border: none; color: #fff; font-weight: 600;
    border-radius: 10px; padding: .6rem 1.1rem; transition: background .15s;
}
.btn-primario:hover { background: var(--azul-osc); color: #fff; }
.btn-whatsapp { background: #25D366; color: #fff; border: none; border-radius: 10px; padding: .55rem 1rem; font-weight: 600; }
.btn-whatsapp:hover { background: #1da955; color: #fff; }
.enlace-secundario { color: var(--gris-txt); font-size: .9rem; }
.enlace-secundario:hover { color: var(--azul); }

/* ====================================================================
 *  PANTALLAS PÚBLICAS (login / registro / consulta)
 * ==================================================================== */
.pantalla-login, .pantalla-publica {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 55%, #0f1c30 100%);
    padding: 24px;
}
.login-card {
    background: #fff; width: 100%; max-width: 400px; border-radius: 18px; padding: 40px 34px;
}
.login-marca { text-align: center; margin-bottom: 28px; }
.login-logo {
    display: inline-flex; width: 64px; height: 64px; border-radius: 18px; margin-bottom: 14px;
    align-items: center; justify-content: center; font-size: 28px; color: #fff;
    background: linear-gradient(135deg, var(--azul), var(--navy));
}
.login-marca h1 { font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--navy); }
.login-marca p { color: var(--gris-txt); margin: 4px 0 0; font-size: .92rem; }
.login-card .input-group-text { background: #fff; border-right: 0; color: var(--gris-txt); }
.login-card .form-control { border-left: 0; }
.login-card .form-control:focus { box-shadow: none; border-color: var(--gris-bord); }
.login-pie { text-align: center; margin-top: 22px; font-size: .88rem; }
.login-pie a { color: var(--azul); }
.login-sep { color: var(--gris-bord); margin: 0 8px; }

/* registro / consulta */
.publica-wrap { width: 100%; max-width: 760px; }
.publica-estrecha { max-width: 480px; }
.publica-cabecera { text-align: center; color: #fff; margin-bottom: 22px; }
.publica-cabecera h1 { font-weight: 700; margin: 8px 0 4px; }
.publica-cabecera p { color: #c8d4e6; margin: 0; font-size: .95rem; }
.publica-card { background: #fff; border-radius: 18px; padding: 30px; }
.preview-img { display: none; max-width: 130px; margin-top: 10px; border-radius: 10px; border: 1px solid var(--gris-bord); }

/* Consentimiento informado */
.consentimiento {
    background: #f4f7fb;
    border: 1px solid var(--gris-bord);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: .9rem;
    color: var(--navy);
    line-height: 1.45;
}
.consentimiento a { color: var(--azul); text-decoration: underline; }

/* Documento legal (política de privacidad) */
.documento-legal { text-align: left; line-height: 1.6; color: #2b3648; }
.documento-legal h2 {
    font-size: 1.05rem;
    color: var(--navy);
    margin: 22px 0 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--azul);
}
.documento-legal ul { padding-left: 20px; }
.documento-legal li { margin-bottom: 6px; }

/* grabadora de voz */
.grabadora { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.btn-grabar { background: var(--navy); color: #fff; border: none; border-radius: 10px; padding: .55rem 1rem; font-weight: 600; }
.btn-grabar.grabando { background: var(--rojo); animation: pulso 1.1s infinite; }
@keyframes pulso { 0%,100% { box-shadow: 0 0 0 0 rgba(214,69,69,.5);} 50% { box-shadow: 0 0 0 8px rgba(214,69,69,0);} }
.grabadora-tiempo { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--navy); }
.audio-preview { width: 100%; margin-top: 8px; }

/* resultado consulta */
.resultado-consulta .aviso {
    display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; margin-bottom: 10px;
}
.aviso i { font-size: 1.2rem; margin-top: 2px; }
.aviso-verde  { background: #e7f6ee; color: #1d7a45; }
.aviso-amarillo{ background: #fdf3da; color: #8a6400; }
.aviso-rojo   { background: #fae5e5; color: #a92f2f; }
.aviso-neutro { background: #eef1f6; color: var(--gris-txt); }
.ficha-publica { border: 1px solid var(--gris-bord); border-radius: 12px; overflow: hidden; }
.ficha-fila { display: flex; justify-content: space-between; padding: 11px 16px; border-bottom: 1px solid var(--gris-bord); }
.ficha-fila:last-child { border-bottom: 0; }
.ficha-fila span { color: var(--gris-txt); }

/* ====================================================================
 *  LAYOUT DEL PANEL
 * ==================================================================== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px; background: var(--navy); color: #cdd8e8; display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 1030;
}
.sidebar-marca {
    display: flex; align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
    width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--azul), var(--azul-osc)); font-size: 18px;
}
.sidebar-titulo { font-weight: 700; color: #fff; font-size: 1.02rem; line-height: 1.15; }
.sidebar-nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
    color: #b9c6da; font-weight: 500; margin-bottom: 4px; transition: all .15s;
}
.nav-item i { width: 20px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.activo { background: var(--azul); color: #fff; box-shadow: 0 4px 12px rgba(30,136,229,.4); }
.sidebar-pie { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }

.contenido { flex: 1; margin-left: 248px; display: flex; flex-direction: column; }
.topbar {
    background: #fff; padding: 14px 26px; display: flex; align-items: center; gap: 16px;
    border-bottom: 1px solid var(--gris-bord); position: sticky; top: 0; z-index: 1020;
}
.btn-menu { display: none; background: none; border: none; font-size: 1.3rem; color: var(--navy); }
.topbar-titulo { font-size: 1.18rem; font-weight: 700; margin: 0; color: var(--navy); flex: 1; }
.topbar-usuario { display: flex; align-items: center; gap: 10px; }
.usuario-nombre { font-weight: 600; font-size: .92rem; }
.usuario-rol { font-size: .72rem; color: var(--gris-txt); text-transform: capitalize; }
.usuario-avatar {
    width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff;
    display: grid; place-items: center; font-weight: 700;
}
.vista { padding: 26px; }

/* ====================== TARJETAS KPI ====================== */
.grid-tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.kpi {
    background: #fff; border-radius: var(--radio); padding: 18px; display: flex; align-items: center; gap: 14px;
    box-shadow: var(--sombra); border: 1px solid var(--gris-bord);
}
.kpi-icono { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; color: #fff; }
.kpi-azul .kpi-icono    { background: var(--azul); }
.kpi-verde .kpi-icono   { background: var(--verde); }
.kpi-amarillo .kpi-icono{ background: var(--amarillo); }
.kpi-rojo .kpi-icono    { background: var(--rojo); }
.kpi-gris .kpi-icono    { background: #7b8aa3; }
.kpi-datos { display: flex; flex-direction: column; }
.kpi-valor { font-size: 1.7rem; font-weight: 700; color: var(--navy); line-height: 1; }
.kpi-texto { color: var(--gris-txt); font-size: .85rem; }

/* ====================== PANELES ====================== */
.panel {
    background: #fff; border-radius: var(--radio); padding: 22px; box-shadow: var(--sombra);
    border: 1px solid var(--gris-bord); margin-bottom: 4px;
}
.panel-form { max-width: 760px; }
.panel-titulo { font-size: 1.05rem; font-weight: 700; color: var(--navy); margin-bottom: 16px; }
.panel-cabecera { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.texto-apoyo { color: var(--gris-txt); font-size: .88rem; }
.texto-mini { font-size: .78rem; font-weight: 400; color: var(--gris-txt); word-break: break-all; }
.texto-rojo { color: var(--rojo); }
.texto-verde { color: var(--verde); }

/* filtros tipo chip */
.filtros-estado { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    background: var(--gris-bg); border: 1px solid var(--gris-bord); color: var(--gris-txt);
    padding: 6px 14px; border-radius: 20px; font-size: .85rem; font-weight: 500; cursor: pointer;
}
.chip.activo { background: var(--navy); border-color: var(--navy); color: #fff; }

/* rankings */
.lista-rank { display: flex; flex-direction: column; gap: 4px; }
.rank-fila { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--gris-bord); }
.rank-fila:last-child { border-bottom: 0; }
.rank-pos { width: 26px; height: 26px; border-radius: 8px; background: var(--azul); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .82rem; }
.rank-pos.rank-rojo { background: var(--rojo); }
.rank-nombre { flex: 1; font-weight: 600; }
.rank-valor { color: var(--gris-txt); font-size: .85rem; }

/* ====================== BADGES ====================== */
.badge-nivel, .badge-estado, .badge-tipo, .badge-origen {
    display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .76rem; font-weight: 700;
}
.nivel-verde    { background: #e7f6ee; color: #1d7a45; }
.nivel-amarillo { background: #fdf3da; color: #8a6400; }
.nivel-rojo     { background: #fae5e5; color: #a92f2f; }
.estado-pendiente { background: #eef1f6; color: #4a5a73; }
.estado-aprobado  { background: #e7f6ee; color: #1d7a45; }
.estado-observado { background: #fdf3da; color: #8a6400; }
.estado-rechazado { background: #f0e6f7; color: #6b3b8a; }
.estado-bloqueado { background: #fae5e5; color: #a92f2f; }
.badge-tipo   { background: #e8f0fb; color: var(--azul-osc); }
.badge-origen { background: #eef1f6; color: var(--gris-txt); text-transform: capitalize; }

/* ====================== TABLAS ====================== */
table.dataTable thead th { color: var(--navy); font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; }
.btn-ver, .btn-liberar { background: var(--gris-bg); border: 1px solid var(--gris-bord); color: var(--navy); border-radius: 8px; font-weight: 600; }
.btn-ver:hover, .btn-liberar:hover { background: var(--navy); color: #fff; }

/* ====================== MODAL FICHA ====================== */
.ficha-top { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.ficha-confianza {
    flex: 1; min-width: 160px; text-align: center; background: var(--gris-bg); border-radius: 12px; padding: 16px;
}
.confianza-num { font-size: 2.2rem; font-weight: 800; color: var(--navy); line-height: 1.1; margin-top: 6px; }
.confianza-num small { font-size: 1rem; color: var(--gris-txt); }
.ficha-captura { flex: 1; min-width: 160px; text-align: center; }
.captura-thumb { max-width: 100%; max-height: 200px; border-radius: 10px; border: 1px solid var(--gris-bord); margin-top: 6px; }
.ficha-datos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.ficha-datos > div { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px dashed var(--gris-bord); }
.ficha-datos > div.col-2 { grid-column: 1 / -1; }
.ficha-datos span { color: var(--gris-txt); font-size: .78rem; text-transform: uppercase; }
.ficha-voz { margin-top: 16px; background: var(--gris-bg); padding: 14px; border-radius: 12px; }
.ficha-acciones { gap: 8px; flex-wrap: wrap; }
.ficha-acciones .btn { color: #fff; border: none; font-weight: 600; border-radius: 9px; }
.btn-aprobar  { background: var(--verde); }
.btn-observar { background: var(--amarillo); }
.btn-rechazar { background: #7c4ba0; }
.btn-bloquear { background: var(--rojo); }
.ficha-acciones .btn:hover { filter: brightness(.92); color: #fff; }

.swal-file-label { display: block; text-align: left; font-size: .85rem; color: var(--gris-txt); margin: 10px 0 2px; }

/* ====================================================================
 *  RESPONSIVO
 * ==================================================================== */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s; }
    .sidebar.abierto { transform: translateX(0); }
    .contenido { margin-left: 0; }
    .btn-menu { display: block; }
    .ficha-datos { grid-template-columns: 1fr; }
}
@media (max-width: 576px) {
    .vista { padding: 16px; }
    .topbar { padding: 12px 16px; }
    .usuario-rol { display: none; }
}
