@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Arial', sans-serif;
}

:root {
    --azul-marino: #002d6e;
    --azul: #0057d9;
    --azul-claro: #2f7dff;
    --rojo: #c8102e;
    --tinta: #1c2536;
    --gris-texto: #5b6472;
    --gris-fondo: #eef2f8;
    --blanco: #ffffff;
    --radio: 20px;
}

/* 🆕 El chat ahora ocupa TODO el alto/ancho de donde se coloque
   (pedido del profesor: usar 100vh en vez de un tamaño fijo/limitado). */
html, body {
    height: 100vh;
    margin: 0;
}

body {
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 0;
}

.chat-container {
    width: 100%;
    max-width: none;   /* 🆕 antes: 1100px — ahora ocupa todo el ancho disponible */
    height: 100vh;      /* 🆕 llena todo el alto de la pantalla/contenedor donde se cargue */
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 15, 60, .35);
    background: var(--blanco);
    border-radius: 0;   /* 🆕 al llenar toda la pantalla ya no hacen falta esquinas redondeadas */
    /* overflow visible a propósito: el menú desplegable necesita
       poder salir del recuadro. Las esquinas redondeadas ahora las
       ponen el header y el footer directamente. */
    overflow: visible;
    position: relative;
}

/* ===================== HEADER ===================== */
.header {
    background: linear-gradient(100deg, var(--azul-marino), var(--azul) 55%, var(--rojo) 130%);
    padding: 16px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
    box-shadow: 0 4px 16px rgba(0, 20, 70, .25);
    position: relative;
    z-index: 10;
    color: white;
    border-radius: 0; /* 🆕 sin esquinas redondeadas al llenar toda la pantalla */
}

.header h1 {
    font-family: 'Poppins', 'Arial', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin: 0 auto 0 0;
    letter-spacing: .3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header h1::before {
    content: "🎓";
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, .18);
    border-radius: 50%;
}

.header button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, transform .15s ease;
}

.header button:hover {
    background: rgba(255, 255, 255, .18);
    transform: translateY(-1px);
}

/* ===================== CHAT BODY ===================== */
#chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    z-index: 1;
    background:
        linear-gradient(rgba(238, 242, 248, .96), rgba(238, 242, 248, .96)),
        url("img/fondo.png");
    background-size: cover;
}

#chat-body::-webkit-scrollbar {
    width: 8px;
}

#chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 87, 217, .25);
    border-radius: 10px;
}

/* ===================== NAVBAR / BOTÓN DE MENÚ ===================== */
.navbar {
    background: var(--blanco);
    border-top: 1px solid #ececf3;
    padding: 4px 10px;
    height: 46px;
    display: flex;
    align-items: center;
    position: relative;
    justify-content: flex-start;
    z-index: 500;
    overflow: visible !important;
}

.navbar button {
    font-size: 17px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--azul-marino);
    transition: .2s;
    padding: 2px 6px;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.navbar button:hover {
    background: var(--azul);
    color: white;
}

/* Menú desplegable (Plan de estudios, Costos, etc.)
   Anclado al navbar; como el contenedor ya no recorta con overflow,
   puede salir del card sin cortarse, con z-index alto por encima de todo. */
.menu-lista {
    position: absolute;
    bottom: 46px;      /* antes: top: 46px */
    left: 8px;
    background-color: var(--blanco);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 25, 80, .22);
    border: 1px solid #eef1f7;
    z-index: 9999;
    width: 290px;
max-height: min(18vh, 130px);
 overflow-y: auto;
    padding: 8px;
    animation: aparecer .2s ease;
    display: none;
    margin: 0;
}

.menu-lista ul {
    list-style: none;
}

.menu-lista li {
    padding: 10px 12px;
    margin: 5px 0;
    background-color: var(--gris-fondo);
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s ease;
    font-weight: 600;
    color: var(--tinta);
    border-left: 4px solid transparent;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    font-size: 14px;
}

.menu-lista li:hover {
    background-color: var(--azul);
    color: white;
    border-left: 4px solid var(--rojo);
    transform: translateX(4px);
}

.menu-lista.activo {
    display: block;
}

/* Panel de acciones rápidas creado por mostrarMenuInformacion() */
.opcion-menu {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    cursor: pointer;
    transition: .18s;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tinta);
    gap: 10px;
    margin: 3px 0;
}

.opcion-menu span:first-child {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gris-fondo);
    border-radius: 50%;
    font-size: 15px;
}

.opcion-menu span:nth-child(2) {
    flex: 1;
}

.opcion-menu span:last-child {
    color: #b7bdc9;
    font-size: 18px;
}

.opcion-menu:hover {
    background: var(--azul);
    color: white;
}

.opcion-menu:hover span:first-child {
    background: rgba(255, 255, 255, .22);
}

.opcion-menu:hover span:last-child {
    color: white;
}

/* ===================== BURBUJAS DE MENSAJE ===================== */
.mensaje-contenedor {
    display: flex;
    max-width: 78%;
    position: relative;
    margin-bottom: 2px;
}

.mensaje-contenedor.usuario {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.mensaje-burbuja.usuario {
    background: linear-gradient(135deg, var(--azul-claro), var(--azul-marino));
    color: white;
    border-radius: 18px 18px 4px 18px;
    padding: 12px 16px;
    box-shadow: 0 8px 18px rgba(0, 87, 217, .28);
    line-height: 1.45;
    text-align: left;
    font-size: 14.5px;
}

.mensaje-contenedor.bot {
    align-self: flex-start;
    flex-direction: row;
}

.mensaje-burbuja.bot {
    background: white;
    color: var(--tinta);
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    box-shadow: 0 6px 16px rgba(20, 30, 60, .08);
    line-height: 1.45;
    text-align: left;
    border-left: 4px solid var(--rojo);
    font-size: 14.5px;
}

.hora-mensaje {
    font-size: 9px;
    opacity: .65;
    margin-top: 6px;
    display: block;
    text-align: right;
}

#indicador-escribiendo,
#indicador-grabando,
#indicador-procesando-audio {
    align-self: flex-start;
    background-color: white;
    color: var(--gris-texto);
    border-radius: 18px 18px 18px 4px;
    padding: 10px 16px;
    font-style: italic;
    font-size: 13.5px;
    box-shadow: 0 4px 10px rgba(20, 30, 60, .08);
}

/* ===================== FOOTER / INPUT ===================== */
.chat-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    background-color: white;
    border-top: 1px solid #ececf3;
    position: relative;
    z-index: 10;
    border-radius: 0; /* 🆕 sin esquinas redondeadas al llenar toda la pantalla */
}

#mensaje {
    flex: 1;
    max-width: 500px;
    padding: 13px 20px;
    border: 2px solid #e3e8f0;
    border-radius: 35px;
    outline: none;
    font-size: 14.5px;
    background-color: var(--gris-fondo);
    transition: border .2s, box-shadow .2s;
}

#mensaje:focus {
    border-color: var(--azul);
    box-shadow: 0 0 0 4px rgba(0, 87, 217, .12);
    background-color: #ffffff;
}

.chat-footer button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .15s;
}

.chat-footer button:hover {
    background: var(--gris-fondo);
    transform: scale(1.05);
}

/* ===================== MODALES ===================== */
.ventana-fondo {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(10, 20, 45, .55);
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0;
}
.ventana-caja {
    background-color: #ffffff;
    border-radius: 18px;
    width: 90%;
    max-width: 550px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 10, 40, .3);
    border: 1px solid #f0f0f0;
    margin: 0 auto;
    position: relative;
    
}

.ventana-titulo {
    padding: 16px;
    border-bottom: 1px solid #eee;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    color: white;
    text-align: center;
    background: linear-gradient(90deg, var(--azul-marino), var(--rojo));
}

.ventana-contenido {
    padding: 18px;
    line-height: 1.55;
    color: var(--gris-texto);
    text-align: center;
    font-size: 14.5px;
}

.ventana-botones {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid #eee;
}

.btn-cancelar, .btn-ok {
    padding: 9px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    transition: background .2s, transform .15s;
}

.btn-cancelar {
    background-color: #f1f2f6;
    color: var(--rojo);
}

.btn-cancelar:hover {
    background-color: var(--rojo);
    color: white;
}

.btn-ok {
    background: linear-gradient(135deg, var(--azul-claro), var(--azul-marino));
    color: white;
}

.btn-ok:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

/* ===================== HISTORIAL ===================== */
.historial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background-color: var(--gris-fondo);
    border-bottom: 1px solid #eee;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    color: var(--tinta);
}

.historial-botones {
    display: flex;
    gap: 8px;
}

.btn-historial {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--gris-texto);
    transition: color .2s;
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.btn-historial:hover {
    background: white;
    color: var(--azul);
}

.bloque-chat {
    padding: 13px 16px;
    border-bottom: 1px solid #f0f2f6;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background .2s;
    background-color: #ffffff;
    border-left: 5px solid var(--azul);
}

.bloque-chat:hover {
    background: #eef5ff;
}

.titulo-chat {
    font-size: 13.5px;
    color: var(--azul-marino);
    font-weight: 600;
}

.btn-eliminar-chat {
    background-color: var(--rojo);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: filter .2s;
}

.btn-eliminar-chat:hover {
    filter: brightness(1.1);
}

@keyframes aparecer {
    from { opacity: 0; transform: translateY(8px); }  /* antes: -8px */
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ===================== MÓVIL ===================== */
@media (max-width: 480px) {
    .chat-container { 
        height: 100vh;
         max-height: 100vh; 
         border-radius: 0; }
    .header, .chat-footer { border-radius: 0; }
    .menu-lista { width: calc(100vw - 32px); left: 8px; 
        max-height: min(20vh, 140px); }
}
#chat-body {
    transition: padding-bottom .25s ease;
}

/* Enlace de WhatsApp/correo embebido dentro de burbujas de mensaje del bot */
.link-whatsapp-inline {
    color: #128C7E;
    font-weight: 700;
    text-decoration: underline;
}