body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f0f0f0;
}

.chat-container {
    width: 100%;
    max-width: 600px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 80vh;
    margin-bottom: 40px;
    box-sizing: border-box;
}

.chat-header {
    background-color: var(--theme-color);
    color: #fff;
    padding: 10px;
    text-align: center;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h1 {
    margin: 0;
    font-size: 24px;
}

.environment-indicator {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.environment-indicator.production {
    background-color: #28a745;
}

.environment-indicator.development {
    background-color: #ffc107;
    color: #000;
}

.environment-indicator.testing {
    background-color: #17a2b8;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

.messages-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

.messages-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 16px;
    box-sizing: border-box;
}

.message {
    width: 100%;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.user-message {
    align-items: flex-end;
}

.user-message .message-content {
    background-color: var(--theme-color, #007bff);
    color: white;
    border-bottom-right-radius: 5px;
    border-radius: 15px;
    text-align: left;
    max-width: 80%;
    padding: 10px 15px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.bot-message {
    align-items: flex-start;
}

.bot-message .message-content {
    background-color: #e9ecef;
    color: #212529;
    border-bottom-left-radius: 5px;
    border-radius: 15px;
    text-align: left;
    max-width: 80%;
    padding: 10px 15px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.user-info {
    display: flex;
    padding: 10px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.user-info input {
    flex: 1;
    padding: 10px;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.user-info input:last-child {
    margin-right: 0;
}

.chat-input {
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-top: 1px solid #e0e0e0;
    background-color: #fff;
}

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

.input-container {
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

#userInput {
    width: 100%;
    padding: 10px 45px 10px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

.loading-indicator {
    color: #999;
    font-style: italic;
    padding: 10px;
    text-align: left;
    align-self: flex-start;
    animation: blink 1s ease-in-out infinite;
}

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

#clearSessionButton {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

#clearSessionButton:disabled {
    background-color: #6c757d;
    color: #fff;
    cursor: not-allowed;
}

#clearSessionButton:not(:disabled):hover {
    background-color: #c82333;
}

.error-message {
    color: #dc3545;
    font-weight: bold;
    padding: 10px;
    text-align: left;
    align-self: flex-start;
}

/* Estilos para dispositivos móviles */
@media (max-width: 768px) {
    body, html {
        height: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    .chat-container {
        display: flex;
        flex-direction: column;
        height: 100vh;
        max-height: -webkit-fill-available; /* Para iOS */
        margin-bottom: 50px;
    }

    .chat-header {
        flex-shrink: 0;
    }

    .user-info {
        flex-shrink: 0;
    }

    .chat-messages {
        flex-grow: 1;
        overflow-y: auto;
    }

    .chat-input {
        flex-shrink: 0;
        display: flex;
        padding: 8px;
        background-color: #fff;
        position: sticky;
        bottom: 0;
    }

    .input-wrapper {
        gap: 8px;
    }

    #userInput {
        flex-grow: 1;
        margin-right: 10px;
        font-size: 14px;
    }

    #sendButton {
        white-space: nowrap;
    }

    .audio-waveform {
        min-width: 60px;
        max-width: 110px;
    }
    
    .wave-bar {
        min-width: 1px;
        max-width: 1px;
    }
    
    .audio-time {
        min-width: 54px;
        font-size: 11px;
    }

    .custom-audio-player {
        gap: 4px;
        padding: 4px;
        min-width: auto;
    }
    
    .message-content {
        max-width: 280px;
        padding-right: 20px;
    }
    
    .audio-time {
        min-width: 54px;
    }
}

/* Ajuste adicional para pantallas muy pequeñas */
@media (max-width: 320px) {
    .chat-input {
        flex-direction: column;
    }

    #userInput {
        margin-right: 0;
        margin-bottom: 10px;
    }

    #sendButton {
        width: 100%;
    }
}

.language-selector {
    padding: 5px 10px;
    border: 1px solid var(--theme-color);
    border-radius: 4px;
    background-color: white;
    color: var(--theme-color);
    cursor: pointer;
}

.language-selector:hover {
    background-color: var(--theme-color);
    color: white;
}

/* Contenedor de los botones */
.button-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Estilos base para todos los botones circulares */
.record-button,
.send-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background-color: var(--theme-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Cuando hay texto, mostrar botón de enviar y ocultar micrófono */
.input-container.has-text .send-button {
    display: flex;
}

.input-container.has-text .record-button {
    display: none;
}

/* Mostrar botón de adjuntar cuando está habilitado */
.attach-button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    transition: background-color 0.2s;
}

.attach-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.attach-icon {
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%236c757d' viewBox='0 0 24 24'%3E%3Cpath d='M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.attach-button:hover .attach-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23007bff' viewBox='0 0 24 24'%3E%3Cpath d='M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z'/%3E%3C/svg%3E");
}

/* Estilos hover para los botones */
.record-button:hover,
.send-button:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

/* Estilos active para los botones */
.record-button:active,
.send-button:active,
.record-button.recording {
    transform: scale(0.97);
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.3),
                inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Estilos base para los iconos */
.record-icon,
.send-icon {
    width: 24px;
    height: 24px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Estilos específicos para el icono de micrófono */
.record-icon::before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFFFFF' d='M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: all 0.2s ease;
}

/* Estilos específicos para el icono de enviar */
.send-icon::before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFFFFF' d='M2.01 21L23 12 2.01 3 2 10l15 2-15 2z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: all 0.2s ease;
}

/* Animación para el botón de grabación */
.record-button.recording .record-icon {
    animation: gentle-pulse 1.5s infinite;
}

@keyframes gentle-pulse {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
    100% { transform: scale(0.95); }
}

/* Soporte para temas claros */
@media (prefers-color-scheme: light) {
    .record-button[style*="--theme-color: #fff"],
    .record-button[style*="--theme-color: #ffffff"],
    .record-button[style*="--theme-color: rgb(255, 255, 255)"],
    .send-button[style*="--theme-color: #fff"],
    .send-button[style*="--theme-color: #ffffff"],
    .send-button[style*="--theme-color: rgb(255, 255, 255)"] {
        .record-icon::before,
        .send-icon::before {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000000' d='M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z'/%3E%3C/svg%3E");
        }
    }
}

.send-button {
    display: none;  /* Inicialmente oculto */
}

/* Estilos para el botón de play/pause */
.play-button {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    border: none;
    background-color: var(--theme-color, #007bff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

/* Icono de play */
.play-icon {
    width: 24px;
    height: 24px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-icon::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 10px solid white;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    margin-left: 3px;
}

/* Icono de pausa */
.pause-icon {
    width: 24px;
    height: 24px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.pause-icon::before,
.pause-icon::after {
    content: '';
    width: 4px;
    height: 14px;
    background-color: white;
    border-radius: 2px;
}

.bot-message .play-button {
    background-color: #f1f0f0;
}

.bot-message .play-icon::before {
    border-left-color: #666;
}

.bot-message .pause-icon::before,
.bot-message .pause-icon::after {
    background-color: #666;
}

/* Mantener los estilos de la onda de audio */
.audio-waveform {
    display: flex;
    align-items: center;
    gap: 1px;
    min-width: 80px;
    max-width: 130px;
    margin: 0 4px;
    height: 24px;
}

.wave-bar {
    flex: 1;
    height: 100%;
    min-width: 1px;
    max-width: 2px;
    background-color: var(--theme-color, #007bff);
    opacity: 0.3;
    border-radius: 1px;
}

.user-message .wave-bar {
    background-color: white;
    opacity: 0.7;
}

.audio-message {
    width: 100%;
    box-sizing: border-box;
}

.audio-time {
    font-size: 12px;
    color: #666;
    min-width: 70px;
    text-align: right;
    white-space: nowrap;
}

.user-message .audio-time {
    color: white;
}

.bot-message .audio-time {
    color: #666;
}

.recording-wave {
    display: none;
    align-items: center;
    gap: 3px;
    height: 20px;
    margin-right: 10px;
}

.recording-bar {
    width: 3px;
    height: 100%;
    background-color: var(--theme-color);
    border-radius: 3px;
    animation: recording-wave 1s ease-in-out infinite;
}

.recording-wave .recording-bar:nth-child(1) { animation-delay: 0.0s; }
.recording-wave .recording-bar:nth-child(2) { animation-delay: 0.1s; }
.recording-wave .recording-bar:nth-child(3) { animation-delay: 0.2s; }
.recording-wave .recording-bar:nth-child(4) { animation-delay: 0.3s; }
.recording-wave .recording-bar:nth-child(5) { animation-delay: 0.4s; }
.recording-wave .recording-bar:nth-child(6) { animation-delay: 0.5s; }
.recording-wave .recording-bar:nth-child(7) { animation-delay: 0.6s; }
.recording-wave .recording-bar:nth-child(8) { animation-delay: 0.7s; }

@keyframes recording-wave {
    0%, 100% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
}

/* Mostrar la onda cuando se está grabando */
.recording .recording-wave {
    display: flex;
}

.file-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
}

.file-message .attach-icon {
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23666666' d='M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.bot-message .file-message .attach-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23666666' d='M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z'/%3E%3C/svg%3E");
}

.file-message .file-name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 28px); /* 28px = 20px del icono + 8px del gap */
}

.file-preview {
    margin-bottom: 8px;
    background-color: rgba(var(--theme-color-rgb), 0.1);
    border-radius: 8px;
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
}

.file-preview-content {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.preview-icon {
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='currentColor' d='M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z'/%3E%3C/svg%3E");
    background-size: contain;
    opacity: 0.7;
}

.preview-filename {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9em;
    color: #666;
}

.remove-file {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.remove-file:hover {
    color: #666;
}

.file-separator {
    border: 0;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.3);
    margin: 8px 0;
    width: 100%;
}

.file-message {
    margin-top: 8px;
}

.message .file-message {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.9;
    padding: 4px 0;
    width: 100%;
    overflow: hidden;
}

/* Ajustar el margen cuando hay archivo adjunto */
.message .file-message:last-child {
    margin-bottom: 4px;
}

/* Hacer el ícono de adjunto más visible cuando está dentro de un mensaje */
.message .file-message .attach-icon {
    transform: scale(0.9);
    opacity: 1;
}

/* Ajustar el color del texto del archivo para mensajes del usuario */
.user-message .file-message .file-name {
    color: white;
    font-size: 0.95em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ajustar el color del icono para mensajes del usuario */
.user-message .file-message .attach-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFFFFF' d='M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z'/%3E%3C/svg%3E");
}

.file-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.file-separator {
    border: 0;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.3);
    margin: 8px 0;
    width: 100%;
}

.message .file-message {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.9;
    padding: 4px 0;
}

/* Hacer el ícono de adjunto más visible cuando está dentro de un mensaje */
.message .file-message .attach-icon {
    transform: scale(0.9);
    opacity: 1;
}

/* Ajustar el color del texto del archivo para mensajes del usuario */
.user-message .file-message .file-name {
    color: white;
    font-size: 0.95em;
}

/* Ajustar el color del icono para mensajes del usuario */
.user-message .file-message .attach-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFFFFF' d='M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z'/%3E%3C/svg%3E");
}

.typing-indicator-container {
    width: 100%;
    display: none;
    justify-content: flex-start;
    margin-top: 8px;
    margin-bottom: 8px;
    z-index: 1;
}

.typing-indicator {
    max-width: 80%;
}

.typing-indicator-content {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 10px 15px;
    background-color: #f0f0f0;
    border-radius: 15px;
    border-bottom-left-radius: 5px;
}

.typing-indicator-content span {
    width: 8px;
    height: 8px;
    background: var(--theme-color, #007bff);
    border-radius: 50%;
    display: inline-block;
    opacity: 0.4;
    animation: blink 1s infinite;
}

.typing-indicator-content span:nth-child(1) { animation-delay: 0.1s; }
.typing-indicator-content span:nth-child(2) { animation-delay: 0.3s; }
.typing-indicator-content span:nth-child(3) { animation-delay: 0.5s; }

@keyframes blink {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.system-message {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
    text-align: center;
    animation: fadeIn 0.3s ease-in-out;
}

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

.error-message {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
    text-align: center;
    animation: fadeIn 0.3s ease-in-out;
}

.attribution {
    text-align: center;
    padding: 10px;
    font-size: 14px;
    color: #666;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #f8f9fa;
    border-top: 1px solid #eee;
}

.attribution a {
    color: var(--theme-color);
    text-decoration: none;
    font-weight: 500;
}

.attribution a:hover {
    text-decoration: underline;
}

/* Estilos para mensajes de audio */
.audio-message {
    width: 100%;
    box-sizing: border-box;
}

/* Botón de reproducción */
.play-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: var(--theme-color, #007bff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

/* Iconos de play/pause */
.play-icon,
.pause-icon {
    width: 24px;
    height: 24px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-icon::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 12px solid white;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    margin-left: 4px;
}

.pause-icon::before,
.pause-icon::after {
    content: '';
    width: 5px;
    height: 16px;
    background-color: white;
    border-radius: 2px;
    margin: 0;
}

.pause-icon {
    gap: 2px;
}

/* Forma de onda */
.audio-waveform {
    display: flex;
    align-items: center;
    gap: 1px;
    min-width: 80px;
    max-width: 130px;
    margin: 0 4px;
    height: 24px;
}

.wave-bar {
    flex: 1;
    height: 100%;
    min-width: 1px;
    max-width: 2px;
    background-color: var(--theme-color, #007bff);
    opacity: 0.3;
    border-radius: 1px;
}

/* Estilos específicos para mensajes del usuario */
.user-message .message-content .audio-message {
    background-color: transparent;
}

.user-message .play-button {
    background-color: white;
}

.user-message .play-icon::before {
    border-left-color: var(--theme-color);
}

.user-message .pause-icon::before,
.user-message .pause-icon::after {
    background-color: var(--theme-color);
}

.user-message .wave-bar {
    background-color: white;
    opacity: 0.7;
}

/* Estilos específicos para mensajes del bot */
.bot-message .play-button {
    background-color: var(--theme-color);
}

.bot-message .wave-bar {
    background-color: #666;
    opacity: 0.5;
}

/* Animación de la onda */
@keyframes wave {
    0%, 100% {
        transform: scaleY(0.3);
    }
    50% {
        transform: scaleY(1);
    }
}

.wave-bar.playing {
    animation: wave 1s ease-in-out infinite;
}

/* Mensaje de audio */
.audio-message {
    width: 100%;
    box-sizing: border-box;
}

.message-wrapper {
    width: 100%;
    position: relative;
    padding-right: 40px;
    box-sizing: border-box;
}

/* Vista de audio */
.audio-view {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* Vista de texto */
.text-view {
    display: none;
    padding: 10px 30px 10px 10px;
    color: inherit;
}

.text-view.active {
    display: block;
}

.audio-view.hidden {
    display: none;
}

/* Botón de alternar vista */
.toggle-view-button {
    position: absolute;
    right: 10px;
    top: 18px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: all 0.2s ease;
    z-index: 10;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-view-button:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Icono de texto */
.text-icon {
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23666666' d='M14,17H7V15H14M17,13H7V11H17M17,9H7V7H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Icono de audio */
.audio-icon {
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23666666' d='M12,3V12.26C11.5,12.09 11,12 10.5,12C8.56,12 7,13.56 7,15.5C7,17.44 8.56,19 10.5,19C12.44,19 14,17.44 14,15.5V6H18V3H12Z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Ajustes para mensajes del bot */
.bot-message .text-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23666666' d='M14,17H7V15H14M17,13H7V11H17M17,9H7V7H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z'/%3E%3C/svg%3E");
}

.bot-message .audio-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23666666' d='M12,3V12.26C11.5,12.09 11,12 10.5,12C8.56,12 7,13.56 7,15.5C7,17.44 8.56,19 10.5,19C12.44,19 14,17.44 14,15.5V6H18V3H12Z'/%3E%3C/svg%3E");
}

/* Ajustes para mensajes del usuario */
.user-message .text-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23007bff' d='M14,17H7V15H14M17,13H7V11H17M17,9H7V7H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z'/%3E%3C/svg%3E");
}

.user-message .audio-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23007bff' d='M12,3V12.26C11.5,12.09 11,12 10.5,12C8.56,12 7,13.56 7,15.5C7,17.44 8.56,19 10.5,19C12.44,19 14,17.44 14,15.5V6H18V3H12Z'/%3E%3C/svg%3E");
}

.user-message .toggle-view-button {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.user-message .toggle-view-button:hover {
    background-color: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.message-content {
    max-width: 350px;
    width: fit-content;
    position: relative;
    padding-right: 50px;
    padding-top: 15px;
}

/* Reproductor de audio personalizado */
.custom-audio-player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    width: 100%;
}

.bot-message .custom-audio-player {
    min-width: 255px;
}

/* Botón de play/pause */
.play-button {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    border: none;
    background-color: var(--theme-color, #007bff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

/* Contenedor de ondas */
.audio-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 80px;
    max-width: 130px;
    margin: 0 4px;
}

/* Contador de tiempo */
.audio-time {
    font-size: 12px;
    color: #666;
    min-width: 70px;
    text-align: right;
    white-space: nowrap;
    margin-left: 2px;
}

/* Ajustes para mensajes del usuario */
.user-message .audio-time {
    color: white;
}

/* Ajustes para mensajes del bot */
.bot-message .audio-time {
    color: #666;
}
