/* Barefooter chat widget — polished ecommerce style */

#barefooter-chat-root {
    --bf-chat-accent: #1a6b4a;
    --bf-chat-bg: #ffffff;
    --bf-chat-border: #e2e8f0;
    --bf-chat-text: #0f172a;
    --bf-chat-muted: #64748b;
    --bf-user-bg: #e8f5ef;
    --bf-bot-bg: #f8fafc;
    --bf-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);

    position: fixed;
    z-index: 999999;
    bottom: 20px;
    right: 20px;
    font-family: "Segoe UI", Inter, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--bf-chat-text);
    box-sizing: border-box;
}

#barefooter-chat-root *,
#barefooter-chat-root *::before,
#barefooter-chat-root *::after {
    box-sizing: border-box;
}

.barefooter-chat-toggle {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: var(--bf-chat-accent);
    color: #fff;
    cursor: pointer;
    box-shadow: var(--bf-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, background 0.18s ease;
}

.barefooter-chat-toggle:hover {
    transform: translateY(-2px) scale(1.03);
    background: #145a3e;
}

.barefooter-chat-toggle svg {
    width: 26px;
    height: 26px;
}

.barefooter-chat-panel {
    position: absolute;
    bottom: 74px;
    right: 0;
    width: min(100vw - 34px, 390px);
    max-height: min(76vh, 600px);
    background: var(--bf-chat-bg);
    border-radius: 16px;
    box-shadow: var(--bf-shadow);
    border: 1px solid var(--bf-chat-border);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.barefooter-chat-panel.is-open {
    display: flex;
}

.barefooter-chat-header {
    padding: 13px 14px;
    background: var(--bf-chat-accent);
    color: #fff;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.barefooter-chat-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    opacity: 0.92;
}

.barefooter-chat-close:hover {
    opacity: 1;
}

.barefooter-chat-messages {
    flex: 1;
    min-height: 220px;
    max-height: 420px;
    overflow-y: auto;
    padding: 13px;
    background: #fbfcfe;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.barefooter-chat-msg {
    max-width: 94%;
    padding: 10px 12px;
    border-radius: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.55;
}

.barefooter-chat-msg--enter {
    animation: barefooter-chat-fade-up 0.24s ease-out;
}

.barefooter-chat-msg--user {
    align-self: flex-end;
    background: var(--bf-user-bg);
    border: 1px solid #cce8d8;
}

.barefooter-chat-msg--bot {
    align-self: flex-start;
    background: var(--bf-bot-bg);
    border: 1px solid var(--bf-chat-border);
}

.barefooter-chat-msg--bot a {
    color: var(--bf-chat-accent);
    text-decoration: underline;
    direction: ltr;
    unicode-bidi: isolate;
    word-break: break-all;
}

.barefooter-chat-msg--error {
    align-self: stretch;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.barefooter-chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    margin-bottom: 2px;
}

.barefooter-chat-chip {
    appearance: none;
    border: 1px solid #e3e8f0;
    background: #f3f5f9;
    color: #1f2937;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.barefooter-chat-chip:hover {
    background: #e9eef6;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.1);
}

.barefooter-chat-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--bf-chat-border);
    background: #fff;
}

.barefooter-chat-input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--bf-chat-border);
    border-radius: 10px;
    font: inherit;
}

.barefooter-chat-input:focus {
    outline: none;
    border-color: var(--bf-chat-accent);
    box-shadow: 0 0 0 2px rgba(26, 107, 74, 0.16);
}

.barefooter-chat-send {
    padding: 10px 15px;
    border: none;
    border-radius: 10px;
    background: var(--bf-chat-accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.barefooter-chat-send:hover:not(:disabled) {
    background: #145a3e;
}

.barefooter-chat-send:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

.barefooter-chat-helper {
    padding: 0 12px 6px;
    color: var(--bf-chat-muted);
    font-size: 12.5px;
    background: #fff;
    text-align: right;
}

.barefooter-chat-disclaimer {
    padding: 0 12px 10px;
    color: var(--bf-chat-muted);
    font-size: 11px;
    line-height: 1.45;
    background: #fff;
    text-align: right;
}

.barefooter-chat-disclaimer a {
    color: var(--bf-chat-accent);
    text-decoration: underline;
}

.barefooter-chat-disclaimer a:hover {
    color: #145a3e;
}

.barefooter-chat-typing-row {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 11px;
    background: var(--bf-bot-bg);
    border: 1px solid var(--bf-chat-border);
    border-radius: 12px;
    color: var(--bf-chat-muted);
    font-size: 13px;
}

.barefooter-chat-typing-dots {
    display: inline-flex;
    gap: 3px;
}

.barefooter-chat-typing-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #8b97a8;
    opacity: 0.35;
    animation: barefooter-chat-dot 1.1s ease-in-out infinite;
}

.barefooter-chat-typing-dots span:nth-child(2) {
    animation-delay: 0.14s;
}

.barefooter-chat-typing-dots span:nth-child(3) {
    animation-delay: 0.28s;
}

@keyframes barefooter-chat-dot {
    0%,
    60%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-1px);
    }
}

@keyframes barefooter-chat-fade-up {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
