/* Ask Diecast — Rule-based Chatbot */

#ask-diecast-bubble {
    position: fixed;
    bottom: 28px;
    right: 28px;
    height: 48px;
    padding: 0 20px 0 14px;
    background: #cb1313;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    z-index: 99990;
    box-shadow: 0 0 18px 4px rgba(203,19,19,0.55), 0 4px 14px rgba(0,0,0,0.35);
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    outline: none;
    user-select: none;
    animation: dz-bubble-breathe 2.8s ease-in-out infinite;
}
#ask-diecast-bubble::before,
#ask-diecast-bubble::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50px;
    background: rgba(203, 19, 19, 0.45);
    animation: dz-bubble-ripple 2.8s ease-out infinite;
    pointer-events: none;
    z-index: -1;
}
#ask-diecast-bubble::after {
    animation-delay: 1s;
    background: rgba(203, 19, 19, 0.3);
}
@keyframes dz-bubble-ripple {
    0%   { transform: scale(1);    opacity: 0.7; }
    100% { transform: scale(1.75); opacity: 0; }
}
@keyframes dz-bubble-breathe {
    0%, 100% { box-shadow: 0 0 18px 4px rgba(203,19,19,0.55), 0 4px 14px rgba(0,0,0,0.35); }
    50%       { box-shadow: 0 0 30px 8px rgba(203,19,19,0.75), 0 6px 18px rgba(0,0,0,0.4); }
}
#ask-diecast-bubble:hover {
    transform: scale(1.05);
    animation: none;
    box-shadow: 0 0 30px 8px rgba(203,19,19,0.7), 0 6px 18px rgba(0,0,0,0.4);
}
#ask-diecast-bubble .dz-bubble-icon {
    width: 26px;
    height: 26px;
    background: rgba(255,255,255,0.18);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#ask-diecast-bubble .dz-bubble-icon svg { width: 15px; height: 15px; fill: #fff; }
#ask-diecast-bubble .dz-bubble-label {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

#ask-diecast-window {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 380px;
    height: 560px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 12px 50px rgba(0,0,0,0.22);
    display: flex;
    flex-direction: column;
    z-index: 99990;
    overflow: hidden;
    transform: scale(0.88) translateY(24px);
    opacity: 0;
    pointer-events: none;
    transform-origin: bottom right;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
#ask-diecast-window.dz-chat-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}
/* Hide bubble when chat window is open */
#ask-diecast-window.dz-chat-open ~ #ask-diecast-bubble,
body.dz-chat-active #ask-diecast-bubble {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.dz-chat-header {
    background: #cb1313;
    padding: 18px 20px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-shrink: 0;
    border-radius: 20px 20px 0 0;
}
.dz-chat-header-info { flex: 1; }
.dz-chat-header-info h6 { color: #fff; margin: 0 0 3px; font-size: 18px; font-weight: 800; letter-spacing: 0.01em; }
.dz-chat-header-info span { color: rgba(255,255,255,0.82); font-size: 12.5px; font-weight: 400; }
.dz-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    margin-top: 2px;
    opacity: 0.9;
    font-weight: 300;
}
.dz-chat-close:hover { opacity: 1; }

.dz-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fa;
    min-height: 0;
}
.dz-chat-messages::-webkit-scrollbar { width: 4px; }
.dz-chat-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.dz-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    max-width: 100%;
}
.dz-msg.dz-msg-bot { justify-content: flex-start; }
.dz-msg.dz-msg-user { justify-content: flex-end; }

.dz-msg-avatar {
    width: 28px;
    height: 28px;
    background: #cb1313;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dz-msg-avatar svg { width: 14px; height: 14px; fill: #fff; }

.dz-msg-bubble {
    max-width: 80%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}
.dz-msg-bot .dz-msg-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.dz-msg-user .dz-msg-bubble {
    background: #cb1313;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.dz-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.dz-quick-reply {
    background: #fff;
    border: 1.5px solid #cb1313;
    color: #cb1313;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.dz-quick-reply:hover { background: #cb1313; color: #fff; }

.dz-chat-input-area {
    display: flex;
    flex-direction: column;
    padding: 12px 14px 14px;
    border-top: 1px solid #eee;
    gap: 10px;
    background: #fff;
    flex-shrink: 0;
}
.dz-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dz-chat-input-area input {
    flex: 1;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 13.5px;
    outline: none;
    color: #333;
    background: #f8f9fa;
    transition: border-color 0.15s;
}
.dz-chat-input-area input::placeholder { color: #aaa; }
.dz-chat-input-area input:focus { border-color: #cb1313; background: #fff; }
.dz-chat-send {
    width: 42px;
    height: 42px;
    background: #cb1313;
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.dz-chat-send:hover { background: #a00f0f; }
.dz-chat-send svg { width: 17px; height: 17px; fill: #fff; }
.dz-chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.dz-chat-chip {
    background: #f2f2f2;
    border: none;
    border-radius: 20px;
    padding: 5px 13px;
    font-size: 12px;
    color: #444;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.dz-chat-chip:hover { background: #cb1313; color: #fff; }

.dz-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 4px 0;
}
.dz-typing span {
    width: 7px;
    height: 7px;
    background: #aaa;
    border-radius: 50%;
    animation: dz-type-bounce 1.2s infinite ease-in-out;
}
.dz-typing span:nth-child(2) { animation-delay: 0.2s; }
.dz-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dz-type-bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

@media (max-width: 480px) {
    #ask-diecast-window { width: calc(100vw - 24px); right: 12px; bottom: 84px; }
    #ask-diecast-bubble { right: 16px; bottom: 20px; padding: 0 16px 0 12px; height: 44px; }
    #ask-diecast-bubble .dz-bubble-label { font-size: 12px; }
}
