/* =========================================================
   DISETEC CHATBOT — chatbot.css
   Todos los estilos del widget. Cargados con wp_enqueue_style.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap');

:root {
    --dc-red:         #C8102E;
    --dc-red-light:   #E63950;
    --dc-red-dark:    #9B0D22;
    --dc-red-bg:      #FFF5F6;
    --dc-red-glow:    rgba(200, 16, 46, 0.65);
    --dc-red-soft:    rgba(200, 16, 46, 0.22);
    --dc-gray-bg:     #F4F5F7;
    --dc-gray-mid:    #E8E9EC;
    --dc-gray-text:   #374151;
    --dc-gray-muted:  #6B7280;
    --dc-white:       #FFFFFF;
    --dc-success:     #4ADE80;
    --dc-font:        'Nunito', sans-serif;
    --dc-bubble:      62px;
    --dc-width:       358px;
    --dc-height:      520px;
    --dc-radius:      20px;
    --dc-zindex:      999998;
}

/* ─────────────────────────────────────────
   OVERLAY — cierra el chat al clicar fuera
   ───────────────────────────────────────── */

#disetec-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: calc(var(--dc-zindex) - 1);
    background: transparent;
    cursor: default;
}

#disetec-overlay.active {
    display: block;
}

/* ─────────────────────────────────────────
   BURBUJA
   ───────────────────────────────────────── */

#disetec-bubble {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: var(--dc-bubble);
    height: var(--dc-bubble);
    border-radius: 50%;
    background: var(--dc-red);
    cursor: pointer;
    z-index: var(--dc-zindex);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
}

/* Anillo giratorio con conic-gradient */
#disetec-bubble::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0%,
        var(--dc-red-glow) 25%,
        var(--dc-red-light) 50%,
        var(--dc-red-glow) 75%,
        transparent 100%
    );
    animation: dc-rotate-glow 2.8s linear infinite;
    z-index: -1;
}

/* Tapa el conic-gradient en el centro */
#disetec-bubble::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--dc-red);
    z-index: 0;
}

@keyframes dc-rotate-glow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Hover — más grande + anillo completo más rápido */
#disetec-bubble:hover,
#disetec-bubble:focus-visible {
    transform: scale(1.13);
}

#disetec-bubble:hover::before,
#disetec-bubble:focus-visible::before {
    inset: -5px;
    animation-duration: 1.5s;
    background: conic-gradient(
        from 0deg,
        var(--dc-red-soft) 0%,
        var(--dc-red-glow) 30%,
        var(--dc-red-light) 50%,
        var(--dc-red-glow) 70%,
        var(--dc-red-soft) 100%
    );
}

/* Ícono de mensaje */
.dc-bubble-icon {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dc-bubble-icon svg {
    width: 27px;
    height: 27px;
    fill: #FFFFFF;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.25));
    transition: transform 0.25s ease;
}

#disetec-bubble:hover .dc-bubble-icon svg {
    transform: scale(1.08);
}

/* Punto de notificación */
#disetec-notif {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #FFD700;
    border-radius: 50%;
    border: 2.5px solid var(--dc-white);
    z-index: 2;
    animation: dc-notif-pulse 2s ease-in-out infinite;
}

@keyframes dc-notif-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.28); opacity: 0.75; }
}

/* ─────────────────────────────────────────
   VENTANA DEL CHAT
   ───────────────────────────────────────── */

#disetec-chat {
    position: fixed;
    bottom: 104px;
    right: 28px;
    width: var(--dc-width);
    max-height: var(--dc-height);
    background: var(--dc-white);
    border-radius: var(--dc-radius);
    border: 2.5px solid var(--dc-red);
    box-shadow:
        0 22px 64px rgba(200, 16, 46, 0.16),
        0 4px 20px rgba(0, 0, 0, 0.10);
    display: flex;
    flex-direction: column;
    z-index: var(--dc-zindex);
    font-family: var(--dc-font);
    overflow: hidden;
    transform-origin: bottom right;

    /* Estado CERRADO */
    transform: scale(0.88) translateY(18px);
    opacity: 0;
    pointer-events: none;
    transition:
        transform 0.34s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity   0.24s ease;
}

/* Estado ABIERTO */
#disetec-chat.dc-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ─── Header ─── */
.dc-header {
    background: linear-gradient(135deg, var(--dc-red-dark) 0%, var(--dc-red) 55%, var(--dc-red-light) 100%);
    padding: 15px 16px 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.dc-header::before {
    content: '';
    position: absolute;
    top: -28px; right: -28px;
    width: 90px; height: 90px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
    pointer-events: none;
}

.dc-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.18);
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dc-avatar svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.dc-header-info { flex: 1; min-width: 0; }

.dc-header-title {
    color: white;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-header-sub {
    color: rgba(255,255,255,0.72);
    font-size: 11px;
    font-weight: 500;
    margin: 2px 0 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dc-online-dot {
    width: 7px;
    height: 7px;
    background: var(--dc-success);
    border-radius: 50%;
    flex-shrink: 0;
    animation: dc-online-blink 2.6s ease-in-out infinite;
}

@keyframes dc-online-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

/* Botón X */
.dc-close-btn {
    background: rgba(255,255,255,0.14);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s, transform 0.15s;
    flex-shrink: 0;
    outline: none;
}

.dc-close-btn:hover  { background: rgba(255,255,255,0.30); }
.dc-close-btn:active { transform: scale(0.92); }

.dc-close-btn svg {
    width: 14px;
    height: 14px;
    fill: white;
    pointer-events: none;
}

/* ─── Área de mensajes ─── */
.dc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px 13px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: var(--dc-gray-bg);
    scroll-behavior: smooth;
}

.dc-messages::-webkit-scrollbar { width: 4px; }
.dc-messages::-webkit-scrollbar-track { background: transparent; }
.dc-messages::-webkit-scrollbar-thumb {
    background: rgba(200,16,46,0.22);
    border-radius: 2px;
}

/* ─── Burbujas de mensaje ─── */
.dc-msg {
    display: flex;
    flex-direction: column;
    max-width: 84%;
    animation: dc-msg-in 0.30s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes dc-msg-in {
    from { opacity: 0; transform: translateY(10px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.dc-msg.bot  { align-self: flex-start; }
.dc-msg.user { align-self: flex-end; }

.dc-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.56;
    word-break: break-word;
}

.dc-msg.bot .dc-msg-bubble {
    background: var(--dc-white);
    border: 1px solid var(--dc-gray-mid);
    border-bottom-left-radius: 4px;
    color: var(--dc-gray-text);
    box-shadow: 0 1px 4px rgba(0,0,0,0.055);
}

.dc-msg.user .dc-msg-bubble {
    background: var(--dc-red);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 10px rgba(200,16,46,0.28);
}

.dc-msg-time {
    font-size: 10px;
    color: var(--dc-gray-muted);
    margin-top: 4px;
    padding: 0 3px;
}

.dc-msg.user .dc-msg-time { text-align: right; }

/* ─── Indicador de escritura ─── */
.dc-typing-wrap {
    align-self: flex-start;
    animation: dc-msg-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.dc-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 11px 14px;
    background: var(--dc-white);
    border: 1px solid var(--dc-gray-mid);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 1px 4px rgba(0,0,0,0.055);
}

.dc-typing span {
    width: 7px;
    height: 7px;
    background: var(--dc-red);
    border-radius: 50%;
    opacity: 0.35;
}

.dc-typing span:nth-child(1) { animation: dc-dot 1.2s 0.00s ease-in-out infinite; }
.dc-typing span:nth-child(2) { animation: dc-dot 1.2s 0.17s ease-in-out infinite; }
.dc-typing span:nth-child(3) { animation: dc-dot 1.2s 0.34s ease-in-out infinite; }

@keyframes dc-dot {
    0%, 80%, 100% { transform: scale(1);    opacity: 0.35; }
    40%            { transform: scale(1.4) translateY(-3px); opacity: 1; }
}

/* ─── Botones de opciones ─── */
.dc-options {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
    max-width: 270px;
    margin-top: 4px;
    animation: dc-msg-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.dc-options.dc-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.dc-option-btn {
    background: #FFFFFF;
    border: 2px solid var(--dc-red);
    color: #FFFFFF;
    padding: 9px 12px;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--dc-font);
    cursor: pointer;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
    min-width: 0;
}

.dc-option-btn:hover:not(:disabled) {
    background: var(--dc-red);
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(200,16,46,0.28);
}

.dc-option-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
}

/* Estado: seleccionado */
.dc-option-btn.dc-selected {
    background: var(--dc-red);
    border-color: var(--dc-red);
    color: #FFFFFF;
    opacity: 0.62;
    cursor: default;
}

/* Estado: deshabilitado (los no seleccionados) */
.dc-option-btn:disabled:not(.dc-selected) {
    background: var(--dc-gray-mid);
    border-color: #D1D5DB;
    color: #9CA3AF;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ─── Mensaje de redirección ─── */
.dc-redirect-msg {
    font-size: 12px;
    color: var(--dc-gray-muted);
    padding: 9px 13px;
    background: rgba(200,16,46,0.07);
    border-radius: 11px;
    border-left: 3px solid var(--dc-red);
    line-height: 1.5;
    animation: dc-msg-in 0.28s ease both;
    max-width: 84%;
    align-self: flex-start;
}

/* ─── Footer ─── */
.dc-footer {
    padding: 10px 14px 12px;
    background: var(--dc-white);
    border-top: 1.5px solid var(--dc-gray-mid);
    flex-shrink: 0;
}

.dc-privacy {
    font-size: 10px;
    color: var(--dc-gray-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 5px;
    line-height: 1.4;
}

.dc-branding {
    text-align: center;
    font-size: 10px;
    color: #9CA3AF;
    font-weight: 500;
    letter-spacing: 0.03em;
}

.dc-branding span {
    color: var(--dc-red);
    font-weight: 800;
}

/* ─────────────────────────────────────────
   RESPONSIVE — pantallas pequeñas
   ───────────────────────────────────────── */

@media (max-width: 420px) {
    :root {
        --dc-width:  calc(100vw - 24px);
        --dc-height: 480px;
    }

    #disetec-chat {
        right: 12px;
        bottom: 96px;
    }

    #disetec-bubble {
        right: 16px;
        bottom: 20px;
    }
}
