/* ==========================================================================
   General Agrovet - AI Assistant & Customer Support Chat Widget
   ========================================================================== */

/* Floating Launcher Button */
.ga-ai-launcher {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(22, 101, 52, 0.35), 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    border: 2px solid rgba(255, 255, 255, 0.2);
    user-select: none;
}

.ga-ai-launcher:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 30px rgba(22, 101, 52, 0.45), 0 4px 10px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.ga-ai-launcher-icon {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ga-ai-launcher-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 20%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.ga-ai-pulse-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    background-color: #22c55e;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 8px #22c55e;
    animation: gaAiPulse 2s infinite;
}

@keyframes gaAiPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.ga-ai-launcher-label {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Chat Card Window */
.ga-ai-window {
    position: fixed;
    bottom: 90px;
    right: 25px;
    width: 380px;
    max-width: calc(100vw - 30px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.22), 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(22, 101, 52, 0.15);
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ga-ai-window.ga-active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Header */
.ga-ai-header {
    background: linear-gradient(135deg, #14532d 0%, #166534 60%, #15803d 100%);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.ga-ai-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ga-ai-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.ga-ai-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 20%;
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ga-ai-avatar-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: #22c55e;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.8);
}

.ga-ai-title-wrap h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.ga-ai-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: #bbf7d0;
    margin-top: 3px;
}

.ga-ai-status-pill::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    background-color: #4ade80;
    border-radius: 50%;
}

.ga-ai-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ga-ai-btn-icon {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.ga-ai-btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Quick Topic Pills Container */
.ga-ai-chips-wrap {
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ga-ai-chip {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.ga-ai-chip:hover {
    background: #ecfdf5;
    border-color: #10b981;
    color: #047857;
    transform: translateY(-1px);
}

/* Message History Scroll Area */
.ga-ai-messages {
    flex: 1;
    padding: 16px 14px;
    overflow-y: auto;
    background: #fafaf9;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* Message Bubbles */
.ga-ai-msg {
    display: flex;
    gap: 10px;
    max-width: 88%;
}

.ga-ai-msg.ga-ai-bot {
    align-self: flex-start;
}

.ga-ai-msg.ga-ai-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ga-ai-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
    overflow: hidden;
}

.ga-ai-msg-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 20%;
    display: block;
}

.ga-ai-bot .ga-ai-msg-avatar {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.ga-ai-user .ga-ai-msg-avatar {
    background: #0284c7;
    color: #ffffff;
}

.ga-ai-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.5;
    word-break: break-word;
}

.ga-ai-bot .ga-ai-msg-bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ga-ai-user .ga-ai-msg-bubble {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 2px 6px rgba(22, 101, 52, 0.25);
}

.ga-ai-msg-bubble p {
    margin: 0 0 6px 0;
}

.ga-ai-msg-bubble p:last-child {
    margin-bottom: 0;
}

.ga-ai-msg-bubble ul, .ga-ai-msg-bubble ol {
    margin: 4px 0 6px 18px;
    padding: 0;
}

.ga-ai-msg-bubble li {
    margin-bottom: 3px;
}

.ga-ai-msg-bubble strong {
    color: #0f172a;
}

.ga-ai-user .ga-ai-msg-bubble strong {
    color: #ffffff;
}

.ga-ai-msg-time {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 4px;
    text-align: right;
}

/* Typing Indicator */
.ga-ai-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.ga-ai-typing-dot {
    width: 6px;
    height: 6px;
    background: #16a34a;
    border-radius: 50%;
    animation: gaAiBounce 1.4s infinite ease-in-out both;
}

.ga-ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ga-ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes gaAiBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.ga-ai-input-wrap {
    padding: 10px 14px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ga-ai-input-box {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 22px;
    padding: 9px 14px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
    background: #f8fafc;
    resize: none;
    height: 40px;
    max-height: 100px;
    line-height: 1.4;
}

.ga-ai-input-box:focus {
    border-color: #16a34a;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.ga-ai-send-btn {
    width: 40px;
    height: 40px;
    background: #15803d;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ga-ai-send-btn:hover:not(:disabled) {
    background: #16a34a;
    transform: scale(1.05);
}

.ga-ai-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Live Typewriter & Cursor Animation */
.ga-ai-cursor {
    display: inline-block;
    width: 2px;
    height: 1.15em;
    background: #16a34a;
    vertical-align: middle;
    margin-left: 2px;
    animation: gaAiBlink 0.75s infinite ease-in-out;
}

@keyframes gaAiBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.ga-ai-msg-time {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 5px;
}

.ga-ai-msg-time i {
    color: #16a34a;
    font-size: 0.75rem;
}

/* Footer / Disclaimer */
.ga-ai-footer-note {
    font-size: 0.68rem;
    color: #94a3b8;
    text-align: center;
    padding: 4px 10px 6px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}

/* Responsive */
@media (max-width: 480px) {
    .ga-ai-window {
        right: 12px;
        bottom: 80px;
        width: calc(100vw - 24px);
        height: calc(100vh - 100px);
        border-radius: 12px;
    }
    .ga-ai-launcher {
        right: 15px;
        bottom: 18px;
        padding: 10px 16px;
    }
    .ga-ai-launcher-label {
        font-size: 0.85rem;
    }
}
