/* CTX Sales Bot v4 — Auto-open, arrow collapse, smaller, Credit Cards Accepted */
#ctx-bot-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Toggle button (shown when collapsed) */
#ctx-bot-toggle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2e7d32, #4CAF50);
    border: none;
    cursor: pointer;
    font-size: 22px;
    box-shadow: 0 4px 18px rgba(76,175,80,0.5);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
#ctx-bot-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(76,175,80,0.7); }
#ctx-bot-toggle.hidden { display: none; }

/* Chat window — slightly smaller than default */
#ctx-bot-window {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 320px;
    max-height: 500px;
    background: #111;
    border: 1px solid #2e7d32;
    border-radius: 14px;
    box-shadow: 0 8px 36px rgba(0,0,0,0.75);
    display: none;
    flex-direction: column;
    overflow: hidden;
}
#ctx-bot-window.open { display: flex; }

/* Header */
#ctx-bot-header {
    background: linear-gradient(135deg, #1a1a1a, #2e7d32);
    padding: 11px 13px;
    display: flex;
    align-items: center;
    gap: 9px;
    border-bottom: 1px solid #2e7d32;
    flex-shrink: 0;
}
#ctx-bot-avatar {
    font-size: 20px;
    background: rgba(76,175,80,0.2);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#ctx-bot-header-info { flex: 1; }
#ctx-bot-header-info strong { display: block; color: #fff; font-size: 13px; font-weight: 700; }
#ctx-bot-status { color: #81c784; font-size: 11px; }

/* Credit Cards Accepted badge */
#ctx-bot-cc-badge {
    background: rgba(76,175,80,0.15);
    border: 1px solid #4CAF50;
    color: #81c784;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 2px 6px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Collapse arrow button (replaces X) */
#ctx-bot-collapse {
    background: none;
    border: none;
    color: #aaa;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s;
    line-height: 1;
    flex-shrink: 0;
}
#ctx-bot-collapse:hover { color: #fff; }

/* Messages area */
#ctx-bot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 350px;
    scrollbar-width: thin;
    scrollbar-color: #2e7d32 #111;
}
#ctx-bot-messages::-webkit-scrollbar { width: 3px; }
#ctx-bot-messages::-webkit-scrollbar-track { background: #111; }
#ctx-bot-messages::-webkit-scrollbar-thumb { background: #2e7d32; border-radius: 2px; }

.ctx-msg {
    max-width: 90%;
    padding: 9px 12px;
    border-radius: 11px;
    font-size: 13px;
    line-height: 1.55;
    word-wrap: break-word;
}
.ctx-msg.bot {
    background: #1e1e1e;
    color: #e0e0e0;
    border: 1px solid #2a2a2a;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}
.ctx-msg.user {
    background: linear-gradient(135deg, #2e7d32, #4CAF50);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
    font-weight: 500;
}
.ctx-msg strong { color: #81c784; }

/* Typing indicator */
.ctx-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
}
.ctx-typing span {
    width: 6px;
    height: 6px;
    background: #4CAF50;
    border-radius: 50%;
    animation: ctx-bounce 1.2s infinite;
}
.ctx-typing span:nth-child(2) { animation-delay: 0.2s; }
.ctx-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ctx-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-5px); opacity: 1; }
}

/* Quick reply buttons */
.ctx-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 3px 0;
    align-self: flex-start;
    max-width: 100%;
}
.ctx-qr {
    background: transparent;
    border: 1px solid #4CAF50;
    color: #4CAF50;
    padding: 5px 10px;
    border-radius: 18px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.ctx-qr:hover { background: #4CAF50; color: #000; }

/* Action / Add to Cart button */
.ctx-link-btn-container { align-self: flex-start; width: 100%; }
.ctx-action-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #2e7d32, #4CAF50);
    color: #fff !important;
    text-decoration: none !important;
    padding: 10px 14px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.4px;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(76,175,80,0.3);
}
.ctx-action-btn:hover {
    background: linear-gradient(135deg, #388e3c, #66bb6a);
    box-shadow: 0 3px 12px rgba(76,175,80,0.5);
    transform: translateY(-1px);
}
.ctx-add-to-cart { background: linear-gradient(135deg, #1b5e20, #2e7d32); }
.ctx-add-to-cart:hover { background: linear-gradient(135deg, #2e7d32, #4CAF50); }

/* Input area */
#ctx-bot-input-area {
    display: flex;
    padding: 10px;
    gap: 7px;
    border-top: 1px solid #222;
    background: #0d0d0d;
    flex-shrink: 0;
}
#ctx-bot-input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 7px;
    color: #e0e0e0;
    padding: 8px 12px;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}
#ctx-bot-input:focus { border-color: #4CAF50; }
#ctx-bot-input::placeholder { color: #666; }
#ctx-bot-send {
    background: #4CAF50;
    color: #000;
    border: none;
    border-radius: 7px;
    padding: 8px 13px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.4px;
    transition: background 0.2s;
}
#ctx-bot-send:hover { background: #66bb6a; }

@media (max-width: 480px) {
    #ctx-bot-window { width: calc(100vw - 28px); right: -6px; }
}
