/* =========================================================
   VELOQUIP SMS - AI CHAT SYSTEM STYLES
   Glassmorphic dark/light responsive interface
========================================================= */

:root {
    --vq-ai-primary: #10b981;
    --vq-ai-primary-dark: #047857;
    --vq-ai-primary-light: #34d399;
    --vq-ai-accent: #06b6d4;
    --vq-ai-gold: #fbbf24;
    --vq-ai-bg: #0b0f26;
    --vq-ai-card: rgba(18, 24, 52, 0.85);
    --vq-ai-border: rgba(16, 185, 129, 0.25);
    --vq-ai-text: #f8fafc;
    --vq-ai-muted: #94a3b8;
    --vq-ai-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.65), 0 0 25px rgba(16, 185, 129, 0.15);
}

/* Floating Launcher Button */
.vq-ai-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4), 0 0 20px rgba(6, 182, 212, 0.3);
    color: #ffffff;
    border: none;
    cursor: pointer;
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
}

.vq-ai-launcher:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 14px 30px rgba(16, 185, 129, 0.5), 0 0 30px rgba(6, 182, 212, 0.4);
}

.vq-ai-launcher:active {
    transform: scale(0.95);
}

.vq-ai-launcher-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(16, 185, 129, 0.6);
    animation: vqPulseRing 2.4s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
    pointer-events: none;
}

@keyframes vqPulseRing {
    0% { transform: scale(0.9); opacity: 0.9; }
    50% { transform: scale(1.25); opacity: 0; }
    100% { transform: scale(1.25); opacity: 0; }
}

.vq-ai-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #060818;
}

/* Chat Container Window */
.vq-ai-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 610px;
    max-height: calc(100vh - 120px);
    background: var(--vq-ai-card);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid var(--vq-ai-border);
    border-radius: 24px;
    box-shadow: var(--vq-ai-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99995;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--vq-ai-text);
}

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

/* Header */
.vq-ai-header {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(6, 182, 212, 0.15) 100%), rgba(10, 14, 38, 0.95);
    border-bottom: 1px solid var(--vq-ai-border);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.vq-ai-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    position: relative;
}

.vq-ai-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid #060818;
}

.vq-ai-title {
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
}

.vq-ai-subtitle {
    font-size: 11px;
    color: var(--vq-ai-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.vq-ai-btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--vq-ai-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

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

/* Chat Body / Messages Area */
.vq-ai-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.vq-ai-body::-webkit-scrollbar {
    width: 5px;
}

.vq-ai-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

/* Messages */
.vq-ai-msg {
    display: flex;
    flex-direction: column;
    max-width: 86%;
    animation: vqMsgFadeIn 0.25s ease-out;
}

@keyframes vqMsgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.vq-ai-msg.user {
    align-self: flex-end;
}

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

.vq-ai-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
}

.vq-ai-msg.user .vq-ai-bubble {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.vq-ai-msg.ai .vq-ai-bubble {
    background: rgba(255, 255, 255, 0.08);
    color: var(--vq-ai-text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 4px;
}

.vq-ai-time {
    font-size: 10px;
    color: var(--vq-ai-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.vq-ai-msg.user .vq-ai-time {
    text-align: right;
}

/* Typing Indicator */
.vq-ai-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: fit-content;
    border-bottom-left-radius: 4px;
}

.vq-ai-typing-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: vqTypingBounce 1.4s infinite ease-in-out both;
}

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

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

/* Rich Cards inside Chat */
.vq-ai-card-widget {
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--vq-ai-border);
    border-radius: 14px;
    padding: 12px;
}

.vq-ai-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #10b981;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vq-ai-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.vq-ai-stat-row:last-child {
    border-bottom: none;
}

.vq-ai-btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 14px;
    margin-top: 10px;
    border-radius: 10px;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    color: #ffffff !important;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.vq-ai-btn-action:hover {
    opacity: 0.92;
}

/* 160-Character SMS to Admin Box */
.vq-ai-sms-box {
    margin-top: 10px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 14px;
    padding: 12px;
}

.vq-ai-sms-box-title {
    font-size: 12px;
    font-weight: 700;
    color: #f87171;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vq-ai-sms-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #ffffff;
    font-size: 12px;
    padding: 8px 10px;
    margin-bottom: 6px;
    outline: none;
}

.vq-ai-sms-textarea {
    width: 100%;
    height: 64px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #ffffff;
    font-size: 12px;
    padding: 8px 10px;
    outline: none;
    resize: none;
}

.vq-ai-sms-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--vq-ai-muted);
    margin-top: 4px;
}

.vq-ai-sms-counter.limit {
    color: #ef4444;
    font-weight: 700;
}

.vq-ai-btn-forward {
    background: #ef4444;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
}

.vq-ai-btn-forward:hover {
    background: #dc2626;
}

/* Quick Suggestion Chips */
.vq-ai-chips-wrap {
    padding: 8px 14px 4px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.15);
}

.vq-ai-chips-wrap::-webkit-scrollbar {
    display: none;
}

.vq-ai-chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--vq-ai-text);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    flex-shrink: 0;
}

.vq-ai-chip:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    color: #34d399;
}

/* Footer / Input Bar */
.vq-ai-footer {
    padding: 10px 14px 14px;
    background: rgba(10, 14, 38, 0.95);
    border-top: 1px solid var(--vq-ai-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vq-ai-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 4px 8px 4px 14px;
    transition: border-color 0.2s;
}

.vq-ai-input-row:focus-within {
    border-color: #10b981;
    background: rgba(255, 255, 255, 0.09);
}

.vq-ai-textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 13.5px;
    resize: none;
    max-height: 80px;
    padding: 8px 0;
    font-family: inherit;
}

.vq-ai-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.vq-ai-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.vq-ai-send-btn:hover {
    transform: scale(1.05);
}

.vq-ai-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.vq-ai-footer-note {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .vq-ai-launcher {
        bottom: 18px;
        right: 18px;
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    .vq-ai-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
    .vq-ai-header {
        padding-top: max(14px, env(safe-area-inset-top));
    }
    .vq-ai-footer {
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }
}
