/* ═══════════════════════════════════════════════
   Auto Car Club — AI Chat Widget Styles
   ═══════════════════════════════════════════════ */

/* ── Chat Panel ── */
.chat-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity .3s ease, transform .3s ease;
}
.chat-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Header ── */
.chat-header {
    background: linear-gradient(135deg, #111 0%, #222 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #FF6B00, #ff8c33);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.chat-title {
    font-weight: 600;
    font-size: 15px;
}
.chat-subtitle {
    font-size: 11px;
    opacity: .75;
}
.chat-header-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}
.chat-close,
.chat-new-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    opacity: .7;
    padding: 4px 6px;
    border-radius: 6px;
    transition: opacity .2s, background .2s;
}
.chat-close:hover,
.chat-new-btn:hover {
    opacity: 1;
    background: rgba(255,255,255,.1);
}

/* ── Messages Area ── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f5f5f5;
    scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar {
    width: 4px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* ── Welcome ── */
.chat-welcome {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.chat-welcome-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.chat-welcome-text {
    font-size: 13px;
    color: #333;
    line-height: 1.5;
}
.chat-welcome-text strong {
    color: #FF6B00;
    font-size: 15px;
}

/* ── Message Bubbles ── */
.chat-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 90%;
}
.chat-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.chat-msg-assistant {
    align-self: flex-start;
}
.chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: #e8e8e8;
}
.chat-msg-avatar-user {
    background: #FF6B00;
    color: #fff;
    font-size: 14px;
}
.chat-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
}
.chat-msg-user .chat-bubble {
    background: #FF6B00;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg-assistant .chat-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.chat-bubble a.chat-link {
    color: #FF6B00;
    text-decoration: underline;
    font-weight: 500;
}
.chat-msg-user .chat-bubble a.chat-link {
    color: #fff;
    text-decoration: underline;
}
.chat-bubble .chat-list-item {
    display: block;
    padding-left: 10px;
    border-left: 2px solid #FF6B00;
    margin: 4px 0;
}

/* ── Product Cards ── */
.chat-products {
    width: 100%;
    overflow: hidden;
}
.chat-products-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.chat-products-scroll::-webkit-scrollbar {
    height: 3px;
}
.chat-products-scroll::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}
.chat-product-card {
    flex-shrink: 0;
    width: 140px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: #333;
    box-shadow: 0 1px 6px rgba(0,0,0,.08);
    transition: transform .2s, box-shadow .2s;
    scroll-snap-align: start;
}
.chat-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.chat-product-card img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    background: #f0f0f0;
}
.chat-product-info {
    padding: 8px 10px;
}
.chat-product-name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.chat-product-price {
    font-size: 12px;
    color: #FF6B00;
    font-weight: 700;
}
.chat-product-rating {
    font-size: 11px;
    color: #f5a623;
    margin-top: 2px;
}

/* ── Action Chips ── */
.chat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 0;
}
.chat-action-chip {
    background: #fff;
    border: 1.5px solid #FF6B00;
    color: #FF6B00;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.chat-action-chip:hover {
    background: #FF6B00;
    color: #fff;
}

/* ── Typing Indicator ── */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-typing-dots {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.chat-typing-dots span {
    width: 8px;
    height: 8px;
    background: #bbb;
    border-radius: 50%;
    animation: chatBounce 1.4s infinite ease-in-out both;
}
.chat-typing-dots span:nth-child(1) { animation-delay: -.32s; }
.chat-typing-dots span:nth-child(2) { animation-delay: -.16s; }
@keyframes chatBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: .4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Input Bar ── */
.chat-input-wrap {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #eee;
    gap: 8px;
    flex-shrink: 0;
}
.chat-input-wrap input {
    flex: 1;
    border: 1.5px solid #e0e0e0;
    border-radius: 22px;
    padding: 9px 16px;
    font-size: 13.5px;
    outline: none;
    transition: border-color .2s;
    font-family: inherit;
}
.chat-input-wrap input:focus {
    border-color: #FF6B00;
}
.chat-input-wrap input::placeholder {
    color: #aaa;
}
#chatSend {
    width: 38px;
    height: 38px;
    border: none;
    background: #FF6B00;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: background .2s, transform .15s;
    flex-shrink: 0;
}
#chatSend:hover {
    background: #e55d00;
}
#chatSend:active {
    transform: scale(0.92);
}

/* ── FAB AI button ── */
.fab-ai {
    background: linear-gradient(135deg, #FF6B00, #ff8c33) !important;
    color: #fff !important;
    box-shadow: 0 2px 10px rgba(255,107,0,.3);
}
.fab-ai:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(255,107,0,.4);
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
    .chat-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        transform: translateY(100%);
    }
    .chat-panel.open {
        transform: translateY(0);
    }
    .chat-product-card {
        width: 130px;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .chat-panel {
        width: 340px;
        height: 480px;
        bottom: 80px;
        right: 12px;
    }
}
