/* Chat widget styles — doubled bubble size with proper pointer-event & scrolling */
:root {
    --chat-bg: #fff;
    --chat-accent: #b8860b; /* goldish */
    --chat-text: #222;
    --chat-muted: #666;
}

#chat-widget {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 2000;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    pointer-events: auto; /* enable interactions inside the widget */
}

/* Bubble */
.chat-toggle {
    pointer-events: auto;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: var(--chat-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: transform .12s ease, box-shadow .12s ease;
    -webkit-tap-highlight-color: transparent;
}

.chat-toggle:active,
.chat-toggle:focus {
    transform: translateY(1px);
    outline: none;
}

.chat-toggle__icon {
    font-size: 32px;
    line-height: 1;
}

.chat-toggle__inner-label {
    font-size: 12px;
    margin-top: 4px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.2px;
}

/* Panel */
.chat-panel {
    pointer-events: auto; /* allow clicks and scrolls inside panel */
    width: 320px;
    max-width: calc(100vw - 40px);
    height: 480px;
    display: none;
    flex-direction: column;
    background: var(--chat-bg);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    margin-bottom: 12px;
}

/* Header and content */
.chat-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: linear-gradient(90deg, rgba(184,134,11,0.1), rgba(184,134,11,0.06));
    border-bottom: 1px solid #eee;
}

.chat-panel__title {
    font-weight: 600;
    color: var(--chat-text);
}

.chat-panel__close {
    border: none;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
    color: var(--chat-muted);
}

/* messages area: ensure proper scrolling behavior */
.chat-panel__messages {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
    background: linear-gradient(#fff, #fafafa);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* messages */
.chat-message {
    max-width: 78%;
    padding: 8px 12px;
    border-radius: 10px;
    line-height: 1.3;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--chat-accent);
    color: #fff;
    border-bottom-right-radius: 6px;
}

.chat-message.bot {
    align-self: flex-start;
    background: #f1f1f1;
    color: var(--chat-text);
    border-bottom-left-radius: 6px;
}

/* form */
.chat-panel__form {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
}

.chat-panel__input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    outline: none;
}

.chat-panel__send {
    background: var(--chat-accent);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.chat-panel__status {
    padding: 6px 10px;
    font-size: 12px;
    color: var(--chat-muted);
    display: none;
}

/* Visible state */
.chat-panel.open {
    display: flex;
    animation: pop .12s ease-out;
}

@keyframes pop {
    from { transform: translateY(6px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 600px) {
    .chat-toggle {
        width: 80px;
        height: 80px;
        font-size: 22px;
    }
    .chat-toggle__icon {
        font-size: 22px;
    }
    .chat-toggle__inner-label {
        font-size: 10px;
    }
    .chat-panel {
        width: calc(100vw - 40px);
        height: 60vh;
    }
}