/* Variables de color personalizables (ajústalas según tu tema) */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --background-light: #ffffff;
    --background-soft: #f5f6fa;
    --text-color: #2c3e50;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --border-color: #dfe6e9;
}

/* Tema oscuro (opcional, basado en prefers-color-scheme) */
@media (prefers-color-scheme: dark) {
    :root {
        --background-light: #1a1a1a;
        --background-soft: #2d2d2d;
        --text-color: #ecf0f1;
        --shadow-color: rgba(0, 0, 0, 0.3);
        --border-color: #444444;
    }
}

#ai-chatbot-container {
    position: fixed;
    z-index: 9999;
    width: 320px;
    max-height: 80vh;
    background: var(--background-light);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    overflow: hidden;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    transition: max-height 0.3s ease, transform 0.3s ease;
}

#ai-chatbot-container.chatbot-minimized {
    max-height: 60px; /* Altura de la cabecera */
    overflow: hidden;
}

.chatbot-position-bottom-right {
    bottom: 0;
    right: 0;
}

.chatbot-position-bottom-left {
    bottom: 0;
    left: 0;
}

.chatbot-position-inline {
    position: relative;
    margin: 40px auto;
    max-width: 600px;
}

.ai-chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
    border-bottom: 1px solid var(--border-color);
}

.ai-toggle-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    padding: 0 8px;
    margin-left: 8px;
    transition: transform 0.3s ease;
}
.ai-toggle-btn:hover {
    color: #ecf0f1;
}

.ai-chatbot-header .ai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ffffff;
}

.ai-chatbot-messages {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
    background: var(--background-soft);
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--background-soft);
}
.ai-chatbot-messages::-webkit-scrollbar {
    width: 8px;
}
.ai-chatbot-messages::-webkit-scrollbar-track {
    background: var(--background-soft);
}
.ai-chatbot-messages::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 4px;
}

.ai-message {
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 6px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.4;
    background: #ecf0f1;
}

.ai-message-user {
    align-self: flex-end;
    background: #d1e8d1;
    margin-left: auto;
}

.ai-message-bot {
    align-self: flex-start;
    background: #e8ecef;
    margin-right: auto;
}

.ai-chatbot-input {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--background-light);
}

.ai-chatbot-input input[type="text"] {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s ease;
}
.ai-chatbot-input input[type="text"]:focus {
    border-color: var(--primary-color);
}

.ai-chatbot-input button {
    margin-left: 12px;
    padding: 10px 16px;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}
.ai-chatbot-input button:hover {
    background: var(--secondary-color);
}

.ai-contact-toggle {
    width: 100%;
    padding: 10px 16px;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    transition: background 0.3s ease;
}
.ai-contact-toggle:hover {
    background: var(--secondary-color);
}

.ai-contact-box {
    padding: 12px 16px;
    background: var(--background-soft);
    border-top: 1px solid var(--border-color);
    display: none;
}

.ai-contact-widget {
    margin-bottom: 12px;
}

.ai-contact-widget-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.ai-contact-widget a, .ai-contact-widget button {
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary-color);
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    margin-right: 8px;
    font-weight: 500;
    transition: background 0.3s ease;
}
.ai-contact-widget a:hover, .ai-contact-widget button:hover {
    background: var(--secondary-color);
}

.ai-restart-btn {
    background-color: #e74c3c;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 8px;
    font-weight: 500;
    transition: background 0.3s ease;
}
.ai-restart-btn:hover {
    background-color: #c0392b;
}

/* Estilo para el contenedor minimizado */
.ai-chatbot-minimized {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: var(--primary-color);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 2px 6px var(--shadow-color);
    z-index: 9998;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    transition: transform 0.3s ease;
}
.ai-chatbot-minimized:hover {
    transform: scale(1.05);
}
.ai-chatbot-minimized span {
    margin-right: 8px;
    font-size: 20px;
}
.ai-chatbot-minimized .minimized-text {
    font-size: 14px;
    font-weight: 500;
}

/* Animación de atención */
.attention-pulse {
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Responsive design */
@media (max-width: 480px) {
    #ai-chatbot-container {
        width: 90%;
        bottom: 0;
        left: 5%;
        right: 5%;
    }
    .ai-chatbot-header {
        font-size: 14px;
    }
    .ai-chatbot-input input[type="text"] {
        font-size: 12px;
    }
    .ai-restart-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    .ai-chatbot-minimized {
        bottom: 5px;
        right: 5px;
        padding: 6px 10px;
    }
    .ai-chatbot-minimized span {
        font-size: 18px;
    }
    .ai-chatbot-minimized .minimized-text {
        font-size: 12px;
    }
}