/* ==========================================================================
   ESTILOS MODERNOS DEL CHATBOT - ODONTO ESTÉTICA
   ========================================================================== */

/* Contenedor flotante general */
.denti-chatbot-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Tooltip / Píldora de bienvenida */
.denti-chat-tooltip {
    position: absolute;
    bottom: 74px;
    right: 0;
    background: #ffffff;
    color: #041e49;
    padding: 10px 16px;
    border-radius: 20px;
    box-shadow: 0 10px 25px -5px rgba(11, 87, 208, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    border: 1px solid #e2e8f0;
    animation: dentiFadeInUp 0.4s ease-out;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.denti-chat-tooltip:hover {
    transform: translateY(-2px);
}

.denti-tooltip-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    margin-left: 4px;
    line-height: 1;
}

.denti-tooltip-close:hover {
    color: #ef4444;
}

/* Botón flotante disparador */
.denti-chat-launcher {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0b57d0 0%, #0043a8 100%);
    border: 3px solid #ffffff;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(11, 87, 208, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
}

.denti-chat-launcher:hover {
    transform: scale(1.08) rotate(3deg);
    box-shadow: 0 12px 28px rgba(11, 87, 208, 0.45);
}

.denti-chat-launcher:active {
    transform: scale(0.95);
}

/* Punto verde de 'En línea' */
.denti-online-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background-color: #10b981;
    border-radius: 50%;
    border: 2px solid #ffffff;
    animation: dentiPulse 2s infinite;
}

/* Íconos de alternancia dentro del launcher */
.denti-chat-launcher .icon-open {
    display: block;
}
.denti-chat-launcher .icon-close {
    display: none;
}
.denti-chatbot-wrapper.is-open .denti-chat-launcher .icon-open {
    display: none;
}
.denti-chatbot-wrapper.is-open .denti-chat-launcher .icon-close {
    display: block;
}
.denti-chatbot-wrapper.is-open .denti-chat-tooltip {
    display: none !important;
}

/* ==========================================================================
   VENTANA DEL CHAT
   ========================================================================== */
.denti-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 570px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 40px -15px rgba(4, 30, 73, 0.2), 0 0 1px 1px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e9f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9) translateY(20px);
    transform-origin: bottom right;
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.2), visibility 0.28s;
}

.denti-chatbot-wrapper.is-open .denti-chat-window {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

/* Cabecera del chat */
.denti-chat-header {
    background: linear-gradient(135deg, #041e49 0%, #0b57d0 100%);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.denti-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.denti-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #ffffff;
    color: #0b57d0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    position: relative;
    flex-shrink: 0;
}

.denti-avatar-badge {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    background-color: #10b981;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.denti-header-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    color: #ffffff;
}

.denti-header-status {
    font-size: 11px;
    color: #93c5fd;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.denti-header-actions {
    display: flex;
    gap: 6px;
}

.denti-btn-action {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.denti-btn-action:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Área de mensajes */
.denti-chat-body {
    flex: 1;
    padding: 18px 16px;
    background: #f8fafd;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* Divisor de tiempo */
.denti-chat-date {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    margin: 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Fila de mensaje */
.denti-msg-row {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: dentiFadeIn 0.25s ease-out;
}

.denti-msg-row.bot {
    align-self: flex-start;
}

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

.denti-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0b57d0;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Burbuja de texto */
.denti-msg-bubble {
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
}

.denti-msg-row.bot .denti-msg-bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.denti-msg-row.user .denti-msg-bubble {
    background: #0b57d0;
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(11, 87, 208, 0.2);
}

.denti-msg-bubble a {
    color: #0b57d0;
    font-weight: 700;
    text-decoration: underline;
}

.denti-msg-row.user .denti-msg-bubble a {
    color: #ffffff;
}

.denti-msg-bubble strong {
    font-weight: 700;
    color: #041e49;
}

.denti-msg-row.user .denti-msg-bubble strong {
    color: #ffffff;
}

.denti-msg-time {
    display: block;
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.65;
    text-align: right;
}

/* Píldoras de botones rápidos (Opciones guiadas) */
.denti-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    padding-left: 36px;
}

.denti-action-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0b57d0;
    padding: 6px 12px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.denti-action-btn:hover {
    background: #0b57d0;
    color: #ffffff;
    border-color: #0b57d0;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(11, 87, 208, 0.2);
}

/* Indicador de "Escribiendo..." */
.denti-typing-row {
    display: none;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
}

.denti-typing-bubble {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.denti-dot {
    width: 6px;
    height: 6px;
    background: #0b57d0;
    border-radius: 50%;
    animation: dentiBounce 1.4s infinite ease-in-out both;
}

.denti-dot:nth-child(1) { animation-delay: -0.32s; }
.denti-dot:nth-child(2) { animation-delay: -0.16s; }

/* Pie del chat e Input */
.denti-chat-footer {
    padding: 12px 14px 10px 14px;
    background: #ffffff;
    border-top: 1px solid #e5e9f0;
}

.denti-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 4px 6px 4px 14px;
    transition: border-color 0.2s, background 0.2s;
}

.denti-chat-form:focus-within {
    border-color: #0b57d0;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.12);
}

.denti-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13.5px;
    color: #1e293b;
    outline: none;
    font-family: inherit;
}

.denti-chat-input::placeholder {
    color: #94a3b8;
    font-size: 12.5px;
}

.denti-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #0b57d0;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.denti-chat-send:hover {
    background: #0043a8;
    transform: scale(1.05);
}

.denti-chat-disclaimer {
    font-size: 10px;
    color: #94a3b8;
    text-align: center;
    margin-top: 6px;
    line-height: 1.2;
}

/* ==========================================================================
   ANIMACIONES
   ========================================================================== */
@keyframes dentiPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes dentiBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

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

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

/* Scrollbar personalizada */
.denti-chat-body::-webkit-scrollbar {
    width: 5px;
}
.denti-chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.denti-chat-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* ==========================================================================
   RESPONSIVIDAD MÓVIL
   ========================================================================== */
@media (max-width: 480px) {
    .denti-chatbot-wrapper {
        bottom: 16px;
        right: 16px;
    }
    .denti-chat-window {
        width: calc(100vw - 32px);
        height: 75vh;
        bottom: 74px;
        right: 0;
    }
    .denti-chat-tooltip {
        display: none;
    }
}
