/* =========================================
   SISTEMA DE INBOX (Limpio + Glassmorphism)
========================================= */

/* Contenedor principal del inbox con efecto cristal */
.inbox-container { 
    display: flex; 
    height: 55vh; 
    min-height: 450px; 
    border: 1px solid var(--accent); 
    border-radius: 15px; 
    overflow: hidden; 
    background: rgba(15, 15, 15, 0.4); 
    backdrop-filter: blur(12px);
    margin-top: 15px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 850px;
}

/* Barra lateral translúcida */
.inbox-sidebar { 
    width: 35%; 
    background: rgba(0, 0, 0, 0.4); 
    border-right: 1px solid rgba(255, 255, 255, 0.1); 
    overflow-y: auto; 
}

.inbox-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inbox-header h3 {
    margin: 0;
    color: var(--accent);
    font-family: 'Orbitron';
    font-size: 1.2rem;
}

.inbox-empty-text { 
    padding: 60px 20px !important; 
    color: #aaa; 
    font-family: 'Orbitron'; 
    font-size: 12px; 
    text-align: center; 
}

/* Área principal transparente */
.inbox-chat-area { 
    width: 65%; 
    display: flex; 
    flex-direction: column; 
    background: transparent; 
    pointer-events: auto !important;

}

.inbox-chat-header { 
    padding: 20px !important; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); 
    font-family: 'Orbitron'; 
    background: rgba(10, 10, 10, 0.6); 
    display: flex; 
    align-items: center; 
}

#inboxChatHistory {
    flex: 1;
    padding: 20px !important;
    /* Cambiamos display flex por block para que el scroll sea estándar y fiable */
    display: block !important; 
    overflow-y: auto !important;
    overflow-x: hidden;
    /* Esto es vital para que el scroll funcione en móviles y con el modal movible */
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 10;
}

#inboxChatHistory > div {
    margin-bottom: 15px;
}

/* Área inferior translúcida */
.inbox-footer { 
    padding: 20px !important; 
    background: rgba(0, 0, 0, 0.4); 
    border-top: 1px solid rgba(255, 255, 255, 0.1); 
}

.inbox-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

#inboxReplyInput {
    pointer-events: auto !important;
    cursor: text !important;
    position: relative;
    z-index: 10;
}

.btn-inbox-send, .btn-inbox-priority {
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-family: 'Orbitron';
    transition: 0.3s;
}

.btn-inbox-send:hover, .btn-inbox-priority:hover {
    background: var(--accent);
    color: #000;
}

/* =========================================
   MÁRGENES Y BURBUJAS DE CHAT (INBOX)
========================================= */

/* Elemento de la lista de contactos en la barra lateral */
.inbox-sidebar-item {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.inbox-sidebar-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--accent); /* Un toque visual al pasar el ratón */
}

/* Contenedor individual para cada mensaje */
.inbox-msg-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 18px; /* Margen entre mensajes */
    width: 100%;
}

/* Diseño base de la burbuja de chat */
.inbox-msg-bubble {
    padding: 12px 18px;
    border-radius: 18px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Mensaje enviado por mí (Derecha) */
.inbox-msg-me {
    align-self: flex-end;
    background: var(--accent);
    color: #111;
    border-bottom-right-radius: 4px; /* Pico de la burbuja */
}

/* Mensaje recibido (Izquierda) */
.inbox-msg-other {
    align-self: flex-start;
    background: #2a2a2a;
    color: #eee;
    border-bottom-left-radius: 4px; /* Pico de la burbuja */
}

/* Estilo para mensajes prioritarios */
.inbox-msg-priority {
    border: 2px solid #ffcc00;
    background: rgba(255, 204, 0, 0.1) !important;
    color: #ffcc00 !important;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.2);
}

/* Cabecera del chat mejorada con soporte para botón de llamada */
.inbox-chat-header-clean {
    padding: 25px !important; /* Espacio uniforme */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 10, 10, 0.4);
    width: 100%;
    box-sizing: border-box;
    display: flex; /* Alineación en línea */
    justify-content: space-between; /* Nombre a la izquierda, Botón a la derecha */
    align-items: center; /* Centrados verticalmente */
}

.inbox-chat-header-clean span {
    font-family: 'Orbitron', sans-serif;
    color: var(--accent);
    font-weight: bold;
    font-size: 1.1rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis; /* Si el nombre es muy largo, pone puntos suspensivos */
}

/* Área de botones e input */
.inbox-input-area {
    padding: 20px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    width: 100%;
    box-sizing: border-box;
}

/* Filas interiores para forzar que el input y botones se estiren al 100% */
.inbox-input-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    width: 100%;
}

.inbox-buttons-row {
    display: flex;
    gap: 15px;
    width: 100%;
}