/* ==========================================================================
   QUANG CAO CHATBOT 24H - FRONTEND & WIDGET STYLES
   ========================================================================== */

.qc-chatbot-container {
    position: fixed;
    bottom: 25px;
    left: 25px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

/* 1. Trigger Button */
.qc-chat-toggle-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #d60000 0%, #b30000 100%);
    color: #ffffff;
    border: none;
    padding: 10px 18px 10px 12px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(214, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.qc-chat-toggle-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 30px rgba(214, 0, 0, 0.5);
}

.chat-toggle-icon {
    width: 42px;
    height: 42px;
    background: #ffffff;
    color: #d60000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.chat-toggle-label {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.label-title {
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
}

.label-status {
    font-size: 11px;
    color: #ffeb3b;
    font-weight: 600;
}

.chat-online-dot {
    position: absolute;
    top: 10px;
    left: 42px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
}

.chat-pulse {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50px;
    border: 2px solid #d60000;
    animation: qcPulse 2s infinite;
    pointer-events: none;
}

@keyframes qcPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* 2. Chat Window Box */
.qc-chat-window {
    position: absolute;
    bottom: 75px;
    left: 0;
    width: 380px;
    height: 520px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    animation: qcSlideUp 0.3s ease;
    z-index: 100000;
}

.qc-chat-window.active {
    display: flex;
}

@keyframes qcSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.qc-chat-header {
    background: linear-gradient(135deg, #d60000, #990000);
    color: #ffffff;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.bot-avatar {
    width: 38px;
    height: 38px;
    background: #ffffff;
    color: #d60000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    position: relative;
}

.status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
}

.bot-name {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
}

.bot-sub {
    font-size: 11px;
    color: #ffeb3b;
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Messages Area */
.qc-chat-messages {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg-row {
    display: flex;
    max-width: 85%;
}

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

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

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

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

.user-msg .msg-bubble {
    background: #d60000;
    color: #ffffff;
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 6px rgba(214, 0, 0, 0.2);
}

/* Quick Chips */
.qc-quick-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 5px;
}

.quick-chip {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #d60000;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.quick-chip:hover {
    background: #fff1f1;
    border-color: #d60000;
    transform: translateX(4px);
}

/* Typing Indicator */
.qc-typing-indicator {
    padding: 6px 16px;
    font-size: 11px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f8fafc;
}

.qc-typing-indicator span {
    width: 5px;
    height: 5px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBlink 1.4s infinite both;
}

.qc-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.qc-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBlink {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}

/* Chat Footer */
.qc-chat-footer {
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

.qc-chat-form {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.qc-chat-form input {
    flex-grow: 1;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 25px;
    font-size: 13px;
    outline: none;
}

.qc-chat-form input:focus {
    border-color: #d60000;
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    background: #d60000;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    background: #b30000;
}

.qc-direct-channels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.channel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    color: #ffffff;
}

.phone-btn {
    background: #10b981;
}

.zalo-btn {
    background: #0284c7;
}

/* Responsive Mobile */
@media (max-width: 480px) {
    .qc-chatbot-container {
        left: 15px;
        bottom: 15px;
    }
    .qc-chat-window {
        width: calc(100vw - 30px);
        height: 75vh;
        left: 0;
        bottom: 65px;
    }
    .qc-chat-toggle-btn .chat-toggle-label {
        display: none;
    }
    .qc-chat-toggle-btn {
        padding: 6px;
        border-radius: 50%;
    }
}
