/* ========================================
   BODY & NAIL — Chat Widget (Lumi)
   Isolated under .bn-chat-* for drop-in portability.
   ======================================== */

.bn-chat-launcher,
.bn-chat-panel {
    --bn-chat-primary: #c9a37c;
    --bn-chat-accent: #b8738d;
    --bn-chat-dark: #2a1f1a;
    --bn-chat-text: #3d2f28;
    --bn-chat-muted: #7a6b63;
    --bn-chat-bg: #fffdfb;
    --bn-chat-bubble-bot: #fdf7f1;
    --bn-chat-border: rgba(201, 163, 124, 0.18);
    --bn-chat-gradient: linear-gradient(135deg, #c9a37c, #b8738d);
    font-family: 'Poppins', -apple-system, system-ui, sans-serif;
    box-sizing: border-box;
}

.bn-chat-launcher *,
.bn-chat-launcher *::before,
.bn-chat-launcher *::after,
.bn-chat-panel *,
.bn-chat-panel *::before,
.bn-chat-panel *::after { box-sizing: border-box; }

/* ---------- Launcher ---------- */
.bn-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--bn-chat-gradient);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 30px rgba(184, 115, 141, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    z-index: 9900;
}
.bn-chat-launcher:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(184, 115, 141, 0.45); }
.bn-chat-launcher:focus-visible { outline: 3px solid var(--bn-chat-accent); outline-offset: 3px; }
.bn-chat-launcher[aria-expanded="true"] .bn-chat-launcher-pulse { display: none; }

.bn-chat-launcher-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 0 0 rgba(201, 163, 124, 0.55);
    animation: bn-chat-pulse 1.8s ease-out 2;
}
@keyframes bn-chat-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(201, 163, 124, 0.55); }
    70%  { box-shadow: 0 0 0 18px rgba(201, 163, 124, 0); }
    100% { box-shadow: 0 0 0 0 rgba(201, 163, 124, 0); }
}

/* ---------- Panel ---------- */
.bn-chat-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 540px;
    max-height: calc(100dvh - 48px);
    background: var(--bn-chat-bg);
    border: 1px solid var(--bn-chat-border);
    border-radius: 20px;
    box-shadow: 0 24px 48px rgba(42, 31, 26, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9900;
    color: var(--bn-chat-text);
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
.bn-chat-panel[hidden] { display: none; }
.bn-chat-panel.bn-chat-open { opacity: 1; transform: translateY(0) scale(1); }

/* ---------- Header ---------- */
.bn-chat-header {
    background: var(--bn-chat-gradient);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}
.bn-chat-header-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bn-chat-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.22);
    display: grid; place-items: center;
    font-size: 1rem; flex-shrink: 0;
}
.bn-chat-header-title strong {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.25rem; font-weight: 600;
    display: block; line-height: 1.1;
}
.bn-chat-header-title small { font-size: 11px; opacity: 0.85; display: block; }

.bn-chat-close {
    width: 32px; height: 32px; border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.18);
    color: #fff; cursor: pointer;
    display: grid; place-items: center;
    font-size: 0.95rem;
    transition: background 0.2s ease;
    flex-shrink: 0;
}
.bn-chat-close:hover { background: rgba(255,255,255,0.3); }
.bn-chat-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- Body (messages) ---------- */
.bn-chat-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    background: linear-gradient(180deg, #fffdfb 0%, #fdf7f1 100%);
}
.bn-chat-body::-webkit-scrollbar { width: 6px; }
.bn-chat-body::-webkit-scrollbar-thumb { background: rgba(201,163,124,0.3); border-radius: 3px; }

.bn-chat-msg { display: flex; flex-direction: column; max-width: 85%; }
.bn-chat-msg-user { align-self: flex-end; align-items: flex-end; }
.bn-chat-msg-bot  { align-self: flex-start; align-items: flex-start; }

.bn-chat-bubble {
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.bn-chat-msg-user .bn-chat-bubble {
    background: var(--bn-chat-primary);
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}
.bn-chat-msg-bot .bn-chat-bubble {
    background: var(--bn-chat-bubble-bot);
    color: var(--bn-chat-text);
    border-radius: 16px 16px 16px 4px;
    border: 1px solid rgba(201,163,124,0.12);
}
.bn-chat-bubble p { margin: 0 0 8px 0; }
.bn-chat-bubble p:last-child { margin-bottom: 0; }

.bn-chat-bubble-error {
    background: #fdecec !important;
    border: 1px solid rgba(200,80,80,0.2) !important;
    color: #7a3a3a !important;
}

.bn-chat-time {
    font-size: 11px;
    color: var(--bn-chat-muted);
    margin-top: 4px;
    padding: 0 4px;
}

/* ---------- Escalation note ---------- */
.bn-chat-escalate {
    align-self: stretch;
    background: #fff;
    border: 1px dashed var(--bn-chat-accent);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--bn-chat-text);
}
.bn-chat-escalate a,
.bn-chat-escalate button {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 500;
    padding: 6px 12px; border-radius: 16px;
    border: 1px solid var(--bn-chat-primary);
    background: #fff; color: var(--bn-chat-primary);
    cursor: pointer; text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}
.bn-chat-escalate button { background: var(--bn-chat-gradient); color: #fff; border-color: transparent; }
.bn-chat-escalate a:hover { background: var(--bn-chat-primary); color: #fff; }
.bn-chat-escalate button:hover { filter: brightness(1.05); }

/* ---------- Typing indicator ---------- */
.bn-chat-typing {
    align-self: flex-start;
    background: var(--bn-chat-bubble-bot);
    border: 1px solid rgba(201,163,124,0.12);
    border-radius: 16px 16px 16px 4px;
    padding: 12px 14px;
    display: inline-flex;
    gap: 4px;
}
.bn-chat-typing span {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--bn-chat-primary);
    animation: bn-typing-bounce 1s infinite ease-in-out;
}
.bn-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.bn-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bn-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%           { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Suggestions ---------- */
.bn-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px 0 16px;
    flex-shrink: 0;
}
.bn-chat-suggestions:empty { display: none; }
.bn-chat-chip {
    font: inherit; font-size: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--bn-chat-primary);
    background: transparent;
    color: var(--bn-chat-primary);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.bn-chat-chip:hover { background: var(--bn-chat-primary); color: #fff; }
.bn-chat-chip:focus-visible { outline: 2px solid var(--bn-chat-accent); outline-offset: 2px; }

/* ---------- Form ---------- */
.bn-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--bn-chat-border);
    background: #fff;
    flex-shrink: 0;
}
.bn-chat-form input {
    flex: 1 1 auto;
    font: inherit;
    font-size: 14px;
    padding: 10px 14px;
    border: 1px solid var(--bn-chat-border);
    border-radius: 20px;
    background: #fff;
    color: var(--bn-chat-text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 0;
}
.bn-chat-form input:focus { border-color: var(--bn-chat-primary); box-shadow: 0 0 0 3px rgba(201,163,124,0.18); }
.bn-chat-form input:disabled { opacity: 0.6; cursor: not-allowed; }

.bn-chat-form button {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bn-chat-gradient);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: transform 0.2s ease, filter 0.2s ease;
}
.bn-chat-form button:hover { transform: scale(1.05); }
.bn-chat-form button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.bn-chat-form button:focus-visible { outline: 2px solid var(--bn-chat-accent); outline-offset: 2px; }

/* ---------- Footer ---------- */
.bn-chat-footer {
    padding: 8px 16px 12px;
    font-size: 11px;
    color: var(--bn-chat-muted);
    text-align: center;
    background: #fff;
    flex-shrink: 0;
}
.bn-chat-footer a { color: var(--bn-chat-accent); font-weight: 500; }
.bn-chat-footer a:hover { text-decoration: underline; }

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
    /* Launcher: stronger contrast ring + shadow so it pops on any background
       (the hero has a rose/brown photo that was hiding the gold bubble). */
    .bn-chat-launcher {
        border: 3px solid #ffffff;
        box-shadow:
            0 0 0 1px rgba(42, 31, 26, 0.25),
            0 12px 32px rgba(42, 31, 26, 0.35);
    }

    /* Hide chat launcher while booking modal is open to avoid visual overlap */
    body:has(.booking-modal.open) .bn-chat-launcher,
    body:has(.booking-modal.open) .bn-chat-panel { display: none; }
}

@media (max-width: 640px) {
    .bn-chat-panel {
        inset: 0;
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }
    .bn-chat-launcher { bottom: 80px; right: 16px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .bn-chat-launcher-pulse,
    .bn-chat-typing span { animation: none; }
    .bn-chat-panel { transition: opacity 0.01s linear; transform: none; }
    .bn-chat-body { scroll-behavior: auto; }
}
