/* ========================================
   Creek Motors — AI Assistant Chatbot
   Orange theme, Bootstrap accordion-inspired
   ======================================== */

/* Floating button */
.creek-chat-fab {
    position: fixed;
    bottom: 86px;
    right: 30px;
    width: 46px;
    height: 46px;
    border: none;
    cursor: pointer;
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 106, 26, 0.12);
    border-radius: 50%;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;
    animation: creek-chat-pulse 3s ease-in-out infinite;
}
.creek-chat-fab:hover {
    transform: scale(1.1);
    background: rgba(255, 106, 26, 0.2);
}
.creek-chat-fab:active { transform: scale(0.95); }
.creek-chat-fab img {
    width: 36px;
    height: 36px;
    pointer-events: none;
    filter: drop-shadow(0 2px 6px rgba(255, 54, 0, 0.3));
}
.creek-chat-fab.is-open img { display: none; }
.creek-chat-fab.is-open::after {
    content: '\00d7';
    font-size: 24px;
    font-weight: 300;
    color: #FF6A1A;
    line-height: 1;
}
@keyframes creek-chat-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 106, 26, 0.25); }
    50% { box-shadow: 0 0 0 8px rgba(255, 106, 26, 0); }
}

/* Notification badge */
.creek-chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #050B20;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    transition: opacity 0.3s ease;
}
.creek-chat-fab.is-open .creek-chat-badge { opacity: 0; }

/* Chat panel */
.creek-chat-panel {
    position: fixed;
    bottom: 142px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 60px);
    height: 540px;
    max-height: calc(100vh - 180px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(5, 11, 32, 0.2);
    z-index: 99991;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.creek-chat-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Panel header */
.creek-chat-header {
    background: linear-gradient(135deg, #050B20 0%, #0a1530 100%);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.creek-chat-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.creek-chat-header-avatar img { width: 22px; height: 22px; pointer-events: none; }
.creek-chat-header-info { flex: 1; min-width: 0; }
.creek-chat-header-title {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.2;
}
.creek-chat-header-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.creek-chat-header-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    flex-shrink: 0;
}
.creek-chat-header-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    flex-shrink: 0;
}
.creek-chat-header-close:hover { background: rgba(255, 54, 0, 0.5); }

/* Messages area */
.creek-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8f9fb;
    scroll-behavior: smooth;
}
.creek-chat-messages::-webkit-scrollbar { width: 6px; }
.creek-chat-messages::-webkit-scrollbar-track { background: transparent; }
.creek-chat-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
.creek-chat-messages::-webkit-scrollbar-thumb:hover { background: #ccc; }

/* Individual messages */
.creek-chat-msg {
    display: flex;
    gap: 10px;
    max-width: 88%;
    animation: creek-chat-msg-in 0.3s ease;
}
@keyframes creek-chat-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.creek-chat-msg-bot { align-self: flex-start; }
.creek-chat-msg-user { align-self: flex-end; flex-direction: row-reverse; }

.creek-chat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.creek-chat-msg-bot .creek-chat-msg-avatar {
    background: #fff;
}
.creek-chat-msg-bot .creek-chat-msg-avatar img { width: 18px; height: 18px; pointer-events: none; }
.creek-chat-msg-user .creek-chat-msg-avatar {
    background: #050B20;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    font-family: 'Outfit', sans-serif;
}

.creek-chat-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.55;
    font-family: 'Inter', sans-serif;
}
.creek-chat-msg-bot .creek-chat-msg-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #eee;
    border-top-left-radius: 4px;
}
.creek-chat-msg-user .creek-chat-msg-bubble {
    background: linear-gradient(135deg, #FF6A1A 0%, #FF3600 100%);
    color: #fff;
    border-top-right-radius: 4px;
}

/* Quick reply chips */
.creek-chat-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
    background: #f8f9fb;
    flex-shrink: 0;
}
.creek-chat-quick-reply {
    padding: 8px 14px;
    border: 1.5px solid #FF6A1A;
    border-radius: 20px;
    background: #fff;
    color: #FF6A1A;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.creek-chat-quick-reply:hover {
    background: #FF6A1A;
    color: #fff;
}

/* Typing indicator */
.creek-chat-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}
.creek-chat-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #bbb;
    animation: creek-chat-typing-bounce 1.4s ease-in-out infinite;
}
.creek-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.creek-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes creek-chat-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
.creek-chat-input-area {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.creek-chat-input {
    flex: 1;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: #333;
    resize: none;
    max-height: 100px;
    min-height: 42px;
    outline: none;
    transition: border-color 0.2s ease;
    line-height: 1.4;
}
.creek-chat-input:focus { border-color: #FF6A1A; }
.creek-chat-input::placeholder { color: #aaa; }

.creek-chat-voice-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #f0f2f5;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.creek-chat-voice-btn:hover { background: #e8ecf1; color: #333; }
.creek-chat-voice-btn svg { width: 20px; height: 20px; fill: currentColor; }
.creek-chat-voice-btn.is-recording {
    background: #FF3600;
    color: #fff;
    animation: creek-chat-recording 1.2s ease-in-out infinite;
}
@keyframes creek-chat-recording {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 54, 0, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255, 54, 0, 0); }
}

.creek-chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #FF6A1A 0%, #FF3600 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.creek-chat-send-btn:hover { transform: scale(1.05); }
.creek-chat-send-btn:active { transform: scale(0.92); }
.creek-chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.creek-chat-send-btn svg { width: 20px; height: 20px; fill: #fff; }

/* Voice indicator bar */
.creek-chat-voice-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff3ef;
    border-top: 1px solid #ffe0d6;
    font-size: 13px;
    color: #FF3600;
    font-weight: 600;
    flex-shrink: 0;
}
.creek-chat-voice-bar.is-active { display: flex; }
.creek-chat-voice-bar .pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #FF3600;
    animation: creek-chat-recording 1s ease-in-out infinite;
}

/* Mobile */
@media (max-width: 767px) {
    .creek-chat-fab { bottom: 82px; right: 20px; width: 42px; height: 42px; }
    .creek-chat-fab img { width: 32px; height: 32px; }
    .creek-chat-panel {
        bottom: 132px;
        right: 12px;
        width: calc(100vw - 24px);
        height: calc(100vh - 160px);
        max-height: 560px;
        border-radius: 16px;
    }
    .creek-chat-quick-replies { padding: 0 12px 10px; }
    .creek-chat-input-area { padding: 10px 12px; }
}
