/* ==========================================
   AI SEARCH FLOATING LAUNCHER & CHAT POPUP CSS
   ========================================== */

/* Floating Circular Launcher Icon Button - Positioned Immediately After Rewards Icon */
.floating-ai-search-wrapper {
    position: fixed;
    bottom: 148px;
    right: 25px;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-ai-search-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #a4862b 100%);
    color: #ffffff !important;
    padding: 0;
    box-shadow: 0 8px 25px rgba(164, 134, 43, 0.45);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 2px solid #ffffff;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: floatingPulse 2.5s infinite;
    cursor: pointer;
}

.floating-ai-search-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 12px 30px rgba(164, 134, 43, 0.6);
    color: #ffffff !important;
}

.floating-ai-search-btn .floating-icon {
    font-size: 24px;
    line-height: 1;
}

/* Chat Popup Window Container */
.ai-search-popup-container {
    position: fixed;
    bottom: 90px;
    right: 25px;
    width: 400px;
    max-width: calc(100vw - 30px);
    z-index: 10000;
    animation: aiSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes aiSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-search-popup-card {
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(164, 134, 43, 0.25);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.28), 0 8px 16px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* Header */
.ai-search-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #a4862b 100%);
    color: #ffffff;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-avatar-wrapper {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(212, 175, 55, 0.5);
}

.ai-avatar-icon {
    font-size: 1.2rem;
}

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

.ai-header-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

.ai-header-subtitle {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.75);
}

.btn-icon-only {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    transition: background 0.2s ease;
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Chat Body Thread */
.ai-search-chat-body {
    height: 380px;
    max-height: 55vh;
    overflow-y: auto;
    background: #f8fafc;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Message Rows */
.ai-msg-row {
    display: flex;
    flex-direction: column;
    max-width: 88%;
}

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

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

.ai-msg-bubble {
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 0.82rem;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
}

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

.ai-msg-right .ai-msg-bubble {
    background: linear-gradient(135deg, #a4862b, #8c701f);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 3px 10px rgba(164, 134, 43, 0.3);
}

/* Extracted Filter Badges */
.ai-filter-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    margin-bottom: 8px;
}

.ai-filter-badge {
    background: #f1f5f9;
    color: #8c701f;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

/* Product Recommendation Card Grid inside Chat */
.ai-product-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.ai-product-card-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.ai-product-card-item:hover {
    border-color: #a4862b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.ai-card-img-container {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
}

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

.ai-card-discount-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    background: #10b981;
    color: #ffffff;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
    z-index: 1;
}

.ai-card-info {
    flex-grow: 1;
    min-width: 0;
}

.ai-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-card-price-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
}

.ai-card-price {
    font-weight: 700;
    color: #a4862b;
    white-space: nowrap;
}

.ai-card-mrp {
    text-decoration: line-through;
    color: #94a3b8;
    font-size: 0.7rem;
    white-space: nowrap;
}

.ai-card-discount {
    background: #ecfdf5;
    color: #059669;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
}

.ai-card-rating {
    font-size: 0.68rem;
    color: #f59e0b;
}

.ai-card-btn {
    font-size: 0.7rem;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Typing Indicator Dots */
.ai-typing-indicator-row {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border-top: 1px dashed #e2e8f0;
}

.ai-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ai-typing-dots span {
    width: 6px;
    height: 6px;
    background-color: #a4862b;
    border-radius: 50%;
    animation: aiDotBounce 1.4s infinite ease-in-out both;
}

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

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

/* Footer Input Bar - Clean, Modern & Seamless */
.ai-search-footer {
    background: #ffffff;
    padding: 12px 14px;
    border-top: 1px solid #f1f5f9;
}

.ai-search-form-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.ai-input-field {
    flex-grow: 1;
    height: 40px;
    border-radius: 20px !important;
    font-size: 0.82rem !important;
    padding: 8px 16px !important;
    border: 1px solid #cbd5e1 !important;
    background-color: #f8fafc !important;
    color: #1e293b !important;
    outline: none !important;
    transition: all 0.2s ease !important;
}

.ai-input-field:focus {
    border-color: #a4862b !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(164, 134, 43, 0.15) !important;
}

.ai-send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37 0%, #A4862B 100%);
    color: #ffffff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(164, 134, 43, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-send-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 16px rgba(164, 134, 43, 0.5);
    color: #ffffff;
}

/* Tool Cards Styling for Orders, Coupons, Rewards, and Account */
.ai-tool-card-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-tool-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.ai-tool-card:hover {
    border-color: #a4862b;
    box-shadow: 0 4px 10px rgba(164, 134, 43, 0.12);
}

.ai-order-card {
    padding: 10px 12px;
}

.ai-coupon-card {
    border-left: 3px solid #a4862b;
}

.bg-gold {
    background-color: #a4862b !important;
    color: #ffffff !important;
}

.btn-outline-brand {
    border: 1px solid #a4862b !important;
    color: #a4862b !important;
    background: transparent !important;
    font-size: 0.68rem !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
}

.btn-outline-brand:hover {
    background: #a4862b !important;
    color: #ffffff !important;
}

/* Mobile Responsive */
@media (max-width: 767.98px) {
    .floating-ai-search-wrapper {
        bottom: 135px;
        right: 15px;
    }
    .ai-search-popup-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
    }
    .ai-search-chat-body {
        height: 340px;
    }
}
