/**
 * VarkaSolar — AI Assistant Styling (v1.0)
 * Path: public_html/assets/ai-assistant.css
 */

/* 1. Chat Widget Floating Trigger Button */
.vs-ai-widget-trigger {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: hsl(var(--vs-brand));
    color: hsl(var(--vs-obsidian));
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15), 0 0 0 4px rgba(255,199,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 4900;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.vs-ai-widget-trigger:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2), 0 0 0 6px rgba(255,199,0,0.3);
}
.vs-ai-widget-trigger svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    transition: transform 0.4s;
}
.vs-ai-widget-trigger.is-active svg {
    transform: rotate(90deg);
}

/* 2. Main Chat Panel Card */
.vs-ai-chat-panel {
    position: fixed;
    bottom: 108px;
    right: 32px;
    width: 380px;
    height: 580px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.1);
    z-index: 4900;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.vs-ai-chat-panel.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 3. Panel Header */
.vs-ai-chat-header {
    background: hsl(var(--vs-obsidian));
    color: #FFF;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.vs-ai-header-profile {
    display: flex;
    align-items: center;
    gap: 14px;
}
.vs-ai-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
    border: 2px solid hsl(var(--vs-brand));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    position: relative;
}
.vs-ai-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10B981;
    border: 2px solid hsl(var(--vs-obsidian));
    box-shadow: 0 0 8px #10B981;
}
.vs-ai-header-text h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    font-family: 'Outfit';
    letter-spacing: -0.2px;
}
.vs-ai-header-text span {
    font-size: 0.7rem;
    opacity: 0.5;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.vs-ai-close-btn {
    background: none;
    border: none;
    color: #FFF;
    opacity: 0.5;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px;
    transition: all 0.3s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vs-ai-close-btn:hover {
    opacity: 1;
    background: rgba(255,255,255,0.05);
}

/* 4. Chat Body Messages */
.vs-ai-chat-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: rgba(248, 250, 252, 0.4);
    scroll-behavior: smooth;
}

/* Scrollbar styling */
.vs-ai-chat-body::-webkit-scrollbar {
    width: 5px;
}
.vs-ai-chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.vs-ai-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

/* 5. Message Bubbles */
.vs-ai-message {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    animation: vsMsgFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes vsMsgFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.vs-ai-message.role-user {
    align-self: flex-end;
}
.vs-ai-message.role-assistant {
    align-self: flex-start;
}

.vs-ai-msg-bubble {
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    line-height: 1.6;
    font-weight: 500;
    font-family: 'Inter';
    word-break: break-word;
}

.vs-ai-message.role-user .vs-ai-msg-bubble {
    background: hsl(var(--vs-obsidian));
    color: #FFF;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.vs-ai-message.role-assistant .vs-ai-msg-bubble {
    background: #FFF;
    color: hsl(var(--vs-obsidian));
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.vs-ai-msg-bubble p {
    margin: 0 0 10px;
}
.vs-ai-msg-bubble p:last-child {
    margin-bottom: 0;
}
.vs-ai-msg-bubble ul, .vs-ai-msg-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}
.vs-ai-msg-bubble li {
    margin-bottom: 6px;
}

/* Message metadata */
.vs-ai-msg-meta {
    font-size: 0.65rem;
    opacity: 0.4;
    margin-top: 4px;
    font-weight: 700;
    text-transform: uppercase;
    font-family: 'Outfit';
    letter-spacing: 0.5px;
}
.vs-ai-message.role-user .vs-ai-msg-meta {
    align-self: flex-end;
}
.vs-ai-message.role-assistant .vs-ai-msg-meta {
    align-self: flex-start;
}

/* 6. Quick Action Suggestion Buttons */
.vs-ai-quick-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.vs-ai-quick-btn {
    background: #FFF;
    color: hsl(var(--vs-obsidian));
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 100px;
    padding: 8px 16px;
    font-size: 0.78rem;
    font-weight: 800;
    font-family: 'Outfit';
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}
.vs-ai-quick-btn:hover {
    background: hsl(var(--vs-brand));
    border-color: hsl(var(--vs-brand));
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* 7. Lead Form UI Cards */
.vs-ai-form-card {
    background: #FFF;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 20px;
    padding: 20px;
    margin-top: 6px;
    width: 100%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.04);
}
.vs-ai-form-card h4 {
    margin: 0 0 14px;
    font-family: 'Outfit';
    font-weight: 800;
    font-size: 0.95rem;
    color: hsl(var(--vs-obsidian));
}
.vs-ai-form-grid {
    display: grid;
    gap: 12px;
}
.vs-ai-form-field label {
    display: block;
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    color: hsl(var(--vs-slate));
    opacity: 0.6;
    margin-bottom: 4px;
    font-family: 'Outfit';
    letter-spacing: 0.5px;
}
.vs-ai-form-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.08);
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    transition: border-color 0.3s;
    font-family: 'Inter';
}
.vs-ai-form-input:focus {
    border-color: hsl(var(--vs-brand-deep));
}
.vs-ai-form-submit {
    background: hsl(var(--vs-brand));
    color: hsl(var(--vs-obsidian));
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 900;
    font-family: 'Outfit';
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.8px;
}
.vs-ai-form-submit:hover {
    background: hsl(var(--vs-obsidian));
    color: #FFF;
}

/* Consent check */
.vs-ai-form-consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.72rem;
    line-height: 1.4;
    color: hsl(var(--vs-slate));
    margin-top: 4px;
}
.vs-ai-form-consent input {
    margin-top: 2px;
}

/* 8. Typing / Loading Indicator */
.vs-ai-loading-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    background: #FFF;
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    align-self: flex-start;
}
.vs-ai-loading-dot {
    width: 6px;
    height: 6px;
    background: hsl(var(--vs-obsidian));
    border-radius: 50%;
    opacity: 0.4;
    animation: vsDotBlink 1.4s infinite both;
}
.vs-ai-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.vs-ai-loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes vsDotBlink {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.4); opacity: 1; }
}

/* 9. Input Footer Area */
.vs-ai-chat-footer {
    padding: 16px 20px;
    background: #FFF;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}
.vs-ai-input-wrapper {
    flex: 1;
    position: relative;
}
.vs-ai-chat-input {
    width: 100%;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(248, 250, 252, 0.6);
    border-radius: 100px;
    padding: 12px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    outline: none;
    transition: all 0.3s;
    font-family: 'Inter';
    color: hsl(var(--vs-obsidian));
}
.vs-ai-chat-input:focus {
    border-color: hsl(var(--vs-brand-deep));
    background: #FFF;
    box-shadow: 0 0 0 3px rgba(255,199,0,0.1);
}
.vs-ai-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: hsl(var(--vs-obsidian));
    color: #FFF;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}
.vs-ai-send-btn:hover {
    background: hsl(var(--vs-brand));
    color: hsl(var(--vs-obsidian));
    transform: scale(1.05);
}
.vs-ai-send-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* 10. Responsive Overrides (Mobile Adaptation) */
@media (max-width: 768px) {
    .vs-ai-chat-panel {
        bottom: 76px; /* Offset for Mobile App navigation bar */
        right: 16px;
        left: 16px;
        width: auto;
        height: calc(100% - 96px); /* Full height overlay on mobile */
        border-radius: 24px;
    }
    .vs-ai-widget-trigger {
        bottom: 84px; /* Elevate trigger to prevent colliding with Mobile Nav */
        right: 16px;
        width: 52px;
        height: 52px;
    }
}
