/* ============================================================
   ESTILOS GENERALES - RIZZOLI BOT (Versión Restaurada)
   ============================================================ */

:root {
    --color-primario: #007bff;
    --color-primario-oscuro: #0056b3;
    --color-fondo: #f4f7f6;
    --color-fondo-secundario: #ffffff;
    --color-borde: #dee2e6;
    --color-texto: #212529;
    --color-texto-secundario: #6c757d;
    --color-burbuja-bot: #e9ecef;
    --color-burbuja-paciente: #dcf8c6;
    --color-burbuja-secretaria: #fff;
    
    /* Colores Específicos */
    --color-admin: #34495e;
    --color-stats: #6610f2;
    --color-success: #28a745;
    --color-success-bg: #e8f5e9;
    --color-success-border: #c3e6cb;
    --color-error: #dc3545;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--color-fondo);
    display: flex;
    height: 100vh;
    color: var(--color-texto);
    overflow: hidden; 
}

/* ============================================================
   SIDEBAR (Columna Izquierda)
   ============================================================ */
#sidebar {
    width: 300px;
    background: #fff;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    flex-shrink: 0; 
}

#sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

#sidebar-nav {
    display: flex;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
}

/* ESTILO DE LAS PESTAÑAS */
.nav-tab {
    flex: 1;
    border: none;
    background: none;
    padding: 12px 5px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    position: relative;
    text-align: center;
    border-bottom: 3px solid transparent;
}

.nav-tab:hover {
    background: #e9ecef;
}

.nav-tab.active {
    color: var(--color-primario);
    font-weight: bold;
    border-bottom: 3px solid var(--color-primario);
    background: #fff;
}

/* ESTILO DE LA LISTA DE CHATS */
#lista-chats {
    list-style: none; /* Quitamos los puntos */
    padding: 0;
    margin: 0;
    flex: 1; 
    overflow-y: auto;
}

#lista-chats li {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

#lista-chats li:hover {
    background: #f9f9f9;
}

#lista-chats li.selected {
    background: #e8f0fe;
    border-left: 4px solid var(--color-primario);
}

/* Footer del Sidebar */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
}

.sidebar-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sidebar-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-admin { background: var(--color-admin); color: white; }
.btn-stats { background: var(--color-stats); color: white; }

/* ============================================================
   ÁREA PRINCIPAL (Chat y Datos)
   ============================================================ */
#main-content {
    flex: 1;
    display: flex;
    background: #fff;
    overflow: hidden;
}

/* SECCION IZQUIERDA: CHAT */
#chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #ddd;
}

#chat-header {
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #ddd;
    background: #fff;
}

#historial-chat {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #e5ddd5;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-blend-mode: soft-light;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Burbujas de Chat */
.mensaje-chat { padding: 9px 12px; border-radius: 8px; max-width: 70%; font-size: 14px; line-height: 1.4; position: relative; }
.mensaje-bot { background: var(--color-burbuja-bot); align-self: flex-start; border-top-left-radius: 0; }
.mensaje-paciente { background: var(--color-burbuja-paciente); align-self: flex-end; border-top-right-radius: 0; }
.mensaje-secretaria { background: var(--color-burbuja-secretaria); align-self: flex-start; border: 1px solid #ddd; border-top-left-radius: 0; }

#area-respuesta {
    padding: 15px;
    background: #f0f0f0;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 10px;
    align-items: center;
}

#input-respuesta {
    flex: 1;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none;
}

.btn-chat { border: none; padding: 10px; border-radius: 50%; cursor: pointer; color: white; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.btn-enviar { background: var(--color-primario); }
.btn-proponer { background: #28a745; }
.btn-rescatar { background: #ff9800; }
.btn-chat:disabled { opacity: 0.6; cursor: not-allowed; }

/* SECCION DERECHA: INFO PACIENTE */
#info-panel {
    width: 320px;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.info-header {
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.info-title { margin: 0; font-size: 1rem; color: #333; }
.info-toolbar { display: flex; align-items: center; gap: 5px; }

#info-panel-datos {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

#info-panel-datos p {
    font-size: 13px;
    border-bottom: 1px dashed #eee;
    padding-bottom: 5px;
    margin-bottom: 8px;
}
#info-panel-datos strong { color: #0056b3; width: 100px; display: inline-block; }

/* Utilidades (Badges, botones pequeños) */
.badge {
    background: var(--color-texto-secundario);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    margin-left: 5px;
}
#badge-pendientes { background: var(--color-error); }
.nav-tab.active #badge-en-espera, #badge-en-espera { background: var(--color-primario); }

.btn-icon-transparent {
    background: transparent; border: none; cursor: pointer; color: #666; font-size: 1.1rem; padding: 5px; border-radius: 50%; transition: all 0.2s;
}
.btn-icon-transparent:hover { background: #eee; color: var(--color-primario); }

.btn-sound-toggle {
    background: var(--color-success-bg); border: 1px solid var(--color-success-border); color: var(--color-success);
    border-radius: 20px; padding: 2px 10px; font-size: 11px; font-weight: bold; cursor: pointer; display: flex; align-items: center; gap: 5px;
}

.separator-vertical { width: 1px; height: 20px; background: #ddd; margin: 0 5px; }

/* Botones genéricos */
.btn-warning { background: #ffc107; color: #333; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-danger { background: #dc3545; color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; }

/* ESTILOS DE ESTADISTICAS (Heredados y mejorados) */
.stats-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #f4f7f6; z-index: 2000; display: flex; flex-direction: column; }
.stats-header { background: #333; color: white; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; }
.stats-nav { display: flex; background: #e9ecef; padding: 0 20px; border-bottom: 1px solid #ddd; }
.stats-tab { padding: 15px 20px; border: none; background: transparent; cursor: pointer; font-weight: bold; color: #666; border-bottom: 3px solid transparent; }
.stats-tab.active { color: var(--color-primario); border-bottom: 3px solid var(--color-primario); background: white; }
.stats-content { padding: 20px; overflow-y: auto; flex: 1; }
.btn-close { background: transparent; border: 1px solid white; color: white; padding: 5px 10px; cursor: pointer; border-radius: 4px; }

.table-responsive { overflow-x: auto; margin-top: 15px; background: white; border-radius: 8px; padding: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid #eee; font-size: 13px; }
th { background: #f8f9fa; font-weight: 600; color: #555; }

/* Modales */
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 3000; }
.modal-content { background: white; padding: 20px; border-radius: 8px; width: 90%; max-width: 500px; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }

@media print {
    #sidebar, #main-content, .stats-header, .stats-nav, .no-print { display: none !important; }
    .stats-overlay { position: static; display: block !important; background: white; }
    body { overflow: auto; background: white; }
}