/* Chat Widget — Golf Club Brokers */

/* ─── Red attention bar (mobile only) ─── */
.gcb-chat-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99989;
    background: #c00;
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.3px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: background .15s;
    display: none;
}
.gcb-chat-bar:hover { background: #a00; }
.gcb-chat-bar.hidden { display: none !important; }

/* ─── Chat tab (rounded rectangle, like tawk.to) ─── */
.gcb-chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    height: 44px;
    border-radius: 22px;
    background: #c00;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    z-index: 99990;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: transform .2s, background .2s;
}
.gcb-chat-bubble:hover { transform: scale(1.03); background: #a00; }
.gcb-chat-bubble svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.gcb-chat-bubble .gcb-chat-close { display: none; }
.gcb-chat-bubble .gcb-chat-label { }
.gcb-chat-bubble.open .gcb-chat-icon { display: none; }
.gcb-chat-bubble.open .gcb-chat-label { display: none; }
.gcb-chat-bubble.open .gcb-chat-close { display: block; }
.gcb-chat-bubble.open {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
}

/* ─── Chat panel ─── */
.gcb-chat-panel {
    position: fixed;
    bottom: 76px;
    right: 20px;
    width: 370px;
    max-height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.18);
    z-index: 99990;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.gcb-chat-panel.open { display: flex; }

.gcb-chat-header {
    background: #466d5c;
    color: #fff;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.gcb-chat-header .gcb-chat-dot {
    width: 8px; height: 8px;
    background: #8fcea8;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ─── Pre-chat form ─── */
.gcb-chat-prechat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
}
.gcb-prechat-inner { width: 100%; }
.gcb-prechat-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 6px;
}
.gcb-prechat-subtitle {
    font-size: 13px;
    color: #666;
    margin: 0 0 18px;
    line-height: 1.4;
}
.gcb-prechat-inner input[type="text"],
.gcb-prechat-inner input[type="email"] {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 10px;
    outline: none;
    box-sizing: border-box;
}
.gcb-prechat-inner input:focus { border-color: #466d5c; }
.gcb-prechat-hint {
    font-size: 11px;
    color: #999;
    margin: -4px 0 14px;
}
.gcb-prechat-btn {
    display: block;
    width: 100%;
    padding: 11px;
    background: #466d5c;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.gcb-prechat-btn:hover { background: #3a5e4e; }
.gcb-prechat-skip {
    display: block;
    width: 100%;
    padding: 8px;
    background: none;
    border: none;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    margin-top: 6px;
}
.gcb-prechat-skip:hover { color: #555; }

/* ─── Chat body ─── */
.gcb-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gcb-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 280px;
    max-height: 360px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gcb-chat-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
}
.gcb-chat-msg.customer {
    align-self: flex-end;
    background: #466d5c;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.gcb-chat-msg.ai,
.gcb-chat-msg.agent {
    align-self: flex-start;
    background: #f0f2f5;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
}

.gcb-chat-input-area {
    display: flex;
    border-top: 1px solid #e8e8e8;
    padding: 10px;
    gap: 8px;
}
.gcb-chat-input-area input[type="text"] {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    outline: none;
}
.gcb-chat-input-area input[type="text"]:focus { border-color: #466d5c; }
.gcb-chat-input-area button {
    background: #466d5c;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gcb-chat-input-area button:hover { background: #3a5e4e; }
.gcb-chat-input-area button svg { width: 18px; height: 18px; fill: currentColor; }

.gcb-chat-footer {
    text-align: center;
    padding: 6px;
    font-size: 11px;
    color: #999;
}

/* ─── End chat button ─── */
.gcb-end-chat {
    display: block;
    width: auto;
    margin: 0 10px 8px;
    padding: 6px 14px;
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    text-align: center;
}
.gcb-end-chat:hover { background: #f5f5f5; color: #666; }

/* ─── Post-chat form ─── */
.gcb-chat-postchat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
}

.gcb-chat-typing {
    font-size: 13px;
    color: #999;
    font-style: italic;
    padding: 0 16px 8px;
    display: none;
}
.gcb-chat-typing.visible { display: block; }

/* Mobile: hide bubble, show red bar */
@media (max-width: 768px) {
    .gcb-chat-bubble { display: none; }
    .gcb-chat-bar { display: block; }
    .gcb-chat-bar.hidden { display: none !important; }
    .gcb-chat-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
    .gcb-chat-messages { max-height: calc(100vh - 140px); min-height: auto; flex: 1; }
}
