/* AI Chatbot Pro */

#aichat-wrapper {
    position: fixed;
    bottom: 28px;
    z-index: 99999;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Toggle Button */
#aichat-toggle {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--aichat-color), var(--aichat-color-dark));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-left: auto;
}
#aichat-toggle:hover  { transform: scale(1.08); box-shadow: 0 6px 26px rgba(0,0,0,0.32); }
#aichat-toggle:active { transform: scale(0.96); }

/* Chat Window */
#aichat-window {
    display: none;
    flex-direction: column;
    position: absolute;
    bottom: 70px;
    width: 340px;
    height: 490px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    animation: aichatSlideIn 0.25s ease;
}
#aichat-window.open { display: flex; }

@keyframes aichatSlideIn {
    from { opacity:0; transform: translateY(12px) scale(0.97); }
    to   { opacity:1; transform: translateY(0) scale(1); }
}

/* Header */
#aichat-header {
    background: linear-gradient(135deg, var(--aichat-color), var(--aichat-color-dark));
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.aichat-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.aichat-header-info { display: flex; flex-direction: column; }
.aichat-bot-name  { color:#fff; font-weight:600; font-size:14px; line-height:1.2; }
.aichat-status    { color:rgba(255,255,255,0.8); font-size:11px; display:flex; align-items:center; gap:4px; margin-top:2px; }
.aichat-dot       { width:7px; height:7px; background:#4ade80; border-radius:50%; display:inline-block; animation: aichatPulse 2s infinite; }

@keyframes aichatPulse {
    0%,100% { opacity:1; }
    50%      { opacity:0.5; }
}

/* Messages */
#aichat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7f9fc;
    scroll-behavior: smooth;
}
#aichat-messages::-webkit-scrollbar       { width:4px; }
#aichat-messages::-webkit-scrollbar-track { background:transparent; }
#aichat-messages::-webkit-scrollbar-thumb { background:#d0dae8; border-radius:4px; }

.aichat-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    animation: aichatMsgIn 0.2s ease;
}
@keyframes aichatMsgIn {
    from { opacity:0; transform:translateY(6px); }
    to   { opacity:1; transform:translateY(0); }
}
.aichat-msg.bot  { align-self:flex-start; }
.aichat-msg.user { align-self:flex-end; }

.aichat-msg p {
    margin: 0;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.55;
}
.aichat-msg.bot p {
    background: #fff;
    color: #1a2332;
    border: 1px solid #e4ebf5;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.aichat-msg.user p {
    background: linear-gradient(135deg, var(--aichat-color), var(--aichat-color-dark));
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Quick Replies */
.aichat-quick-replies { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.aichat-qr {
    background: #fff;
    border: 1.5px solid var(--aichat-color);
    color: var(--aichat-color);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.aichat-qr:hover { background: var(--aichat-color); color:#fff; }

/* Typing */
.aichat-typing p { background:#fff !important; border:1px solid #e4ebf5 !important; }
.aichat-dots { display:flex; gap:4px; align-items:center; padding:2px 0; }
.aichat-dots span {
    width:7px; height:7px;
    background: var(--aichat-color);
    border-radius:50%; opacity:0.4;
    animation: aichatBounce 1.2s infinite;
}
.aichat-dots span:nth-child(2) { animation-delay:.2s; }
.aichat-dots span:nth-child(3) { animation-delay:.4s; }
@keyframes aichatBounce {
    0%,60%,100% { opacity:.4; transform:translateY(0); }
    30%          { opacity:1;  transform:translateY(-4px); }
}

/* Input */
#aichat-input-area {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #e4ebf5;
    gap: 8px;
    flex-shrink: 0;
}
#aichat-input {
    flex: 1;
    border: 1.5px solid #e4ebf5;
    border-radius: 24px;
    padding: 9px 14px;
    font-size: 13.5px;
    outline: none;
    color: #1a2332;
    background: #f7f9fc;
    transition: border-color 0.2s;
    font-family: inherit;
}
#aichat-input:focus       { border-color: var(--aichat-color); background:#fff; }
#aichat-input::placeholder { color:#9aacbf; }

#aichat-send {
    width:38px; height:38px;
    border-radius:50%;
    background: linear-gradient(135deg, var(--aichat-color), var(--aichat-color-dark));
    border:none; cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    flex-shrink:0;
    transition: transform 0.15s ease, opacity 0.15s;
}
#aichat-send:hover    { transform:scale(1.08); }
#aichat-send:active   { transform:scale(0.94); }
#aichat-send:disabled { opacity:0.5; cursor:not-allowed; transform:none; }

/* Mobile */
@media (max-width:480px) {
    #aichat-wrapper { bottom:16px; right:16px !important; left:auto !important; }
    #aichat-window  { width:calc(100vw - 32px); }
}
