/* Chatbot INTELECTA - Tema Corregido con Fade */
.chatbot-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: #1a1a1a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    color: white;
    border: 2px solid #333;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    background: #2a2a2a;
}

.chatbot-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #333;
    transition: all 0.3s ease;
}

.chatbot-window.open {
    display: flex;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tema Claro - Aplicado al body para mejor control */
body.chatbot-light-theme .chatbot-window {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.chatbot-header {
    background: #2a2a2a;
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #333;
    transition: all 0.3s ease;
}

body.chatbot-light-theme .chatbot-header {
    background: #00aaff;
    color: white;
    border-bottom: 1px solid #e0e0e0;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.chatbot-icon {
    display: flex;
    align-items: center;
    gap: 3px;
}

.voice-bar {
    width: 3px;
    height: 15px;
    background: #00aaff;
    border-radius: 2px;
    animation: voice-animation 1.5s infinite ease-in-out;
}

body.chatbot-light-theme .voice-bar {
    background: #ffffff;
}

@keyframes voice-animation {
    0%, 100% { 
        height: 5px;
    }
    50% { 
        height: 15px;
    }
}

.theme-toggle {
    background: none;
    border: none;
    color: #ccc;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.3s ease;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.1);
}

body.chatbot-light-theme .theme-toggle {
    color: white;
}

body.chatbot-light-theme .theme-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.chatbot-close {
    background: none;
    border: none;
    color: #ccc;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.chatbot-close:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

body.chatbot-light-theme .chatbot-close {
    color: white;
}

body.chatbot-light-theme .chatbot-close:hover {
    background: rgba(255,255,255,0.2);
}

.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #1a1a1a;
    transition: background 0.3s ease;
}

body.chatbot-light-theme .chatbot-messages {
    background: #ffffff;
}

/* Efecto Fade para mensajes */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar personalizado */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 3px;
}

body.chatbot-light-theme .chatbot-messages::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #00aaff;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #0077cc;
}

.msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.msg.bot {
    align-self: flex-start;
}

.msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-content {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    color: white;
    word-wrap: break-word;
    transition: all 0.3s ease;
}

.msg.bot .msg-content {
    background: #2a2a2a;
    border: 1px solid #333;
    border-bottom-left-radius: 5px;
    color: white;
}

body.chatbot-light-theme .msg.bot .msg-content {
    background: #f0f8ff;
    border: 1px solid #e0e0e0;
    color: #333;
    border-bottom-left-radius: 5px;
}

.msg.user .msg-content {
    background: #00aaff;
    border-bottom-right-radius: 5px;
    color: white;
}

body.chatbot-light-theme .msg.user .msg-content {
    background: #0077cc;
    color: white;
}

.typing .msg-content {
    font-style: italic;
    color: #aaa;
}

body.chatbot-light-theme .typing .msg-content {
    color: #666;
}

.typing-dots {
    display: inline-block;
    animation: typingDots 1.5s infinite;
}

@keyframes typingDots {
    0%, 20% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

.chatbot-input {
    padding: 15px;
    border-top: 1px solid #333;
    display: flex;
    gap: 10px;
    background: #2a2a2a;
    transition: all 0.3s ease;
}

body.chatbot-light-theme .chatbot-input {
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.chatbot-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #444;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    background: #1a1a1a;
    color: white;
    transition: all 0.3s ease;
}

.chatbot-input input:focus {
    border-color: #00aaff;
}

body.chatbot-light-theme .chatbot-input input {
    background: white;
    border: 1px solid #ddd;
    color: #333;
}

body.chatbot-light-theme .chatbot-input input:focus {
    border-color: #00aaff;
}

.chatbot-input input::placeholder {
    color: #888;
}

body.chatbot-light-theme .chatbot-input input::placeholder {
    color: #999;
}

.chatbot-send {
    background: #00aaff;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    font-weight: 500;
}

.chatbot-send:hover {
    background: #0077cc;
    transform: translateY(-1px);
}

.chatbot-contact-buttons {
    padding: 0 15px 15px;
    display: flex;
    gap: 10px;
    background: #2a2a2a;
    transition: background 0.3s ease;
}

body.chatbot-light-theme .chatbot-contact-buttons {
    background: #f8f9fa;
}

.contact-button {
    flex: 1;
    padding: 10px;
    border: 1px solid #00aaff;
    border-radius: 8px;
    background: transparent;
    color: #00aaff;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    font-weight: 500;
}

.contact-button:hover {
    background: #00aaff;
    color: white;
    transform: translateY(-1px);
}

body.chatbot-light-theme .contact-button {
    border: 1px solid #0077cc;
    color: #0077cc;
}

body.chatbot-light-theme .contact-button:hover {
    background: #0077cc;
    color: white;
}

/* Estilos del formulario */
#ajax_contact {
    display: none;
    padding: 15px;
    max-height: 100%;
    overflow-y: auto;
    background: #1a1a1a;
    color: white;
    animation: formFadeIn 0.3s ease;
    transition: all 0.3s ease;
}

body.chatbot-light-theme #ajax_contact {
    background: white;
    color: #333;
}

@keyframes formFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#ajax_contact label {
    display: block;
    margin-bottom: 5px;
    color: #ccc;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.3s ease;
}

body.chatbot-light-theme #ajax_contact label {
    color: #666;
}

.chatbot-input-field {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #444;
    border-radius: 5px;
    font-size: 14px;
    background: #2a2a2a;
    color: white;
    transition: all 0.3s ease;
}

.chatbot-input-field:focus {
    border-color: #00aaff;
    outline: none;
}

body.chatbot-light-theme .chatbot-input-field {
    background: white;
    border: 1px solid #ddd;
    color: #333;
}

.date-time-field {
    color-scheme: dark;
}

body.chatbot-light-theme .date-time-field {
    color-scheme: light;
}

.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.cancel-button {
    background: #666;
}

.cancel-button:hover {
    background: #555;
    transform: translateY(-1px);
}

body.chatbot-light-theme .cancel-button {
    background: #6c757d;
}

body.chatbot-light-theme .cancel-button:hover {
    background: #5a6268;
}

.close-form-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #ccc;
    transition: color 0.3s;
}

.close-form-button:hover {
    color: white;
}

body.chatbot-light-theme .close-form-button {
    color: #666;
}

body.chatbot-light-theme .close-form-button:hover {
    color: #333;
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-window {
        width: 300px;
        height: 450px;
        right: 10px;
    }
    
    .chatbot-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}