/* --- Variables Globales y Estilos Base --- */
:root {
    --ugt-red: #D32F2F;
    --ugt-red-dark: #B71C1C;
    --ugt-red-soft: #FFEBEE;
    --body-bg: #f7f8fc;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --card-bg: #ffffff;
    --border-color: #e9ecef;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* --- Estilos de la Barra de Navegación --- */
.navbar-brand img {
    /* filter: brightness(0) invert(1); */
}

/* --- Contenedor Principal del Formulario --- */
.triaje-container .lead {
    font-size: 1.1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Estilos de la Tarjeta (Card) --- */
.card {
    border: 1px solid var(--border-color);
    transition: all 0.3s ease-in-out;
}

/* --- Formulario por Pasos --- */
.form-step {
    display: none;
    animation: fadeIn 0.5s;
}

.form-step.active-step {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.progress-bar {
    transition: width 0.4s ease;
}

.bg-danger-soft {
    background-color: var(--ugt-red-soft);
}

.text-danger {
    color: var(--ugt-red) !important;
}

/* --- Estilos de Botones --- */
.btn {
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
}

.btn-lg {
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
}

.btn-danger {
    background-color: var(--ugt-red);
    border-color: var(--ugt-red);
}

.btn-danger:hover {
    background-color: var(--ugt-red-dark);
    border-color: var(--ugt-red-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(211, 47, 47, 0.2);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(25, 135, 84, 0.2);
}

/* --- Estilos de Campos de Formulario --- */
.form-select-lg, .form-control-lg {
    padding: 0.8rem 1rem;
    font-size: 1.1rem;
    border-radius: 0.5rem;
}

.form-select:focus, .form-control:focus {
    border-color: var(--ugt-red);
    box-shadow: 0 0 0 0.25rem rgba(211, 47, 47, 0.2);
}

/* --- Estilos del Pop-up de Chat --- */
.chat-popup-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
}

.chat-bubble {
    width: 60px;
    height: 60px;
    background-color: var(--ugt-red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.chat-bubble:hover {
    background-color: var(--ugt-red-dark);
    transform: scale(1.1);
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    max-width: 90vw;
    height: 500px;
    max-height: 80vh;
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease-in-out;
}

.chat-window.open {
    transform: scale(1);
}

.chat-header {
    background-color: var(--ugt-red);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-body {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: #f4f7f9;
}

.message {
    max-width: 80%;
    margin-bottom: 10px;
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.4;
}

.message p {
    margin: 0;
}

.message.received {
    background-color: #e9ecef;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.sent {
    background-color: var(--ugt-red);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-footer {
    padding: 10px;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-footer .form-control {
    border-radius: 20px;
}

/* --- Estilos para la Animación de "Escribiendo" en el Chat --- */
.typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #8e8e93;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-5px);
    }
}

/* --- Estilos para el Widget de Depuración --- */
#debug-console-widget {
    position: fixed;
    top: 80px; /* Un poco más abajo de la barra de navegación */
    right: 20px;
    width: 400px;
    max-width: 90vw;
    max-height: calc(100vh - 100px);
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    z-index: 1060; /* Por encima del chat */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    
    /* Estado inicial: oculto fuera de la pantalla */
    transform: translateX(110%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, visibility 0.3s;
}

#debug-console-widget.active {
    /* Estado visible: en su posición */
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

.debug-console-header {
    background-color: #343a40; /* Un gris oscuro */
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.debug-console-body {
    flex-grow: 1;
    overflow-y: auto;
}

.debug-pre {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.75rem;
    max-height: 200px; /* Altura máxima para cada sección */
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 0.8rem;
}

/* Estilos para el Widget de Depuración Visual */
.debug-visual-container {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
    font-size: 0.85rem;
}

.debug-visual-container ul {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 0;
}

.debug-visual-container li {
    padding: 4px 0;
    display: flex;
    align-items: center;
}

.debug-visual-container .bi {
    margin-right: 8px;
    color: #6c757d; /* Gris secundario de Bootstrap */
}

/* Estilos para la jerarquía en la Ruta Visual */
li.debug-step {
    font-weight: 600; /* Semibold */
}

li.debug-option, li.debug-field {
    padding-left: 20px; /* Indentación */
}

li.debug-field-option {
    padding-left: 40px; /* Doble indentación */
}

