body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f0f2f5;
    overflow: hidden;
}

.whatsapp-layout {
	 flex: 1;
    display: flex;
    height: calc(100vh - 140px);
	  min-height: 0; /* 🔥 ESTA ES LA CLAVE */
}

/* SIDEBAR */
.sidebar {
    background: #ffffff;
    border-right: 1px solid #ddd;
    overflow-y: auto;
	  width: 300px;
	min-width: 250px;
    max-width: 320px;
}

.chat-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: 0.2s;
}

.chat-item:hover {
    background: #f5f5f5;
}

.chat-item b {
    font-size: 14px;
}

/* CHAT */
.chat {
    display: flex;
	 position: relative;
    flex-direction: column;
    height: 100%;
	 flex: 1;
	min-height: 0; /* 🔥 ESTE TAMBIÉN */
}

.chat-header {
     background: #f0f2f5;
    border-left: 1px solid #e0e0e0;
    padding: 12px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
	 
}

/* MENSAJES */


.mensaje {
    max-width: 75%;
    margin: 8px 10px;
    padding: 10px 14px;
    padding-bottom: 18px; /* 👈 para la hora */
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 1px rgba(0,0,0,0.08);
    position: relative;
    line-height: 1.4;
    font-size: 14px;
    color: #202c33;
}
.texto-mensaje {
    font-size: 14px;
    line-height: 1.4;
    margin-top: 5px;
}
.mensaje.usuario {
    background: #ffffff;
    align-self: flex-start;
	color: #111; /* negro */
}

.mensaje.agente {
    background: #d9fdd3;
    align-self: flex-end;
	color: #111; /* negro */
}

.mensaje.bot {
    background: #fff3cd;
    align-self: flex-end;
	color: #111; /* negro */
}
/*.mensaje.sistema {
    background: #fff3cd;
    color: #856404;
}*/
.autor {
    font-size: 14px;       /* 🔥 un poco más grande */
    font-weight: 700;      /* 🔥 negrita REAL */
    margin-bottom: 4px;
    color: #54656f;          /* 🔥 más contraste */
	 letter-spacing: 0.2px;
}

.mensaje.usuario .autor {
    color: #075e54;  /* verde WhatsApp */
}

.mensaje.bot .autor {
    color: #856404;  /* tono del bot */
}

.mensaje.agente .autor {
    color: #075e54; /* verde WhatsApp oscuro */
}
.mensaje.usuario::before {
    content: '';
    position: absolute;
    top: 0;
    left: -6px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.mensaje-template {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.mensaje-template-inner {
    background: #ffffff; /* 🔥 sólido */
    color: #54656f;

    font-size: 12px;
    padding: 6px 12px;

    border-radius: 10px;
    text-align: center;
    max-width: 280px;

    box-shadow: 0 2px 6px rgba(0,0,0,0.1); /* 🔥 mejora visibilidad */
}

.mensaje-template-sub {
    font-size: 11px;
    margin-top: 2px;
    opacity: 0.7;
}

/* .mensaje-template { */
    /* width: 100%; */
    /* display: flex; */
    /* justify-content: center; */
    /* margin: 10px 0; */
/* } */

/* .mensaje-template-inner { */
    /* background: #e4e6eb; */
    /* color: #667781; */
    /* font-size: 12px; */
    /* padding: 6px 12px; */
    /* border-radius: 10px; */
    /* text-align: center; */
    /* max-width: 280px; */
/* } */

/* .mensaje-template-sub { */
    /* font-size: 11px; */
    /* margin-top: 2px; */
    /* opacity: 0.8; */
/* } */

/* .mensaje-template-inner { */
    /* font-size: 11px; */
    /* background: rgba(0,0,0,0.06); */
/* } */

.mensaje.agente::before {
    content: '';
    position: absolute;
    top: 0;
    right: -6px;
    width: 12px;
    height: 12px;
    background: #d9fdd3;
    clip-path: polygon(0 0, 0 100%, 100% 0);
}
/* INPUT */
.chat-input input {
    flex: 1;
    padding: 12px;
    border-radius: 25px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border-radius: 20px;
    border: 1px solid #ccc;
    outline: none;
}

.chat-input button {
    margin-left: 10px;
    padding: 10px 15px;
    border: none;
    background: #0084ff;
    color: white;
    border-radius: 20px;
    cursor: pointer;
}

/* PANEL DERECHO */
.info {
	 background: #f0f2f5;
    /* background: #ffffff; */
    border-left: 1px solid #e0e0e0;
    padding: 15px;
	width: 300px;
	min-width: 250px;
    max-width: 320px;
	  
}


.chat-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.chat-item:hover {
    background: #f0f2f5;
}

.chat-nombre {
    font-weight: 600;
    font-size: 14px;
}

.chat-mensaje {
    font-size: 12px;
    color: gray;
}

.chat-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}
/*Estos se agregaron para mostrar la fecha del timesstamp del mensaje en la conversacion*/
.chat-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    padding: 0;
    border: none;
}

.chat-time {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    margin-left: 8px;
}
/*Hasta aqui*/
/*este se utiliza para agrupar los mensajes por fecha como lo hace whatsapp en el panel de lectura*/
.fecha-separador {
    align-self: center;
    background: rgba(255,255,255,0.9);
    color: #54656f;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 8px;
    margin: 12px 0;
    font-weight: 500;
    backdrop-filter: blur(3px);
}
/*Hasta aqui*/
/* esto pone una etiqueta de los mensajes sin leer agrupados en el chat*/
.unread-separator{
    align-self: center;
	 background: rgba(227,242,253,0.85);
    color: #1565c0;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 8px;
    margin: 12px 0;
    font-weight: 600;
}
/*Hasta aqui*/
.badge-tipo {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    color: white;
}

.wp {
    background: #25d366; /* verde WhatsApp */
}

.wc {
    background: #007bff;
}

.agente {
    font-size: 11px;
    color: #666;
}

.chat-item.activo {
    background: #e7f3ff;
    border-left: 4px solid #0b5ed7;
}

.menu-opciones {
    display: none;
    position: absolute;
    top: 35px;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-width: 150px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    z-index: 2000;
}

.menu-item {
    padding: 10px;
    cursor: pointer;
    font-size: 13px;
}

.menu-item:hover {
    background: #f5f5f5;
}

.chat-sin-asignar {
    border-left: 4px solid #ffc107;
}
.chat-nuevo-animado {
    animation: slideIn 0.3s ease;
}
#modalReasignar {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {opacity:0; transform:translate(-50%, -10px);}
    to {opacity:1; transform:translate(-50%, 0);}
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}



#chatList {
    overflow-y: auto;
    height: 100%;
}



html, body {
    height: 100%;
    overflow: hidden;
}

#chatBody {
    flex: 1;
    min-height: 0;

    display: flex;
    flex-direction: column;

    overflow-y: auto;
    overflow-x: hidden;

    background-color: #f0f2f5;
	background-image: url('../assets/img/fondo_light.jpeg');
    /*background-image: url('/eypo/atencionclientes/whatsapp_webhook/paneles/assets/img/fondo_light.jpeg');*/
    background-repeat: repeat;
    background-size: 180px auto;

    position: relative;
}

/* /* 🔥 CAPA GRIS */ */
/* #chatBody::before { */
    /* content: ""; */
    /* position: absolute; */
    /* inset: 0; */

    /* background: rgba(240, 242, 245, 0.55);  */

    /* pointer-events: none; */
    /* z-index: 0; */
/* } */

/* 🔥 TODO EL CONTENIDO ARRIBA */
/* #chatBody > * { */
    /* position: relative; */
    /* z-index: 1; */
/* } */
#listaAgentes div:hover {
    background: #f8f9fa;
}
/*pone circulo rojo para no leidos*/
.badge-unread{
    width: 22px;
    height: 22px;
    background: red;
    color: white;
    font-size: 11px;
    font-weight: bold;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/*control de enviar y adjuntar*/
.input-container {
    display: flex;
    align-items: center;
    padding: 8px;
    border-top: 1px solid #ddd;
    background: #f0f2f5;
	 border-top: 1px solid #e0e0e0;
    gap: 8px;
}

/* 📎 botón adjuntar */
.btn-attach {
    background: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-attach:hover {
    background: #e4e6eb;
}

/* input */
#inputMensaje {
    flex: 1;
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    outline: none;
    background: white;
}

/* botón enviar */
.btn-enviar {
    background: #0084ff;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
}

.btn-enviar:hover {
    background: #006fd6;
}
/*hasta aqui*/

.mensaje iframe {
    pointer-events: none;
}

#modalPreview {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;

     background: rgba(0,0,0,0.75);   /* 🔥 más oscuro */
    backdrop-filter: blur(6px);     /* 🔥 AQUÍ está la magia */
	
    display: none; /* oculto por default */

    z-index: 9999;
}
#previewContenido {
    width: 100%;
    max-width: 900px;

    height: 90vh;            /* 🔥 no max-height */
    overflow-y: auto;

    display: flex;
    justify-content: center;
    align-items: center;     /* 🔥 centro REAL */

    padding: 20px;
}
#previewContenido > div > div {
    animation: popIn 0.2s ease;
}

@keyframes popIn {
    from {
        transform: translateY(10px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}


/* CONTENEDOR */
.preview-actions{
    display:flex;
    justify-content:flex-end;
    gap:10px;
}

/* 🔘 CANCELAR */
.btn-cancelar{
    background:#f0f2f5;   /* 🔥 ya no transparente */
    border:none;
    color:#667781;
    font-size:14px;
    padding:10px 14px;
    border-radius:8px;
    cursor:pointer;
    transition:all .2s ease;
	font-weight:500;
}

.btn-cancelar:hover{
    background:#e4e6eb;
}

/* 🟢 ENVIAR */
.btn-enviar-preview{
    background:#00a884;
    border:none;
    color:white;
    font-size:14px;
    padding:10px 18px;
    border-radius:8px;
    cursor:pointer;
    transition:all .2s ease;
}

.btn-enviar-preview:hover{
    background:#029e7a;
}

.mensaje div[onclick]:hover {
    background: #f5f6f6;
    transform: scale(1.01);
    transition: all 0.15s ease;
}

.chat-cerrado {
    background: #f8d7da;       /* rojo claro */
    border-left: 4px solid #dc3545;
    opacity: 0.7;
}
.chat-rojo {
    border-left: 4px solid #e74c3c;
    background-color: #fff5f5;
}

.chat-amarillo {
    border-left: 4px solid #f1c40f;
    background-color: #fffbea;
}

.fechas-chat {
    font-size: 11px;
    color: #888;
    text-align: right;
}


.mensaje-hora {
    position: absolute;
    bottom: 4px;
    right: 8px;
    font-size: 10px;
    color: #667781;
}

.btn-attach:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chat-fuera-24h {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}


.sidebar,
.info {
    min-height: 0;
}
#contenedorDePagina {
    height: 100%;
    display: flex;
    flex-direction: column;
}
#mensajesWrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.badge-marca {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    background: #e4e6eb;
    color: #333;
    margin-left: 4px;
}

#chatInfo {
    flex: 1;
    min-width: 0;
	min-height: 50px;
    line-height: 1.4;
}

/* #chatInfo { */
    /* flex: 1; */
    /* min-width: 0; */
    /* min-height: 55px; /* un poquito más seguro */ */
    /* display: flex; */
    /* flex-direction: column; */
/* } */