/* Reset y variables CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #eeb201;
    --primary-hover: #bb8001;
    --secondary-color: #bb8001;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* Contenedor principal del chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 800px;
    margin: 0 auto;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

/* Header del chat */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 1rem;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bot-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.header-text {
    flex: 1;
}

.header-text h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.status {
    font-size: 0.875rem;
    opacity: 0.9;
}

.status.connected {
    color: var(--success-color);
}

.status.error {
    color: var(--danger-color);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Ocultar botón de configuración por defecto para visitantes */
#configBtn {
    display: none;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Mensajes del chat */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: fadeInUp 0.3s ease;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: var(--primary-color);
    color: white;
}

.user-message .message-avatar {
    background: var(--secondary-color);
    color: white;
}

.message-content {
    background: var(--surface);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    position: relative;
}

.message-content ul {
    padding-left: 15px; /* Puedes ajustar este valor (ej: 30px) si quieres más espacio */
}

.message-content li {
    margin-bottom: 0.2rem; /* Un poco de aire entre cada curso listado */
}

.user-message .message-content {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.message-content p {
    margin: 0;
    word-wrap: break-word;
}

.message-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.btn-speak {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
    font-size: 0.875rem;
}

.btn-speak:hover {
    color: var(--primary-color);
    background: var(--background);
}

.btn-speak.speaking {
    color: var(--success-color);
    animation: pulse 1s infinite;
}

/* Input del chat */
.chat-input-container {
    padding: 1rem;
    background: var(--surface);
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#messageInput {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 1rem;
    padding: 0.5rem;
}

.btn-send, .btn-mic {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send {
    background: var(--primary-color);
    color: white;
}

.btn-send:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.btn-send:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-mic {
    background: var(--secondary-color);
    color: white;
}

.btn-mic:hover {
    background: var(--danger-color);
    transform: scale(1.05);
}

.btn-mic.recording {
    background: var(--danger-color);
    animation: pulse 1s infinite;
}

.input-info {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.char-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    z-index: 1001;
    animation: modalSlideIn 0.3s ease;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.btn-close:hover {
    background: var(--background);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.config-section {
    margin-bottom: 2rem;
}

.config-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-toggle {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    background: var(--background);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-toggle:hover {
    background: var(--border-color);
}

.file-upload {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-upload {
    padding: 0.75rem 1rem;
    border: 2px dashed var(--border-color);
    background: var(--background);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-upload:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.file-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-secondary, .btn-primary {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.btn-secondary {
    background: var(--background);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Loading spinner */
.loading-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.loading-spinner.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

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

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
        border-radius: 0;
    }
    
    .message {
        max-width: 95%;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .header-text h1 {
        font-size: 1.125rem;
    }
    
    .input-wrapper {
        padding: 0.375rem;
    }
    
    .btn-send, .btn-mic {
        width: 36px;
        height: 36px;
    }
}

/* Scrollbar personalizado */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--background);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

