/* DRVET / VIETDESK Auto-Linked Website Livechat Widget (Text-Only, Bottom-Right) */
.vd-webchat-root {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.vd-webchat-launcher {
    display: none;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #166534, #1f8a4c);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(22, 101, 52, 0.35);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.vd-webchat-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(22, 101, 52, 0.42);
}

.vd-webchat-root.is-minimized .vd-webchat-launcher {
    display: inline-flex;
}

.vd-webchat-root.is-minimized .vd-webchat-panel {
    display: none;
}

.vd-webchat-badge {
    display: none;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    align-items: center;
    justify-content: center;
}

.vd-webchat-badge.show {
    display: inline-flex;
}

.vd-webchat-panel {
    width: 350px;
    max-width: calc(100vw - 24px);
    height: 470px;
    max-height: calc(100vh - 48px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
    border: 1px solid #dce8e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vd-webchat-header {
    background: linear-gradient(135deg, #166534, #1f8a4c);
    color: #ffffff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.vd-webchat-hdr-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.vd-webchat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.28);
    flex-shrink: 0;
}

.vd-webchat-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vd-webchat-sub {
    font-size: 11px;
    opacity: 0.9;
}

.vd-webchat-min-btn {
    border: none;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.vd-webchat-min-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.vd-webchat-guestbar-wrap {
    background: #f4f9f6;
    border-bottom: 1px solid #e5efe8;
    flex-shrink: 0;
}

.vd-webchat-guestbar {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
}

.vd-webchat-guestbar input.is-invalid {
    border-color: #dc2626;
    background: #fef2f2;
}

.vd-webchat-error {
    padding: 0 10px 7px;
    font-size: 11.5px;
    font-weight: 600;
    color: #dc2626;
}

.vd-webchat-guestbar input {
    flex: 1;
    min-width: 0;
    border: 1px solid #d5e3da;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 12px;
    background: #ffffff;
    outline: none;
}

.vd-webchat-guestbar input:focus {
    border-color: #1f8a4c;
}

.vd-webchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f7faf8;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vd-webchat-msg {
    max-width: 82%;
    display: flex;
    flex-direction: column;
}

.vd-webchat-msg.from-visitor {
    align-self: flex-end;
    align-items: flex-end;
}

.vd-webchat-msg.from-clinic {
    align-self: flex-start;
    align-items: flex-start;
}

.vd-webchat-bubble {
    padding: 9px 12px;
    border-radius: 13px;
    font-size: 13.5px;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}

.vd-webchat-msg.from-visitor .vd-webchat-bubble {
    background: #166534;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.vd-webchat-msg.from-clinic .vd-webchat-bubble {
    background: #ffffff;
    color: #111827;
    border: 1px solid #e2ece5;
    border-bottom-left-radius: 4px;
}

.vd-webchat-meta {
    font-size: 10.5px;
    color: #6b7280;
    margin-top: 2px;
}

.vd-webchat-composer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #ffffff;
    border-top: 1px solid #e5efe8;
    flex-shrink: 0;
}

.vd-webchat-composer input {
    flex: 1;
    border: 1px solid #d5e3da;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13.5px;
    outline: none;
    background: #f9fbfa;
}

.vd-webchat-composer input:focus {
    border-color: #1f8a4c;
    background: #ffffff;
}

.vd-webchat-send {
    border: none;
    background: #166534;
    color: #ffffff;
    border-radius: 999px;
    padding: 9px 15px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.vd-webchat-send:hover {
    background: #14532d;
}

.vd-webchat-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .vd-webchat-root {
        right: 12px;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }
    .vd-webchat-launcher {
        padding: 10px 14px;
        font-size: 13px;
        gap: 8px;
    }
    .vd-webchat-panel {
        width: calc(100vw - 24px);
        height: min(430px, calc(100dvh - 110px - env(safe-area-inset-bottom, 0px)));
        max-height: calc(100dvh - 110px - env(safe-area-inset-bottom, 0px));
    }
}
