/* ── Chat Widget ──────────────────────────────────────────── */
#woi-chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #162846;
    border: 2px solid #D4AF37;
    cursor: pointer;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px rgba(22, 40, 70, 0.38);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#woi-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(22, 40, 70, 0.5);
}
#woi-chat-bubble svg {
    width: 24px;
    height: 24px;
    fill: #D4AF37;
    transition: transform 0.25s ease;
}
#woi-chat-bubble.woi-chat-is-open svg {
    transform: rotate(90deg) scale(0.85);
}

#woi-chat-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 340px;
    height: 500px;
    max-height: calc(100dvh - 120px);
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 10px 48px rgba(22, 40, 70, 0.22);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(16px) scale(0.97);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.34, 1.36, 0.64, 1), opacity 0.2s ease;
}
#woi-chat-panel.woi-chat-open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Header */
.woi-chat-header {
    background: #162846;
    color: #ffffff;
    padding: 13px 16px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.woi-chat-header-left { display: flex; align-items: center; gap: 10px; }
.woi-chat-header-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.3);
}
.woi-chat-header-title {
    font-family: 'Times New Roman', Times, serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 1.2;
}
.woi-chat-header-sub {
    font-size: 11px;
    color: #D4AF37;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-top: 1px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.woi-chat-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.15s;
}
.woi-chat-close:hover { color: #ffffff; }

/* Messages */
.woi-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0 13px 10px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    scroll-behavior: smooth;
}
.woi-chat-messages::-webkit-scrollbar { width: 4px; }
.woi-chat-messages::-webkit-scrollbar-track { background: transparent; }
.woi-chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.woi-chat-messages::before {
    content: '';
    display: block;
    height: 12px;
    flex-shrink: 0;
}

.woi-msg {
    max-width: 84%;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.woi-msg-bot {
    background: #f1f5f9;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}
.woi-msg-user {
    background: #162846;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}

/* Typing indicator */
.woi-msg-typing {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 11px 14px;
    background: #f1f5f9;
    max-width: 60px;
}
.woi-msg-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: woiDot 1.3s ease-in-out infinite;
}
.woi-msg-typing span:nth-child(2) { animation-delay: 0.18s; }
.woi-msg-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes woiDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Lead capture form */
.woi-chat-lead {
    border-top: 1px solid #e2e8f0;
    padding: 10px 12px 12px;
    background: #f8fafc;
    flex-shrink: 0;
}
.woi-chat-lead-title {
    font-size: 11px;
    font-weight: 700;
    color: #162846;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 8px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.woi-chat-lead input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 6px;
    outline: none;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #1e293b;
    background: #ffffff;
    transition: border-color 0.15s;
}
.woi-chat-lead input:focus { border-color: #162846; }
.woi-chat-lead-error {
    font-size: 11.5px;
    color: #b91c1c;
    margin: -2px 0 5px;
    min-height: 14px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.woi-chat-lead-btn {
    width: 100%;
    padding: 8px 12px;
    background: #162846;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    transition: background 0.15s;
}
.woi-chat-lead-btn:hover { background: #1f3a66; }
.woi-chat-lead-btn:disabled { background: #94a3b8; cursor: default; }
.woi-chat-lead-success {
    text-align: center;
    font-size: 13px;
    color: #166534;
    font-weight: 600;
    padding: 8px 0 4px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Input row */
.woi-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 9px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    flex-shrink: 0;
}
#woi-chat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 13.5px;
    outline: none;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.15s, background 0.15s;
}
#woi-chat-input:focus {
    border-color: #162846;
    background: #ffffff;
}
#woi-chat-input::placeholder { color: #94a3b8; }
#woi-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #162846;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
#woi-chat-send:hover { background: #1f3a66; }
#woi-chat-send:disabled { background: #94a3b8; cursor: default; }
#woi-chat-send svg { width: 16px; height: 16px; fill: #ffffff; }

@media (max-width: 480px) {
    #woi-chat-panel {
        bottom: 82px;
        right: 12px;
        left: 12px;
        width: auto;
        height: 460px;
        max-height: calc(100dvh - 110px);
    }
    #woi-chat-bubble {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }
}
