/**
 * Estilos para el Chatbot
 * Clínica Microdental
 */

/* Variables */
:root {
    --chatbot-primary: #B85170;
    --chatbot-primary-dark: #a03962;
    --chatbot-bg: #ffffff;
    --chatbot-text: #333333;
    --chatbot-gray: #f5f5f5;
    --chatbot-border: #e0e0e0;
    --chatbot-shadow: 0 5px 40px rgba(0,0,0,0.16);
}

/* Botón flotante del chatbot */
.chatbot-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(183, 73, 110, 0.3);
    cursor: pointer;
    z-index: 9998;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(183, 73, 110, 0.4);
}

.chatbot-button.active {
    background: linear-gradient(135deg, #666 0%, #444 100%);
}

/* Icono del botón */
.chatbot-button-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.chatbot-button-icon svg {
    position: absolute;
    color: white;
    transition: all 0.3s ease;
}

.chatbot-button-icon .chat-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.chatbot-button-icon .close-icon {
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
}

.chatbot-button.active .chat-icon {
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
}

.chatbot-button.active .close-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Badge de notificación */
.chatbot-button-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
    animation: pulse 2s infinite;
    display: none;
}

.chatbot-button-badge.show {
    display: flex;
}

/* Texto flotante del botón */
.chatbot-button-text {
    position: absolute;
    right: 70px;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    white-space: nowrap;
    font-size: 14px;
    color: var(--chatbot-text);
    opacity: 0;
    pointer-events: none;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

.chatbot-button:hover .chatbot-button-text {
    opacity: 1;
    transform: translateX(0);
}

/* Ventana del chatbot */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 600px;
    background: var(--chatbot-bg);
    border-radius: 16px;
    box-shadow: var(--chatbot-shadow);
    z-index: 9997;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header del chat */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    color: white;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chatbot-avatar-text {
    font-size: 20px;
    font-weight: bold;
    font-family: 'Coolvetica', sans-serif;
}

.chatbot-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #4caf50;
    border-radius: 50%;
    border: 2px solid var(--chatbot-primary);
}

.chatbot-header-info {
    flex: 1;
}

.chatbot-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-minimize {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    transition: opacity 0.3s ease;
}

.chatbot-minimize:hover {
    opacity: 0.7;
}

/* Área de mensajes */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

/* Divisor de fecha */
.chatbot-date-divider {
    text-align: center;
    margin: 10px 0;
}

.chatbot-date-divider span {
    background: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    color: #999;
}

/* Mensajes */
.chatbot-message {
    margin-bottom: 16px;
    animation: messageIn 0.3s ease;
}

.chatbot-message.bot {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.chatbot-message.user {
    display: flex;
    justify-content: flex-end;
}

.chatbot-message-avatar {
    width: 28px;
    height: 28px;
    background: var(--chatbot-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.chatbot-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chatbot-message.bot .chatbot-message-content {
    background: white;
    color: var(--chatbot-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chatbot-message.user .chatbot-message-content {
    background: var(--chatbot-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* Indicador de escribiendo */
.chatbot-typing {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border-top: 1px solid var(--chatbot-border);
}

.typing-indicator {
    display: flex;
    gap: 3px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

.typing-text {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* Área de opciones */
.chatbot-options {
    padding: 16px;
    background: white;
    border-top: 1px solid var(--chatbot-border);
    max-height: 200px;
    overflow-y: auto;
}

.chatbot-options:empty {
    display: none;
}

.chatbot-option-button {
    display: block;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: white;
    border: 2px solid var(--chatbot-primary);
    border-radius: 25px;
    color: var(--chatbot-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.chatbot-option-button:last-child {
    margin-bottom: 0;
}

.chatbot-option-button:hover {
    background: var(--chatbot-primary);
    color: white;
    transform: translateX(5px);
}

/* Footer del chat */
.chatbot-footer {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid var(--chatbot-border);
    border-radius: 0 0 16px 16px;
}

.chatbot-footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-restart {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    transition: all 0.3s ease;
}

.chatbot-restart:hover {
    color: var(--chatbot-primary);
    transform: rotate(180deg);
}

.chatbot-footer-text {
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-footer-text::before {
    content: "🔒";
    font-size: 12px;
}

.chatbot-interaction-counter {
    font-size: 12px;
    color: #999;
    font-weight: 500;
}

.chatbot-interaction-counter #interaction-count {
    color: var(--chatbot-primary);
    font-weight: bold;
}

/* Animaciones */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
    }
}

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-button {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
    
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        right: 10px;
        bottom: 80px;
        border-radius: 12px;
    }
    
    .chatbot-message-content {
        max-width: 80%;
    }
    
    .chatbot-option-button {
        font-size: 13px;
        padding: 10px 14px;
    }
}