#jamd-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#jamd-chat-tooltip {
    position: absolute;
    bottom: 18px;
    right: calc(100% + 15px);;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: popTooltip 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-color: var(--jamd-chat-color-tooltip-bg);
    color: var(--jamd-chat-color-tooltip-tx);
    border-radius: var(--jamd-chat-radius-tooltip); /* Enlace dinámico */
}

#jamd-chat-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background-color: var(--jamd-chat-color-tooltip-bg);
}

#jamd-chat-toggle {
    background-color: var(--jamd-chat-color-header);
    color: var(--jamd-chat-color-toggle-icon);
    border: none;
    border-radius: var(--jamd-chat-radius-toggle);
    width: 60px;
    height: 60px;
    cursor: pointer;
    box-shadow: rgba(8, 15, 26, 0.08) 0px 2px 8px 0px, rgba(8, 15, 26, 0.12) 0px 2px 2px 0px; 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    position: relative;
}

#jamd-chat-toggle:hover {
    transform: scale(1.05);
}

#jamd-chat-toggle i {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#jamd-chat-toggle .jamd-icon-closed {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

#jamd-chat-toggle .jamd-icon-opened {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

#jamd-chat-toggle.jamd-is-open .jamd-icon-closed {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

#jamd-chat-toggle.jamd-is-open .jamd-icon-opened {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

#jamd-chat-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    max-width: calc(100vw - 40px);
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 460px;
    transition: opacity 0.25s, transform 0.25s;
    transform-origin: bottom right;
    background: var(--jamd-chat-color-panel-bg);
    border-radius: var(--jamd-chat-radius-panel); /* Enlace dinámico */
}

#jamd-chat-panel.jamd-hidden {
    opacity: 0;
    transform: scale(0.85);
    pointer-events: none;
}

.jamd-chat-header {
    background-color: var(--jamd-chat-color-header);
    color: var(--jamd-chat-color-text-hdr);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.jamd-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.jamd-hdr-icon {
    background: transparent;
    border: none;
    color: var(--jamd-chat-color-text-hdr);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.jamd-hdr-icon:hover {
    background: rgba(255, 255, 255, 0.15);
}

.jamd-v-hidden {
    visibility: hidden;
    opacity: 0;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden;
}

#jamd-chat-close {
    background: transparent;
    border: none;
    color: var(--jamd-chat-color-text-hdr);
    font-size: 24px;
    cursor: pointer;
}

#jamd-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Burbujas de chat */
.jamd-msg {
    padding: 10px 14px;
    border-radius: 8px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}

.jamd-msg-bot {
    background-color: var(--jamd-chat-color-bot-bg);
    color: var(--jamd-chat-color-bot-txt);
    align-self: flex-start;
    border-top-left-radius: 0;
}

div.jamd-msg.jamd-msg-bot a{
    background-color: var(--jamd-chat-color-bot-bg);
    color: var(--jamd-chat-color-bot-txt);
    align-self: flex-start;
    border-top-left-radius: 0;
    color: #0566ff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
}

.jamd-msg-user {
    background-color: var(--jamd-chat-color-user-bg);
    color: var(--jamd-chat-color-user-txt);
    align-self: flex-end;
    border-top-right-radius: 0;
}

.jamd-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-self: flex-start;
}

.jamd-btn-option {
    background: #ffffff;
    padding: 9px 14px;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    transition: all 0.2s;
    font-weight: 400;
    border: 1px solid var(--jamd-chat-color-btn-txt);
    color: var(--jamd-chat-color-btn-txt);
    border-radius: var(--jamd-chat-radius-btn); /* Enlace dinámico */
}

.jamd-btn-option:hover {
    background-color: var(--jamd-chat-color-btn-hov);
    color: var(--jamd-chat-color-text-hdr) !important;
}

.jamd-btn-back-utility {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 12px auto 4px auto;
    padding: 7px 16px;
    background-color: rgba(255, 255, 255, 0.85); /* Efecto translúcido muy limpio */
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #666666; /* Tono gris neutro elegante para restar peso visual inicial */
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border-radius: var(--jamd-chat-radius-btn);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    align-self: center; /* Se posiciona simétricamente en el centro del eje vertical */
}

/* Control del Icono Vectorial */
.jamd-btn-back-utility svg {
    display: inline-block;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

/* Microinteracción en Estado Hover */
.jamd-btn-back-utility:hover {
    background-color: #ffffff;
    color: var(--jamd-chat-color-btn-txt); /* Cambia al color corporativo configurado */
    border-color: var(--jamd-chat-color-btn-txt);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* Efecto dinámico: la flecha se desplaza levemente simulando el retroceso */
.jamd-btn-back-utility:hover svg {
    transform: translateX(-3px);
}

@keyframes popTooltip {
    from { opacity: 0; transform: scale(0.8) translateX(10px); }
    to { opacity: 1; transform: scale(1) translateX(0); }
}

/* Nuevo Envoltorio Flexbox para alojar el botón WA a la derecha */
.jamd-chat-buttons-wrapper {
    display: flex;
    gap: 15px; /* Separación exacta entre ambos iconos */
    align-items: center;
    justify-content: flex-end;
}

/* Diseño del Botón Externo de WhatsApp */
#jamd-wa-toggle {
    background-color: var(--jamd-chat-color-wa-bg);
    color: var(--jamd-chat-color-wa-icon);
    border: none;
    border-radius: var(--jamd-chat-radius-toggle);
    width: 60px;
    height: 60px;
    cursor: pointer;
    box-shadow: rgba(8, 15, 26, 0.08) 0px 2px 8px 0px, rgba(8, 15, 26, 0.12) 0px 2px 2px 0px; 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    text-decoration: none; /* Asegura que el hipervínculo no herede subrayados del tema */
}

#jamd-wa-toggle:hover {
    transform: scale(1.05);
}