/*-----------------------------------------------------------------------------------
# Sunil Dhital - AI Web Consultant & Lead Generation Assistant
# Glassmorphism, 3D Pulsing Trigger, Instant WhatsApp Engine & Pure Text Speed
-----------------------------------------------------------------------------------*/

/* Floating Trigger Button */
.ai-agent-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(236, 72, 153, 0.95));
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    padding: 10px 18px 10px 12px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 30px -5px rgba(99, 102, 241, 0.5), 0 0 20px rgba(236, 72, 153, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #ffffff;
    user-select: none;
}

.ai-agent-trigger:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 16px 40px -5px rgba(99, 102, 241, 0.7), 0 0 25px rgba(236, 72, 153, 0.5);
    border-color: rgba(255, 255, 255, 0.5);
}

.ai-agent-trigger-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

.ai-agent-trigger-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-agent-pulse-ring {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    border: 2px solid #10b981;
    animation: aiRingPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    pointer-events: none;
}

@keyframes aiRingPulse {
    0% { transform: scale(0.95); opacity: 0.9; }
    50% { transform: scale(1.4); opacity: 0; }
    100% { transform: scale(0.95); opacity: 0; }
}

.ai-agent-trigger-text {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.2;
}

.ai-agent-trigger-title {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-agent-trigger-subtitle {
    font-size: 0.7rem;
    opacity: 0.88;
}

.ai-agent-sparkle {
    color: #fbbf24;
    animation: aiSparkleRotate 3s linear infinite;
}

@keyframes aiSparkleRotate {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

/* Chat Widget Modal Box */
.ai-agent-widget {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 420px;
    max-width: calc(100vw - 32px);
    height: 640px;
    max-height: calc(100vh - 120px);
    background: rgba(13, 17, 27, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 24px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 35px rgba(99, 102, 241, 0.25);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(25px) scale(0.96);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Widget Header */
.ai-widget-header {
    background: linear-gradient(135deg, rgba(30, 36, 56, 0.98), rgba(20, 24, 40, 0.98));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.ai-header-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-header-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid var(--primary-color);
}

.ai-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-header-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #10b981;
    border: 2px solid #0d111b;
    border-radius: 50%;
}

.ai-header-meta h6 {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-header-meta span {
    font-size: 0.72rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.ai-btn-icon {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.ai-btn-icon:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--primary-color);
    color: #ffffff;
    transform: scale(1.08);
}

/* Secondary Controls Strip (Language Selector) */
.ai-controls-strip {
    background: rgba(18, 24, 38, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.75rem;
}

.ai-lang-select-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-lang-select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.75rem;
    outline: none;
    cursor: pointer;
}

.ai-lang-select option {
    background: #0f172a;
    color: #ffffff;
}

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

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

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

/* Messages */
.ai-message {
    display: flex;
    gap: 10px;
    max-width: 90%;
    animation: aiMsgFadeIn 0.3s ease forwards;
}

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

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

.ai-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    margin-top: 2px;
}

.ai-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-msg-content {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    padding: 10px 14px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    font-size: 0.83rem;
    line-height: 1.55;
    word-break: break-word;
    position: relative;
}

.ai-message.user .ai-msg-content {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: rgba(255, 255, 255, 0.2);
    border-top-left-radius: 16px;
    border-top-right-radius: 4px;
    color: #ffffff;
}

.ai-msg-content p {
    margin-bottom: 6px;
}
.ai-msg-content p:last-child {
    margin-bottom: 0;
}

.ai-msg-content strong {
    color: #ffffff;
    font-weight: 600;
}

.ai-msg-content a {
    color: #38bdf8;
    text-decoration: underline;
}

.ai-msg-time {
    font-size: 0.65rem;
    opacity: 0.6;
    margin-top: 4px;
    display: block;
    text-align: right;
}

/* Typing Indicator */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    width: fit-content;
}

.ai-typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: aiTypingBounce 1.4s infinite ease-in-out both;
}

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

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

/* Quick Suggestion Chips */
.ai-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 4px 6px 4px;
}

.ai-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.76rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-chip:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--primary-color);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Interactive Booking Form Card */
.ai-booking-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(99, 102, 241, 0.45);
    border-radius: 16px;
    padding: 14px;
    margin-top: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: aiMsgFadeIn 0.3s ease;
}

.ai-booking-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-booking-field {
    margin-bottom: 8px;
}

.ai-booking-field label {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-bottom: 3px;
    display: block;
}

.ai-booking-input, .ai-booking-select, .ai-booking-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.78rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.ai-booking-input:focus, .ai-booking-select:focus, .ai-booking-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.ai-booking-submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: #ffffff;
    border-radius: 10px;
    padding: 9px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.ai-booking-submit-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

/* WhatsApp Lead Card (Generated after Booking Submission) */
.ai-whatsapp-lead-card {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.95), rgba(4, 120, 87, 0.9));
    border: 1px solid rgba(52, 211, 153, 0.45);
    border-radius: 16px;
    padding: 14px;
    margin-top: 8px;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
    animation: aiMsgFadeIn 0.3s ease;
}

.ai-whatsapp-lead-card h6 {
    margin: 0 0 6px 0;
    font-weight: 700;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-whatsapp-lead-card p {
    font-size: 0.78rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.ai-btn-whatsapp-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #25D366;
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 0.84rem;
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    transition: all 0.25s ease;
}

.ai-btn-whatsapp-action:hover {
    background: #1eb954;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

/* Widget Footer & Input */
.ai-widget-footer {
    background: rgba(20, 26, 42, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 14px;
    flex-shrink: 0;
}

.ai-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    padding: 5px 6px 5px 16px;
    transition: all 0.2s ease;
}

.ai-input-wrap:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.ai-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 0.83rem;
    outline: none;
}

.ai-chat-input::placeholder {
    color: #64748b;
}

.ai-btn-send {
    background: var(--primary-gradient-color);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.88rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
}

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

/* Responsive Mobile Adjustments */
@media (max-width: 480px) {
    .ai-agent-trigger {
        bottom: 16px;
        right: 16px;
        padding: 8px 14px 8px 10px;
    }
    .ai-agent-trigger-subtitle {
        display: none;
    }
    .ai-agent-widget {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        max-width: 100vw;
        border-radius: 0;
        border: none;
    }
}
