/* ============================================
   VDC Chat Widget — Concierge IA
   ============================================ */

/* Container & Toggle */
.vdc-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #305066 0%, #1a3a4f 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(48, 80, 102, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.vdc-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(48, 80, 102, 0.55);
}
.vdc-chat-toggle svg {
    width: 28px;
    height: 28px;
    fill: #fff;
    transition: opacity 0.2s;
}
.vdc-chat-toggle img.vdc-chat-icon-open {
    transition: opacity 0.2s;
}
.vdc-chat-toggle .vdc-chat-icon-close { display: none; }
.vdc-chat-toggle.open .vdc-chat-icon-open { display: none; }
.vdc-chat-toggle.open .vdc-chat-icon-close { display: block; }

/* Teaser bubble */
.vdc-chat-teaser {
    position: fixed;
    bottom: 40px;
    right: 96px;
    z-index: 99999;
    background: #fff;
    color: #305066;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    opacity: 0;
    transform: translateX(10px);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    max-width: 260px;
    line-height: 1.35;
}
.vdc-chat-teaser::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-left-color: #fff;
    border-right: none;
}
.vdc-chat-teaser.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}
.vdc-chat-teaser-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #aaa;
    padding: 0 0 0 4px;
    line-height: 1;
    flex-shrink: 0;
}
.vdc-chat-teaser-close:hover {
    color: #666;
}
@media (max-width: 480px) {
    .vdc-chat-teaser {
        right: 16px;
        bottom: 88px;
        max-width: calc(100vw - 32px);
    }
    .vdc-chat-teaser::after {
        display: none;
    }
}

/* Unread badge */
.vdc-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #c9a227;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}
.vdc-chat-badge.visible { display: flex; }

/* Chat Window */
.vdc-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 99998;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.vdc-chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.vdc-chat-header {
    background: linear-gradient(135deg, #305066 0%, #1a3a4f 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
}
.vdc-chat-header-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.vdc-chat-header-close:hover {
    background: rgba(255,255,255,0.15);
}
.vdc-chat-header-close svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}
.vdc-chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(201, 162, 39, 0.2);
    border: 2px solid #c9a227;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.vdc-chat-header-info {
    flex: 1;
    min-width: 0;
}
.vdc-chat-header-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.vdc-chat-header-subtitle {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 2px;
}
.vdc-chat-header-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    margin-right: 4px;
    vertical-align: middle;
}

/* Messages area */
.vdc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fafafa;
    scroll-behavior: smooth;
}
.vdc-chat-messages::-webkit-scrollbar {
    width: 4px;
}
.vdc-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* Message bubbles */
.vdc-chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.55;
    word-wrap: break-word;
    animation: vdcChatFadeIn 0.3s ease;
}
@keyframes vdcChatFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.vdc-chat-msg.user {
    align-self: flex-end;
    background: #305066;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.vdc-chat-msg.assistant {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 4px;
}
.vdc-chat-msg.assistant strong { color: #305066; }
.vdc-chat-msg.assistant a {
    color: #c9a227;
    text-decoration: underline;
}
.vdc-chat-msg.assistant ul,
.vdc-chat-msg.assistant ol {
    margin: 6px 0;
    padding-left: 18px;
}
.vdc-chat-msg.assistant li { margin-bottom: 3px; }
.vdc-chat-msg.assistant p { margin: 4px 0; }

/* Timestamp */
.vdc-chat-time {
    font-size: 0.65rem;
    color: #aaa;
    margin-top: 4px;
    text-align: right;
}
.vdc-chat-msg.assistant .vdc-chat-time { text-align: left; }

/* Typing indicator */
.vdc-chat-typing {
    align-self: flex-start;
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    max-width: 75%;
    animation: vdcChatFadeIn 0.3s ease;
}
.vdc-chat-typing.visible { display: flex; }
.vdc-typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}
.vdc-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #305066;
    opacity: 0.4;
    animation: vdcTypingDot 1.4s infinite;
}
.vdc-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.vdc-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes vdcTypingDot {
    0%, 60%, 100% { opacity: 0.4; transform: scale(1); }
    30% { opacity: 1; transform: scale(1.2); }
}
.vdc-typing-text {
    font-size: 0.72rem;
    color: #888;
    font-style: italic;
    transition: opacity 0.3s ease;
    animation: vdcTypingTextFade 2.5s infinite;
}
@keyframes vdcTypingTextFade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Input area */
.vdc-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #fff;
    flex-shrink: 0;
}
.vdc-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 0.88rem;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    min-height: 40px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
}
.vdc-chat-input:focus {
    border-color: #305066;
}
.vdc-chat-input::placeholder {
    color: #aaa;
}
.vdc-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #305066;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}
.vdc-chat-send:hover {
    background: #1a3a4f;
    transform: scale(1.05);
}
.vdc-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}
.vdc-chat-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Powered by */
.vdc-chat-footer {
    text-align: center;
    padding: 4px 0 8px;
    font-size: 0.65rem;
    color: #bbb;
    background: #fff;
    flex-shrink: 0;
}
.vdc-chat-footer a {
    color: #c9a227;
    text-decoration: none;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .vdc-chat-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .vdc-chat-toggle {
        bottom: 16px;
        right: 16px;
    }
    .vdc-chat-toggle.open {
        display: none;
    }
}

/* Error message */
.vdc-chat-error {
    align-self: center;
    background: #FFF3E0;
    color: #E65100;
    border: 1px solid #FFE0B2;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
    text-align: center;
}

/* Quick actions / suggestions */
.vdc-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 8px;
    background: #fafafa;
}
.vdc-chat-suggestion {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 16px;
    font-size: 0.78rem;
    color: #305066;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.vdc-chat-suggestion:hover {
    background: #305066;
    color: #fff;
    border-color: #305066;
}
