


.chat-fab-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(30, 136, 229, 0.4);
    animation: chatPulse 2.2s infinite;
    z-index: -1;
    pointer-events: none;
    /* Prevent overflow */
    overflow: hidden;
    transform-origin: center center;
}


/* ============================================================
   CODMEDIX — AI CHAT WIDGET STYLES
   WhatsApp-style floating chat
   ============================================================ */

/* ============================================================
   FLOATING ACTION BUTTON (FAB)
   ============================================================ */
.chat-fab {
    position: fixed;
    bottom: 26px;
    right: 26px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0D47A1, #1E88E5);
    color: #fff;
    font-size: 1.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1050;
    box-shadow: 0 12px 30px rgba(13, 71, 161, 0.40);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    padding: 0;
    isolation: isolate;
}
.chat-fab:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 16px 38px rgba(13, 71, 161, 0.50);
}
.chat-fab:active {
    transform: scale(0.98);
}
.chat-fab:focus {
    outline: none;
}

.chat-fab-icon,
.chat-fab-icon-open {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    transition: all 0.3s ease;
}
.chat-fab-icon-open {
    opacity: 0;
    transform: rotate(-90deg);
}

.chat-fab.active .chat-fab-icon {
    opacity: 0;
    transform: rotate(90deg);
}
.chat-fab.active .chat-fab-icon-open {
    opacity: 1;
    transform: rotate(0);
}

.chat-fab-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(30, 136, 229, 0.4);
    animation: chatPulse 2.2s infinite;
    z-index: -1;
    pointer-events: none;
}
@keyframes chatPulse {
    0%   { transform: scale(1);   opacity: 0.8; }
    70%  { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}

.chat-fab-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #EF4444;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2.5px solid #fff;
    padding: 0 5px;
    z-index: 2;
    animation: badgePop 0.4s ease;
}
@keyframes badgePop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}
.chat-fab.active .chat-fab-badge {
    display: none;
}

/* ============================================================
   CHAT PANEL
   ============================================================ */
.chat-panel {
    position: fixed;
    bottom: 100px;
    right: 26px;
    width: 380px;
    max-width: calc(100vw - 30px);
    height: 560px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 30px 70px rgba(10, 30, 92, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1049;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.96);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.chat-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ============================================================
   HEADER
   ============================================================ */
.chat-header {
    background: linear-gradient(135deg, #0A1E5C 0%, #0D47A1 55%, #1E88E5 100%);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    flex-shrink: 0;
}

.chat-header-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.chat-header-online {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    background: #10B981;
    border: 2px solid #0A1E5C;
    border-radius: 50%;
}

.chat-header-info {
    flex: 1;
    min-width: 0;
}
.chat-header-info h5 {
    font-family: 'Poppins', sans-serif;
    font-size: 0.98rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-header-info p {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #10B981;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
    animation: statusPulse 1.8s infinite;
}
@keyframes statusPulse {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    100% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.chat-header-actions {
    display: flex;
    gap: 6px;
}
.chat-header-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}
.chat-header-btn:focus {
    outline: none;
}

/* ============================================================
   MESSAGES AREA
   ============================================================ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    background: #F0F7FF;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(30, 136, 229, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(13, 71, 161, 0.04) 0%, transparent 50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(13, 71, 161, 0.2);
    border-radius: 3px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 71, 161, 0.35);
}

/* ============================================================
   MESSAGE BUBBLES
   ============================================================ */
.chat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    animation: msgIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0D47A1, #1E88E5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.chat-msg-bubble {
    max-width: 78%;
    padding: 11px 15px;
    border-radius: 16px 16px 16px 4px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(10, 30, 92, 0.06);
    position: relative;
}
.chat-msg-bubble p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: #1A1A2E;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.chat-msg-time {
    display: block;
    font-size: 0.66rem;
    color: #9CA3AF;
    margin-top: 4px;
    text-align: right;
}

/* User message (right-aligned) */
.chat-msg-user {
    flex-direction: row-reverse;
}
.chat-msg-user .chat-msg-avatar {
    background: linear-gradient(135deg, #64748B, #94A3B8);
}
.chat-msg-user .chat-msg-bubble {
    background: linear-gradient(135deg, #0D47A1, #1E88E5);
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 3px 12px rgba(13, 71, 161, 0.22);
}
.chat-msg-user .chat-msg-bubble p {
    color: #fff;
}
.chat-msg-user .chat-msg-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Error message */
.chat-msg-error .chat-msg-bubble {
    background: #FEF2F2;
    border: 1px solid #FECACA;
}
.chat-msg-error .chat-msg-bubble p {
    color: #991B1B;
}
.chat-msg-error .chat-msg-avatar {
    background: linear-gradient(135deg, #DC2626, #EF4444);
}

/* ============================================================
   TYPING INDICATOR
   ============================================================ */
.chat-typing {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 0 16px 12px;
    background: #F0F7FF;
    flex-shrink: 0;
}
.chat-typing-bubble {
    background: #fff;
    padding: 12px 16px;
    border-radius: 16px 16px 16px 4px;
    display: flex;
    gap: 5px;
    box-shadow: 0 2px 8px rgba(10, 30, 92, 0.06);
    align-items: center;
}
.chat-typing-bubble span {
    width: 7px;
    height: 7px;
    background: #1E88E5;
    border-radius: 50%;
    animation: typingBounce 1.3s infinite;
}
.chat-typing-bubble span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-bubble span:nth-child(3) { animation-delay: 0.30s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0);    opacity: 0.5; }
    30%           { transform: translateY(-6px); opacity: 1;   }
}

/* ============================================================
   QUICK SUGGESTIONS
   ============================================================ */
.chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}
.chat-suggestion {
    background: #fff;
    border: 1px solid rgba(30, 136, 229, 0.25);
    color: #0D47A1;
    padding: 9px 14px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.25s;
    font-family: 'Inter', sans-serif;
}
.chat-suggestion:hover {
    background: #0D47A1;
    color: #fff;
    border-color: #0D47A1;
    transform: translateX(4px);
}
.chat-suggestion:focus {
    outline: none;
}

/* ============================================================
   INPUT AREA
   ============================================================ */
.chat-input-wrap {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    background: #fff;
    border-top: 1px solid #E5E7EB;
    flex-shrink: 0;
}
.chat-input {
    flex: 1;
    padding: 12px 18px;
    border: 1.5px solid #E5E7EB;
    border-radius: 50px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.25s;
    background: #F8FAFC;
    color: #1A1A2E;
    min-width: 0;
}
.chat-input::placeholder {
    color: #9CA3AF;
}
.chat-input:focus {
    border-color: #1E88E5;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.10);
}
.chat-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0D47A1, #1E88E5);
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    flex-shrink: 0;
    padding: 0;
}
.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 8px 20px rgba(13, 71, 161, 0.35);
}
.chat-send-btn:focus {
    outline: none;
}
.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 767.98px) {
    .chat-panel {
        bottom: 92px;
        right: 16px;
        width: 360px;
    }
}

@media (max-width: 575.98px) {
    .chat-fab {
        width: 56px;
        height: 56px;
        font-size: 1.35rem;
        bottom: 18px;
        right: 18px;
    }
    .chat-panel {
        bottom: 86px;
        right: 12px;
        left: 12px;
        width: auto;
        height: auto;
        max-height: calc(100vh - 120px);
        border-radius: 18px;
    }
    .chat-messages {
        max-height: calc(100vh - 300px);
    }
    .chat-header {
        padding: 14px 16px;
    }
    .chat-header-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    .chat-header-info h5 {
        font-size: 0.92rem;
    }
    .chat-header-info p {
        font-size: 0.68rem;
    }
    .chat-msg-bubble {
        max-width: 82%;
    }
    .chat-msg-bubble p {
        font-size: 0.86rem;
    }
    .chat-input-wrap {
        padding: 12px 14px;
    }
    .chat-input {
        padding: 11px 16px;
        font-size: 0.88rem;
    }
    .chat-send-btn {
        width: 42px;
        height: 42px;
    }
}

/* ============================================================
   DARK MODE SUPPORT (Optional, agar aage chahiye)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .chat-fab-pulse,
    .chat-status-dot,
    .chat-typing-bubble span {
        animation: none;
    }
    .chat-msg,
    .chat-panel {
        animation: none;
        transition: none;
    }
}
