* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #74BB6B 0%, #5a9952 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    font-size: 18px; /* Tamaño base más grande */
}

.container {
    width: 100%;
    max-width: 1000px;
    height: 90vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-header {
    background: linear-gradient(135deg, #74BB6B 0%, #5a9952 100%);
    color: white;
    padding: 20px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-top h1 {
    flex-shrink: 0;
    margin: 0;
    flex: 1;
}


.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

/* Selector de tipo de usuario */
.user-type-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 10px;
    flex-shrink: 0;
}

.user-type-selector label {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

#user-type-select {
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    background: white;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    font-weight: 500;
}

#user-type-select:hover {
    background: #f0f0f0;
}

/* Selector de voces */
.voice-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 10px;
    flex-shrink: 0;
}

.voice-selector label {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

#voice-select {
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    background: white;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    font-weight: 500;
}

#voice-select:hover {
    background: #f0f0f0;
}

.chat-header h1 {
    font-size: 32px; /* Más grande */
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Logo en el header */
.header-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.header-title {
    display: inline-block;
}

/* Instrucciones para usuarios */
.instructions {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    margin-top: 15px;
    color: #333;
    transition: all 0.3s ease;
    overflow: hidden;
}

.instructions-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease;
}

.instructions-toggle:hover {
    background: rgba(116, 187, 107, 0.1);
}

.toggle-icon {
    font-size: 24px;
}

.toggle-text {
    font-size: 20px;
    font-weight: 600;
    color: #2c5f2d;
    flex: 1;
    line-height: 1.4;
}

.toggle-arrow {
    font-size: 14px;
    color: #74BB6B;
    transition: transform 0.3s ease;
}

.instructions-content {
    padding: 0 20px 20px 20px;
    max-height: 500px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.instructions.collapsed .instructions-content {
    max-height: 0;
    opacity: 0;
    padding: 0 20px;
    overflow: hidden;
}

.instructions.collapsed {
    background: rgba(255, 255, 255, 0.8);
}

.instructions-content p {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #2c5f2d;
}

.instructions-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.instructions-content li {
    font-size: 18px;
    padding: 10px 0;
    color: #444;
    line-height: 1.6;
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 10px;
    flex-shrink: 0;
}

.model-selector label {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

#model-select {
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    background: white;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

#refresh-models {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

#refresh-models:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Toggle RAG */
.rag-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: 0.4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #74BB6B;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Botón de documentos */
.docs-button,
.manage-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 8px 15px;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
    font-weight: 500;
}

.docs-button:hover,
.manage-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

#docs-count {
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: bold;
}

/* Panel de documentos */
.docs-panel {
    position: absolute;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.docs-panel.open {
    right: 0;
}

.docs-panel-header {
    background: linear-gradient(135deg, #74BB6B 0%, #5a9952 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.docs-panel-header h3 {
    font-size: 18px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 20px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.docs-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.doc-item {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #74BB6B;
}

.doc-item h4 {
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
    word-break: break-word;
}

.doc-item .doc-info {
    font-size: 12px;
    color: #666;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 10px;
    flex-shrink: 0;
    white-space: nowrap;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffc107;
    animation: pulse 2s infinite;
}

.status-indicator.connecting {
    background: #ffc107;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: #74BB6B;
    animation: none;
}

.status-indicator.error {
    background: #f44336;
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-right: 80px; /* Espacio reducido para las reacciones */
    background: #f5f5f5;
}

.welcome-message {
    text-align: center;
    color: #333;
    margin-top: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.welcome-message h2 {
    color: #2c5f2d;
    margin-bottom: 20px;
    font-size: 36px; /* Más grande */
    font-weight: 700;
}

.welcome-text {
    font-size: 20px; /* Más grande */
    line-height: 1.8;
    margin-bottom: 15px;
    color: #444;
}

.welcome-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
}

.welcome-list li {
    font-size: 20px; /* Más grande */
    padding: 12px 20px;
    margin: 10px 0;
    background: rgba(116, 187, 107, 0.1);
    border-radius: 10px;
    border-left: 4px solid #74BB6B;
    color: #333;
    font-weight: 500;
}

.message {
    margin-bottom: 25px; /* Más espacio */
    display: flex;
    gap: 15px; /* Más espacio */
    animation: fadeIn 0.3s;
    position: relative;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 50px; /* Más grande */
    height: 50px; /* Más grande */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px; /* Más grande */
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #74BB6B 0%, #5a9952 100%);
}

.message.bot .message-avatar {
    background: #ffffff;
    padding: 0;
    overflow: hidden;
    border: 2px solid #74BB6B;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Estilo para la imagen del avatar */
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    /* Recortar para mostrar solo el centro (el recuadro con el logo) */
    transform: scale(1.8);
}

.message-content {
    max-width: 75%; /* Más ancho */
    padding: 18px 22px; /* Más padding */
    border-radius: 18px;
    line-height: 1.8; /* Más espacio entre líneas */
    word-wrap: break-word;
    font-size: 19px; /* Texto más grande */
}

.message.user .message-content {
    background: linear-gradient(135deg, #74BB6B 0%, #5a9952 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.message.bot .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Asegurar que el contenido de texto dentro del message-content no herede el flex */
.message.bot .message-content > *:not(.rating-container) {
    flex: 0 0 auto;
}

/* Estilos para contenido Markdown en mensajes del bot */
.message.bot .message-content h1,
.message.bot .message-content h2,
.message.bot .message-content h3,
.message.bot .message-content h4,
.message.bot .message-content h5,
.message.bot .message-content h6 {
    margin-top: 16px;
    margin-bottom: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: #2c5f2d;
}

.message.bot .message-content h1 { font-size: 1.8em; }
.message.bot .message-content h2 { font-size: 1.5em; }
.message.bot .message-content h3 { font-size: 1.3em; }
.message.bot .message-content h4 { font-size: 1.1em; }

.message.bot .message-content h1:first-child,
.message.bot .message-content h2:first-child,
.message.bot .message-content h3:first-child {
    margin-top: 0;
}

.message.bot .message-content p {
    margin-bottom: 12px;
    line-height: 1.8;
}

.message.bot .message-content p:last-child {
    margin-bottom: 0;
}

.message.bot .message-content ul,
.message.bot .message-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.message.bot .message-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.message.bot .message-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #d63384;
}

.message.bot .message-content pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    border-left: 4px solid #74BB6B;
}

.message.bot .message-content pre code {
    background: none;
    padding: 0;
    color: #333;
    font-size: 0.95em;
}

.message.bot .message-content blockquote {
    border-left: 4px solid #74BB6B;
    padding-left: 16px;
    margin: 12px 0;
    color: #666;
    font-style: italic;
}

.message.bot .message-content a {
    color: #74BB6B;
    text-decoration: none;
    border-bottom: 1px solid #74BB6B;
}

.message.bot .message-content a:hover {
    color: #5a9952;
    border-bottom-color: #5a9952;
}

.message.bot .message-content strong {
    font-weight: 600;
    color: #2c5f2d;
}

.message.bot .message-content em {
    font-style: italic;
}

.message.bot .message-content hr {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 20px 0;
}

.message.bot .message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.message.bot .message-content table th,
.message.bot .message-content table td {
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
    text-align: left;
}

.message.bot .message-content table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #2c5f2d;
}

.message.bot .message-content table tr:nth-child(even) {
    background: #fafafa;
}

.message.bot .message-content.loading {
    display: flex;
    gap: 5px;
    padding: 20px;
}

/* Fuentes de información */
.sources {
    margin-top: 10px;
    padding: 10px;
    background: rgba(116, 187, 107, 0.1);
    border-radius: 8px;
    font-size: 12px;
}

.sources-title {
    font-weight: bold;
    color: #74BB6B;
    margin-bottom: 5px;
}

.source-item {
    padding: 4px 0;
    color: #666;
}

.typing-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.typing-indicator .spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #74BB6B;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Botón para ver texto de audio */
.toggle-text-btn {
    padding: 12px 20px; /* Más grande */
    border: 2px solid #74BB6B; /* Borde más grueso */
    background: white;
    color: #74BB6B;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px; /* Más grande */
    margin-top: 12px;
    transition: all 0.3s;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-text-btn:hover {
    background: #74BB6B;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Contenedor del texto transcrito */
.response-text {
    margin-top: 15px;
    padding: 18px; /* Más padding */
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 18px; /* Más grande */
    line-height: 1.8; /* Más espacio */
    color: #333;
    border-left: 4px solid #74BB6B; /* Borde más grueso */
}

.input-container {
    padding: 25px;
    background: white;
    border-top: 2px solid #e0e0e0;
    display: flex;
    gap: 15px;
    align-items: center;
}

#user-input {
    flex: 1;
    padding: 18px 22px; /* Más grande */
    border: 3px solid #d0d0d0; /* Borde más visible */
    border-radius: 15px;
    font-size: 19px; /* Más grande */
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.3s;
    max-height: 150px;
    line-height: 1.6;
}

#user-input:focus {
    border-color: #74BB6B;
    border-width: 3px;
}

#send-button {
    min-width: 100px; /* Más ancho */
    height: 60px; /* Más alto */
    border: none;
    border-radius: 12px; /* Rectangular redondeado */
    background: linear-gradient(135deg, #74BB6B 0%, #5a9952 100%);
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#send-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

#send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Botón de voz */
.voice-button {
    min-width: 100px; /* Más ancho */
    height: 60px; /* Más alto */
    border: none;
    border-radius: 12px; /* Rectangular redondeado */
    background: linear-gradient(135deg, #74BB6B 0%, #5a9952 100%);
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.voice-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

/* Etiquetas de botones */
.button-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#voice-icon, #send-icon {
    font-size: 24px;
}

.voice-button.recording {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.voice-button.processing {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    cursor: wait;
}

#send-button:active:not(:disabled) {
    transform: scale(0.95);
}

/* Scrollbar personalizado */
.chat-container::-webkit-scrollbar,
.docs-panel-content::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track,
.docs-panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-container::-webkit-scrollbar-thumb,
.docs-panel-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover,
.docs-panel-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Panel de gestión de documentos */
.manage-panel {
    position: absolute;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.manage-panel.open {
    right: 0;
}

.manage-panel-header {
    background: linear-gradient(135deg, #74BB6B 0%, #5a9952 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.manage-panel-header h3 {
    font-size: 18px;
}

.manage-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.manage-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.manage-section:last-child {
    border-bottom: none;
}

.manage-section h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 16px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h4 {
    margin-bottom: 0;
}

/* Área de subida de archivos */
.upload-area {
    border: 2px dashed #74BB6B;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 15px;
    background: rgba(116, 187, 107, 0.05);
}

.upload-area:hover {
    background: rgba(116, 187, 107, 0.1);
    border-color: #5a9952;
}

.upload-area.dragover {
    background: rgba(116, 187, 107, 0.15);
    border-color: #5a9952;
    transform: scale(1.02);
}

.upload-placeholder {
    color: #666;
}

.upload-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.upload-progress {
    padding: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #74BB6B 0%, #5a9952 100%);
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    color: #666;
    font-size: 14px;
}

/* Botones de acción */
.action-btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.primary-btn {
    background: linear-gradient(135deg, #74BB6B 0%, #5a9952 100%);
    color: white;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(116, 187, 107, 0.3);
}

.danger-btn {
    background: #f44336;
    color: white;
}

.danger-btn:hover {
    background: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.icon-btn {
    background: rgba(116, 187, 107, 0.1);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.icon-btn:hover {
    background: rgba(116, 187, 107, 0.2);
}

/* Lista de documentos en gestión */
.docs-list-container {
    max-height: 200px;
    overflow-y: auto;
}

.manage-doc-item {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #74BB6B;
}

.manage-doc-info {
    flex: 1;
}

.manage-doc-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
    margin-bottom: 4px;
    word-break: break-word;
}

.manage-doc-meta {
    font-size: 12px;
    color: #666;
}

.delete-doc-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

.delete-doc-btn:hover {
    background: #d32f2f;
}

/* Estadísticas de chunks */
.chunks-stats {
    background: rgba(116, 187, 107, 0.1);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.chunks-stats p {
    color: #333;
    font-size: 14px;
}

.chunks-stats strong {
    color: #74BB6B;
    font-size: 18px;
}

/* Lista de chunks */
.chunks-container {
    max-height: 300px;
    overflow-y: auto;
}

.chunk-item {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 3px solid #74BB6B;
}

.chunk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.chunk-id {
    font-size: 11px;
    color: #999;
    font-family: monospace;
}

.chunk-filename {
    font-weight: 500;
    color: #74BB6B;
    font-size: 12px;
}

.chunk-preview {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* Mensajes de estado */
.loading,
.empty-state {
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 14px;
}

.empty-state {
    color: #666;
}

/* Scrollbar para panel de gestión */
.manage-panel-content::-webkit-scrollbar,
.docs-list-container::-webkit-scrollbar,
.chunks-container::-webkit-scrollbar {
    width: 6px;
}

.manage-panel-content::-webkit-scrollbar-track,
.docs-list-container::-webkit-scrollbar-track,
.chunks-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.manage-panel-content::-webkit-scrollbar-thumb,
.docs-list-container::-webkit-scrollbar-thumb,
.chunks-container::-webkit-scrollbar-thumb {
    background: #74BB6B;
    border-radius: 3px;
}

.manage-panel-content::-webkit-scrollbar-thumb:hover,
.docs-list-container::-webkit-scrollbar-thumb:hover,
.chunks-container::-webkit-scrollbar-thumb:hover {
    background: #5a9952;
}

/* ==================== SISTEMA DE CALIFICACIÓN ==================== */

/* Contenedor de calificación - Estilo reacción al costado */
.rating-container {
    position: absolute;
    right: 80px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: transparent;
    border-radius: 25px;
    transition: all 0.3s ease;
    z-index: 10;
}

.rating-container:hover {
    background: #f0f2f5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 6px;
}

.rating-container.rated {
    background: transparent;
}

.rating-container.rated:hover {
    background: #f0f2f5;
}

/* Título de calificación - Oculto */
.rating-title {
    display: none;
}

/* Contenedor de opciones de calificación */
.rating-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* Botones de calificación (caritas) */
.rating-btn {
    background: white;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    padding: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Mostrar todas las opciones al hacer hover en el contenedor */
.rating-container:hover .rating-btn {
    display: flex;
}

/* El botón por defecto (feliz) siempre visible */
.rating-btn.default-visible {
    display: flex !important;
}

.rating-btn:hover:not(:disabled) {
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.rating-btn:active:not(:disabled) {
    transform: scale(1.05);
}

.rating-btn:disabled:not(.selected) {
    cursor: not-allowed;
    opacity: 0;
    display: none !important;
}

/* Mantener la carita seleccionada visible */
.rating-btn.selected {
    display: flex !important;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Emoji de calificación */
.rating-emoji {
    font-size: 24px;
    display: block;
    line-height: 1;
    transition: transform 0.2s ease;
}

.rating-btn:hover:not(:disabled) .rating-emoji {
    transform: scale(1.1);
}

.rating-btn.selected .rating-emoji {
    transform: scale(1.05);
}

/* Colores específicos para cada nivel (aplicados dinámicamente) */
.rating-btn[data-rating="1"]:hover {
    background: #ffe8e8;
}

.rating-btn[data-rating="2"]:hover {
    background: #fff4e8;
}

.rating-btn[data-rating="3"]:hover {
    background: #e8f8e8;
}

/* Mensaje de agradecimiento - Oculto en nuevo diseño */
.rating-thanks {
    display: none;
}

/* Tooltips para las caritas */
.rating-btn::after {
    content: attr(title);
    position: absolute;
    left: -100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 100;
    margin-left: -10px;
}

.rating-btn:hover::after {
    opacity: 1;
}

/* Mostrar todas las opciones en móvil con clase especial */
.rating-container.show-all-mobile .rating-btn {
    display: flex !important;
}

/* Ajustes para dispositivos móviles */
@media (max-width: 768px) {
    .rating-container {
        right: -45px;
        padding: 2px;
    }
    
    .rating-btn {
        width: 32px;
        height: 32px;
    }
    
    .rating-emoji {
        font-size: 18px;
    }
    
    .rating-options {
        gap: 2px;
    }
    
    .rating-btn::after {
        display: none;
    }
}

/* Animación de entrada para el contenedor */
@keyframes ratingFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

.rating-container {
    animation: ratingFadeIn 0.3s ease;
}

/* Animación al aparecer las opciones */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.rating-container:hover .rating-btn,
.rating-container.show-all-mobile .rating-btn {
    animation: slideIn 0.2s ease forwards;
}

.rating-container:hover .rating-btn:nth-child(1),
.rating-container.show-all-mobile .rating-btn:nth-child(1) {
    animation-delay: 0s;
}

.rating-container:hover .rating-btn:nth-child(2),
.rating-container.show-all-mobile .rating-btn:nth-child(2) {
    animation-delay: 0.05s;
}

.rating-container:hover .rating-btn:nth-child(3),
.rating-container.show-all-mobile .rating-btn:nth-child(3) {
    animation-delay: 0.1s;
}

/* ==================== FIN SISTEMA DE CALIFICACIÓN ==================== */

/* Botón de gestión de documentos en header */
.manage-docs-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.manage-docs-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}


/* Panel activo */
.manage-panel.active {
    right: 0;
}

.docs-panel.active {
    right: 0;
}

/* Cuadrícula de documentos */
.docs-grid {
    display: grid;
    gap: 12px;
}

.doc-card {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
}

.doc-card:hover {
    border-color: #74BB6B;
    box-shadow: 0 4px 12px rgba(116, 187, 107, 0.2);
    transform: translateY(-2px);
}

.doc-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-meta {
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 10px;
}

/* Cuadrícula de chunks */
.chunks-grid {
    display: grid;
    gap: 10px;
}

.chunk-card {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s;
}

.chunk-card:hover {
    border-color: #74BB6B;
    box-shadow: 0 2px 8px rgba(116, 187, 107, 0.15);
}

.chunk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.chunk-filename {
    font-size: 12px;
    color: #74BB6B;
    font-weight: 500;
}

.chunk-index {
    font-size: 11px;
    color: #999;
    background: #e0e0e0;
    padding: 2px 6px;
    border-radius: 4px;
}

.chunk-preview {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 8px;
}

.chunk-meta {
    font-size: 11px;
    color: #999;
}

.chunks-note {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 10px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
}

/* Área de drag and drop activa */
.upload-area.drag-over {
    background: rgba(116, 187, 107, 0.2);
    border-color: #5a9952;
    transform: scale(1.02);
}

/* Estados de mensaje */
.error {
    color: #f44336;
    text-align: center;
    padding: 15px;
}


/* Panel de configuración */
.settings-panel {
    position: absolute;
    top: 0;
    right: -100%;
    width: 380px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.settings-panel.open,
.settings-panel.active {
    right: 0;
}

.settings-panel-header {
    background: linear-gradient(135deg, #74BB6B 0%, #5a9952 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-panel-header h3 {
    font-size: 18px;
    margin: 0;
}

.settings-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.settings-section {
    margin-bottom: 20px;
}

.settings-section label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.settings-section select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #d0d0d0;
    border-radius: 10px;
    font-size: 16px;
    background: white;
    color: #333;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s;
}

.settings-section select:focus {
    border-color: #74BB6B;
}

/* Botón de configuración (visible en todas las pantallas) */
.settings-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 45px;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

/* Responsive - Pantallas medianas (tablets y laptops pequeñas) */
@media (max-width: 1200px) {
    .container {
        max-width: 95%;
        height: 95vh;
    }
    
    .header-right {
        gap: 8px;
    }
    
    .settings-btn,
    .manage-docs-btn {
        padding: 8px 12px;
        font-size: 18px;
    }
    
    .status {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .manage-panel {
        width: 400px;
    }
    
    .settings-panel {
        width: 350px;
    }
}

@media (max-width: 1024px) {
    .chat-header h1 {
        font-size: 28px;
        margin-bottom: 10px;
    }
    
    .header-top {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
    }
    
    .header-right {
        display: flex;
        gap: 8px;
        justify-content: flex-end;
        flex: 0 0 auto;
    }
    
    .instructions {
        padding: 15px;
    }
    
    .instructions p {
        font-size: 18px;
    }
    
    .instructions li {
        font-size: 16px;
        padding: 8px 0;
    }
    
    .message-content {
        font-size: 17px;
        padding: 16px 20px;
    }
    
    .welcome-message h2 {
        font-size: 32px;
    }
    
    .welcome-text,
    .welcome-list li {
        font-size: 18px;
    }
}

/* Responsive - Móviles */
@media (max-width: 768px) {
    /* Ajustar panel de configuración en móvil */
    .settings-panel {
        width: 100%;
        right: -100%;
    }
    
    /* Ajustar ancho del panel de gestión en móvil */
    .manage-panel {
        width: 100%;
    }
    
    .settings-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 45px;
        height: 45px;
        font-size: 24px;
        padding: 0;
        flex-shrink: 0;
    }
    
    body {
        padding: 0;
    }
    
    .container {
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }

    .chat-header {
        padding: 15px;
    }
    
    /* Reducir padding derecho en móviles para las reacciones */
    .chat-container {
        padding: 15px;
        padding-right: 50px; /* Espacio reducido para reacciones en móvil */
    }
    
    .chat-header h1 {
        font-size: 22px;
        flex: 0 1 auto;
        margin: 0;
        text-align: left;
        margin-bottom: 0;
    }
    
    .header-logo {
        width: 55px;
        height: 55px;
    }

    .header-top {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        margin-bottom: 10px;
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    
    /* Mantener header-right visible en móvil */
    .header-right {
        display: flex !important;
        gap: 8px;
        flex: 0 0 auto;
        justify-content: flex-end;
        align-items: center;
    }
    
    /* Asegurar que status y settings-btn sean visibles */
    .header-right .status {
        display: flex !important;
    }
    
    .header-right .settings-btn {
        display: flex !important;
    }

    .header-controls {
        width: 100%;
    }
    
    .instructions-toggle {
        padding: 12px 15px;
    }
    
    .toggle-icon {
        font-size: 18px;
    }
    
    .toggle-text {
        font-size: 14px;
    }
    
    .toggle-arrow {
        font-size: 12px;
    }
    
    .instructions-content {
        padding: 0 15px 15px 15px;
    }
    
    .instructions-content p {
        font-size: 16px;
    }
    
    .instructions-content li {
        font-size: 14px;
        padding: 6px 0;
    }

    .message-content {
        max-width: 85%;
        font-size: 16px;
        padding: 14px 18px;
    }
    
    .welcome-message {
        padding: 20px;
        margin-top: 20px;
    }
    
    .welcome-message h2 {
        font-size: 28px;
    }
    
    .welcome-text,
    .welcome-list li {
        font-size: 16px;
    }
    
    .input-container {
        padding: 15px;
        gap: 10px;
    }
    
    #user-input {
        font-size: 16px;
        padding: 14px 16px;
    }
    
    .voice-button,
    #send-button {
        min-width: 70px;
        height: 50px;
    }
    
    #voice-icon, #send-icon {
        font-size: 20px;
    }
    
    .button-label {
        font-size: 11px;
    }

    .docs-panel,
    .manage-panel {
        width: 100%;
        right: -100%;
    }
}

/* Responsive - Pantallas muy pequeñas */
@media (max-width: 480px) {
    .chat-header h1 {
        font-size: 18px;
    }
    
    .header-logo {
        width: 55px;
        height: 55px;
    }
    
    .header-top {
        gap: 8px;
    }
    
    .status {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .settings-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .model-selector label,
    .user-type-selector label,
    .voice-selector label {
        display: none;
    }
    
    .voice-button,
    #send-button {
        min-width: 60px;
        height: 45px;
    }
    
    .button-label {
        display: none;
    }
    
    #voice-icon, #send-icon {
        font-size: 24px;
    }
}
