/**
 * VHANDY AI CHATBOT — Extracted CSS
 * Loaded async to improve page performance
 */

/* ── Widget container ── */
.vhchat-widget {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 9999; font-family: 'Inter', sans-serif;
}

/* ── Bubble button ── */
.vhchat-bubble {
    width: 60px; height: 60px; border-radius: 50%;
    background: #ffffff;
    border: 2px solid #6b9b7d; cursor: pointer; color: #1f2937;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(107,155,125,0.18);
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), box-shadow .3s;
    position: relative; flex-shrink: 0;
}
.vhchat-bubble:hover { transform: scale(1.08); box-shadow: 0 12px 32px rgba(107,155,125,0.28); }
.vhchat-bubble-open, .vhchat-bubble-close { position: absolute; transition: all .25s; }
.vhchat-bubble-close { opacity: 0; transform: rotate(-90deg) scale(0); font-size: 20px; }
.vhchat-widget.open .vhchat-bubble-open  { opacity: 0; transform: rotate(90deg) scale(0); }
.vhchat-widget.open .vhchat-bubble-close { opacity: 1; transform: rotate(0) scale(1); }

.vhchat-bubble-badge {
    position: absolute; top: -4px; right: -4px;
    background: linear-gradient(135deg, #6b9b7d, #88b79a);
    color: #fff; font-size: 9px; font-weight: 800;
    padding: 2px 5px; border-radius: 10px;
    border: 2px solid #fff; letter-spacing: .5px;
    animation: vhPulse 2s infinite;
}
@keyframes vhPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(107,155,125,.38); }
    50% { box-shadow: 0 0 0 6px rgba(107,155,125,0); }
}
.vhchat-widget.open .vhchat-bubble-badge { display: none; }

/* ── Panel ── */
.vhchat-panel {
    position: absolute;
    bottom: 72px; right: 0;
    width: 360px; height: 520px; max-width: 360px;
    background: #fff; border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    display: none; flex-direction: column;
    overflow: hidden; opacity: 0;
    transform: translateY(20px) scale(.96);
    pointer-events: none;
    transition: opacity .3s ease, transform .35s cubic-bezier(.34,1.56,.64,1);
}
.vhchat-widget.open .vhchat-panel {
    display: flex; opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Header ── */
.vhchat-header {
    background: #ffffff;
    padding: 14px 16px; display: flex; align-items: center; gap: 10px;
    flex-shrink: 0; border-bottom: 1px solid #e5e7eb;
}
.vhchat-header-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: #f9fafb; border: 1px solid #e5e7eb;
    display: flex; align-items: center; justify-content: center;
    color: #6b9b7d; font-size: 18px; position: relative; flex-shrink: 0;
}
.vhchat-online-dot {
    position: absolute; bottom: 1px; right: 1px;
    width: 10px; height: 10px; background: #6b9b7d;
    border-radius: 50%; border: 2px solid #ffffff;
    animation: vhBlink 2s infinite;
}
@keyframes vhBlink { 0%,100%{opacity:1} 50%{opacity:.4} }
.vhchat-header-info { flex: 1; }
.vhchat-header-name { color: #111827; font-weight: 700; font-size: 14px; }
.vhchat-header-status { color: #4b5563; font-size: 11px; margin-top: 1px; }

/* Tab switcher */
.vhchat-tabs { display: flex; gap: 4px; margin-right: 4px; }
.vhchat-tab {
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid #dbeadf;
    background: #ffffff; color: #6b7280;
    cursor: pointer; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.vhchat-tab.active, .vhchat-tab:hover {
    background: #6b9b7d; color: #fff; border-color: #6b9b7d;
}
.vhchat-close {
    width: 28px; height: 28px; border-radius: 50%; border: 1px solid #dbeadf;
    background: #ffffff; color: #6b7280;
    cursor: pointer; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.vhchat-close:hover { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

/* ── Body (AI tab) ── */
.vhchat-body {
    display: flex; flex-direction: column; flex: 1; min-height: 0;
}
.vhchat-messages {
    flex: 1; overflow-y: auto; padding: 16px 12px 8px;
    display: flex; flex-direction: column; gap: 10px;
    scroll-behavior: smooth;
}
.vhchat-messages::-webkit-scrollbar { width: 4px; }
.vhchat-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* Messages */
.vhchat-msg {
    display: flex; align-items: flex-end; gap: 8px;
    animation: vhSlideIn .25s ease;
}
@keyframes vhSlideIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.vhchat-msg.user { flex-direction: row-reverse; }
.vhchat-msg-avatar {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, #dff4e8, #bfe7cf);
    color: #3f6f52; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
}
.vhchat-msg.user .vhchat-msg-avatar { background: linear-gradient(135deg, #6b9b7d, #88b79a); color: #fff; }
.vhchat-msg-bubble {
    max-width: 78%; padding: 10px 13px; border-radius: 16px;
    font-size: 13px; line-height: 1.55; color: #111827;
    background: #f9fafb; border: 1px solid #e5e7eb;
}
.vhchat-msg.user .vhchat-msg-bubble {
    background: linear-gradient(135deg, #6b9b7d, #88b79a);
    color: #fff; border-bottom-right-radius: 4px;
}
.vhchat-msg.bot .vhchat-msg-bubble { border-bottom-left-radius: 4px; }

/* Typing dots */
.vhchat-dots { display: flex; gap: 4px; align-items: center; height: 16px; }
.vhchat-dots span {
    width: 7px; height: 7px; background: #999; border-radius: 50%;
    animation: vhDot 1.2s infinite ease-in-out;
}
.vhchat-dots span:nth-child(2) { animation-delay: .2s; }
.vhchat-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes vhDot { 0%,80%,100%{transform:scale(.8);opacity:.5} 40%{transform:scale(1.2);opacity:1} }

/* Quick replies */
.vhchat-quick-replies {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 0 12px 8px;
}
.vhchat-quick-replies button {
    font-size: 11.5px; padding: 5px 10px; border-radius: 20px;
    border: 1.5px solid #d7e9dd; background: #ffffff; color: #1f2937;
    cursor: pointer; transition: all .2s; font-family: inherit;
    white-space: nowrap;
}
.vhchat-quick-replies button:hover {
    background: #e7f5ec; color: #234031; border-color: #6b9b7d;
}

/* Typing area */
.vhchat-typing { padding: 0 12px; }
.vhchat-input-wrap {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 10px 12px; border-top: 1px solid #f0f0f0; flex-shrink: 0;
}
.vhchat-input {
    flex: 1; border: 1.5px solid #dbe7df; border-radius: 12px;
    padding: 9px 12px; font-size: 16px; font-family: inherit;
    resize: none; outline: none; line-height: 1.4;
    max-height: 100px; overflow-y: auto;
    transition: border-color .2s, box-shadow .2s;
    color: #111827; background: #ffffff;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
.vhchat-input:focus { border-color: #6b9b7d; box-shadow: 0 0 0 3px rgba(107,155,125,0.14); }
.vhchat-send {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, #6b9b7d, #88b79a);
    border: none; color: #fff; cursor: pointer; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s; flex-shrink: 0;
}
.vhchat-send:hover { transform: scale(1.08); }
.vhchat-send:disabled { opacity: .5; pointer-events: none; }

.vhchat-footer-note {
    text-align: center; font-size: 10.5px; color: #6b7280;
    padding: 4px 12px 8px; flex-shrink: 0;
}
.vhchat-footer-note i { color: #6b9b7d; }

/* ── Contact tab ── */
.vhchat-body--contact { overflow-y: auto; display: none; }
.vhchat-contact-head {
    display: flex; flex-direction: column; align-items: center;
    padding: 20px 16px 12px; gap: 4px;
    background: #ffffff; border-bottom: 1px solid #e5e7eb;
}
.vhchat-contact-head i { font-size: 28px; color: #6b9b7d; }
.vhchat-contact-head span { font-weight: 700; font-size: 15px; color: #111827; }
.vhchat-contact-head small { font-size: 12px; color: #6b7280; }
.vhchat-channels { padding: 8px 0; }
.vhchat-channel {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; text-decoration: none; color: #111827;
    transition: background .15s; cursor: pointer;
}
.vhchat-channel:hover { background: #f9fafb; }
.vhcc-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.vhchat-channel.whatsapp  .vhcc-icon { background: #e8f8ef; color: #25D366; }
.vhchat-channel.zalo      .vhcc-icon { background: #e8f0ff; }
.vhchat-channel.messenger .vhcc-icon { background: #eef2ff; color: #0084FF; }
.vhchat-channel.email     .vhcc-icon { background: #fff3e8; color: #f5720a; }
.vhchat-channel.phone     .vhcc-icon { background: #f0fff4; color: #2ecc71; }
.vhcc-info { flex: 1; }
.vhcc-info strong { display: block; font-size: 13.5px; font-weight: 600; }
.vhcc-info small  { font-size: 11.5px; color: #888; }
.vhchat-channel .fa-chevron-right { color: #ccc; font-size: 12px; }

/* ── Chatbot Product Cards ── */
.vhchat-msg-content-wrapper {
    max-width: 78%; display: flex; flex-direction: column; gap: 5px;
}
.vhchat-msg-content-wrapper .vhchat-msg-bubble { max-width: 100% !important; }
.vhchat-products-list {
    display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 2px;
}
.vhchat-product-card {
    background: #ffffff; border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 8px; display: flex; align-items: center; gap: 8px;
    position: relative; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.2s ease-in-out;
}
.vhchat-product-card:hover { border-color: #6b9b7d; box-shadow: 0 3px 8px rgba(107,155,125,0.12); }
.vhchat-product-card img {
    width: 44px; height: 44px; object-fit: cover; border-radius: 6px;
    background: #f9fafb; border: 1px solid #f3f4f6; flex-shrink: 0;
}
.vhchat-product-details {
    flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left;
}
.vhchat-product-title {
    font-size: 11px; font-weight: 600; color: #1f2937;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
}
.vhchat-product-meta {
    display: flex; flex-direction: column; gap: 1px;
    font-size: 9.5px; color: #6b7280; line-height: 1.2;
}
.vhchat-product-meta strong { color: #374151; }
.vhchat-product-link {
    width: 24px; height: 24px; border-radius: 50%;
    background: #f3f4f6; color: #4b5563;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; cursor: pointer; transition: all 0.2s;
    text-decoration: none; flex-shrink: 0;
}
.vhchat-product-link:hover { background: #6b9b7d; color: #ffffff; transform: scale(1.08); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .vhchat-widget { position: fixed !important; right: 16px !important; bottom: 16px !important; left: auto !important; z-index: 9999 !important; }
    .vhchat-bubble { width: 56px !important; height: 56px !important; min-width: 56px !important; min-height: 56px !important; }
    .vhchat-bubble-open img, .vhchat-bubble-open svg { width: 28px !important; height: 28px !important; }
    .vhchat-panel { position: fixed !important; inset: 0 0 72px 0 !important; width: 100% !important; max-width: 100% !important; height: 100% !important; max-height: 100% !important; border-radius: 0 !important; box-shadow: none !important; display: none !important; zoom: 1 !important; -webkit-transform: scale(1) !important; transform: scale(1) !important; }
    .vhchat-widget.open .vhchat-panel { opacity: 1 !important; transform: none !important; pointer-events: all !important; display: flex !important; }
    .vhchat-header { flex-shrink: 0 !important; padding: 10px 12px !important; min-height: 52px !important; }
    .vhchat-header-avatar { width: 32px !important; height: 32px !important; }
    .vhchat-header-name { font-size: 13px !important; }
    .vhchat-header-status { font-size: 10px !important; }
    .vhchat-tabs { gap: 2px !important; }
    .vhchat-tab { width: 28px !important; height: 28px !important; font-size: 11px !important; border-radius: 6px !important; }
    .vhchat-close { width: 24px !important; height: 24px !important; font-size: 10px !important; }
    .vhchat-body { flex: 1 !important; min-height: 0 !important; flex-direction: column !important; overflow: hidden !important; background: #f9fafb !important; }
    .vhchat-messages { flex: 1 !important; overflow-y: auto !important; overflow-x: hidden !important; min-height: 0 !important; padding: 8px !important; gap: 6px !important; }
    .vhchat-msg-avatar { width: 24px !important; height: 24px !important; font-size: 10px !important; }
    .vhchat-msg-bubble { max-width: 78% !important; font-size: 12px !important; padding: 8px 10px !important; line-height: 1.4 !important; }
    .vhchat-quick-replies { padding: 4px 8px !important; flex-shrink: 0 !important; gap: 4px !important; }
    .vhchat-quick-replies button { font-size: 11px !important; padding: 4px 8px !important; border-radius: 12px !important; }
    .vhchat-typing { padding: 0 8px !important; }
    .vhchat-input-wrap { flex-shrink: 0 !important; padding: 8px !important; gap: 6px !important; background: #fff !important; border-top: 1px solid #e5e7eb !important; }
    .vhchat-input { font-size: 16px !important; padding: 8px 10px !important; max-height: 80px !important; border-radius: 10px !important; touch-action: manipulation !important; -webkit-text-size-adjust: 100% !important; }
    .vhchat-send-btn { width: 36px !important; height: 36px !important; min-width: 36px !important; border-radius: 10px !important; font-size: 14px !important; }
    .vhchat-footer-note { flex-shrink: 0 !important; padding: 4px 8px !important; font-size: 9px !important; }
    .vhchat-chip, .vhchat-channel { min-height: 40px !important; padding: 8px 12px !important; gap: 10px !important; }
    .vhcc-icon { width: 36px !important; height: 36px !important; font-size: 16px !important; border-radius: 10px !important; }
    .vhchat-chip { font-size: 12px !important; }
    .vhchat-contact-head { padding: 12px 12px 8px !important; }
    .vhchat-contact-head i { font-size: 22px !important; }
    .vhchat-contact-head span { font-size: 14px !important; }
}

@media (max-width: 420px) {
    .vhchat-header { padding: 8px 10px !important; }
    .vhchat-messages { padding: 6px !important; }
    .vhchat-input { font-size: 13px !important; }
}
