/* CZ Chatbot – Frontend Styles */
#cz-chatbot-wrapper {
    position: fixed;
    z-index: 999999;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 12px;
}
#cz-chatbot-wrapper.cz-pos-bottom-right { right: 24px; }
#cz-chatbot-wrapper.cz-pos-bottom-left  { left: 24px; align-items: flex-start; }

/* ── Botón principal ─────────────────────────────────────── */
/*
   IMPORTANTE: El botón SIEMPRE es visible.
   Nunca ocultar con opacity/visibility desde el wrapper.
*/
.cz-main-toggle {
    position: relative;
    width: 58px; height: 58px; border-radius: 50%;
    background: var(--cz-primary, #6C2BD9);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    transition: transform .2s, box-shadow .2s;
    outline: none;
    z-index: 2;
    /* Siempre visible — sin opacity 0 aquí */
    opacity: 1;
    visibility: visible;
}
.cz-main-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0,0,0,0.3); }
.cz-main-toggle:active { transform: scale(0.96); }

/* Iconos dentro del botón */
.cz-toggle-icon { display: flex; align-items: center; justify-content: center; }

/* ── Menú de acciones ────────────────────────────────────── */
/*
   El menú sale ENCIMA del botón (margin-bottom).
   Empieza oculto y aparece con hover en el wrapper o clase .cz-menu-open.
   El botón está FUERA del menú → el hover no se rompe al moverse hacia las opciones.
*/
.cz-action-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity .22s ease, transform .22s ease;
}
#cz-chatbot-wrapper.cz-pos-bottom-left .cz-action-menu {
    align-items: flex-start;
}

/* Click en móvil (toggle manual) */
.cz-action-menu.cz-menu-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.cz-contact-wrap {
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 12px;
}

/* Cada item: label + botón en fila */
.cz-action-item {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}
#cz-chatbot-wrapper.cz-pos-bottom-left .cz-action-item {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* Label */
.cz-action-label {
    background: white;
    color: #1F2937;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    white-space: nowrap;
    font-family: inherit;
    /* Animación de entrada para los labels */
    transition: opacity .15s ease, transform .15s ease;
}

/* Botones de acción */
.cz-action-btn {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: none; cursor: pointer;
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
    transition: transform .2s, box-shadow .2s;
    text-decoration: none;
    flex-shrink: 0;
    position: relative;
}
.cz-action-btn:hover { transform: scale(1.1); box-shadow: 0 5px 18px rgba(0,0,0,0.25); }

.cz-action-whatsapp { background: #25D366; }
.cz-action-email    { background: #EF4444; }
.cz-action-phone    { background: #22C55E; }
.cz-action-chat     { background: var(--cz-primary, #6C2BD9); }

/* Badge en botón chat */
.cz-unread-badge {
    position: absolute; top: -4px; right: -4px;
    background: #EF4444; color: white;
    font-size: 11px; font-weight: 700;
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid white; pointer-events: none;
}

/* ── Ventana del chat ────────────────────────────────────── */
.cz-chat-window {
    position: fixed;
    bottom: 90px;
    right: 90px;
    width: 360px;
    max-height: 520px;
    min-height: 400px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px) scale(0.97);
    transition: opacity .25s, transform .25s, visibility .25s;
    z-index: 999998;
}

.cz-pos-bottom-right .cz-chat-window {
    right: 90px;
    bottom: 90px;
}

.cz-pos-bottom-left .cz-chat-window {
    left: 90px;
    bottom: 90px;
}

.cz-chat-window.cz-open {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* Header */
.cz-chat-header {
    background: var(--cz-primary, #6C2BD9);
    padding: 14px 16px;
    display: flex; align-items: center; justify-content: space-between;
    color: white;
}
.cz-chat-header-info { display: flex; align-items: center; gap: 10px; }
.cz-chat-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center; color: white;
}
.cz-chat-name  { display: block; font-size: 14px; font-weight: 700; line-height: 1.2; }
.cz-chat-status { display: block; font-size: 11px; opacity: .75; }
.cz-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ADE80; display: inline-block; margin-right: 4px; }
.cz-chat-close {
    background: transparent; border: none; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: background .2s;
}

/* Mensajes */
.cz-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cz-chat-messages::-webkit-scrollbar { width: 4px; }
.cz-chat-messages::-webkit-scrollbar-track { background: transparent; }
.cz-chat-messages::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 2px; }

/* Burbujas */
.cz-msg { display: flex; gap: 8px; align-items: flex-end; animation: czFadeIn .25s ease; }
@keyframes czFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.cz-msg-bot  { flex-direction: row; }
.cz-msg-user { flex-direction: row-reverse; }
.cz-msg-avatar {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    background: var(--cz-primary, #6C2BD9);
    display: flex; align-items: center; justify-content: center; color: white; font-size: 13px;
}
.cz-bubble { max-width: 80%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.55; word-break: break-word; }
.cz-msg-bot  .cz-bubble { background: #F3F4F6; color: #1F2937; border-bottom-left-radius: 4px; }
.cz-msg-user .cz-bubble { background: var(--cz-primary, #6C2BD9); color: white; border-bottom-right-radius: 4px; }

/* Typing */
.cz-typing .cz-bubble { background: #F3F4F6; padding: 12px 16px; }
.cz-typing-dots { display: flex; gap: 4px; align-items: center; }
.cz-typing-dots span { width: 7px; height: 7px; background: #9CA3AF; border-radius: 50%; animation: czBounce 1.2s infinite ease-in-out; }
.cz-typing-dots span:nth-child(1) { animation-delay: 0s; }
.cz-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.cz-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes czBounce { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-6px); opacity: 1; } }

/* Input */
.cz-chat-input-wrap {
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
    background: #fff;
}.cz-chat-input-row {
    display: flex; align-items: center; gap: 8px;
    background: white; border: 1px solid #E5E7EB;
    border-radius: 12px; padding: 6px 6px 6px 12px; transition: border-color .2s;
}
.cz-chat-input-row:focus-within { border-color: var(--cz-primary, #6C2BD9); box-shadow: 0 0 0 3px rgba(108,43,217,0.1); }
.cz-chat-input { flex: 1; border: none; outline: none; resize: none; font-size: 14px; line-height: 1.5; max-height: 100px; background: transparent; color: #1F2937; font-family: inherit; }
.cz-chat-send {
    width: 36px; height: 36px; border-radius: 8px; border: none;
    background: var(--cz-primary, #6C2BD9); color: white;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: opacity .2s, transform .15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25); overflow: hidden;
}
.cz-chat-send svg { display: block; fill: white; width: 18px; height: 18px; min-width: 18px; min-height: 18px; pointer-events: none; }

/* Error */
.cz-msg-error .cz-bubble { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* Responsive */
@media (max-width: 400px) {
    .cz-chat-window { width: calc(100vw - 32px); right: 0 !important; left: 0 !important; margin: 0 auto; }
    #cz-chatbot-wrapper.cz-pos-bottom-right,
    #cz-chatbot-wrapper.cz-pos-bottom-left { right: 16px; left: 16px; }
}

#cz-open-chat-btn {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
}

/* apartado FAQS */

.cz-faqs-wrap {
    padding: 10px 16px 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid #f0f0f0;
    background: #fff;
}

.cz-faqs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cz-faqs-header-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9CA3AF;
    white-space: nowrap;
}

.cz-faqs-header-line {
    flex: 1;
    height: 1px;
    background: #F3F4F6;
}

.cz-faqs-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-bottom: 8px;
}

.cz-faqs-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    text-align: left;
    width: 100%;
    font-family: inherit;
    transition: background .18s, border-color .18s, transform .15s;
    animation: czFadeIn .25s ease;
}

.cz-faqs-chip:hover {
    background: #8f93c9; 
    border-color: #535ea8; 
    color: #fff; 
    transform: translateX(2px);
}

.cz-faqs-chip:active {
    transform: scale(0.98);
}

.cz-faqs-chip-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #535ea8; 
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: .75;
    transition: opacity .18s;
}

.cz-faqs-chip:hover .cz-faqs-chip-icon {
    opacity: 1;
}

.cz-faqs-chip-icon svg {
    width: 10px;
    height: 10px;
    fill: white;
}

.cz-faqs-chip-text {
    flex: 1;
    line-height: 1.35;
}

.cz-faqs-empty {
    font-size: 12px;
    color: #9CA3AF;
    text-align: center;
    padding: 6px 0 10px;
    font-style: italic;
}

.cz-faqs-chip.cz-chip-removing {
    opacity: 0;
    transform: translateX(8px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}

.cz-faqs-wrap.cz-faqs-hidden {
    display: none;
}