/* ============================================
   CHAT WIDGET STYLES - CareTechMobile Bot
   ============================================ */

/* Widget Container */
.ctm-chat-widget {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, sans-serif;
}

/* Toggle Button */
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chat-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(37, 99, 235, 0.5);
}

.chat-toggle-btn .chat-icon,
.chat-toggle-btn .close-icon {
    font-size: 24px;
    color: white;
    transition: all 0.3s ease;
}

.chat-toggle-btn .close-icon {
    display: none;
}

.ctm-chat-widget.open .chat-toggle-btn .chat-icon {
    display: none;
}

.ctm-chat-widget.open .chat-toggle-btn .close-icon {
    display: block;
}

/* Notification Badge */
.chat-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: 70vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ctm-chat-widget.open .chat-window {
    display: flex;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.chat-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-info p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.85;
}

.chat-header-status {
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    margin-left: auto;
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-msg.bot {
    background: white;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chat-msg.user {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.bot-label {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.bot-label i {
    color: #2563eb;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-6px);
    }
}

/* Chat Options */
.chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.chat-option-btn {
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.chat-option-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
    transform: translateY(-1px);
}

/* Chat Input Area */
.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.chat-input:focus {
    border-color: #2563eb;
}

.chat-input::placeholder {
    color: #94a3b8;
}

.chat-send-btn {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.chat-send-btn i {
    font-size: 16px;
}

/* WhatsApp Connect Button */
.whatsapp-connect-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #25D366;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    margin-top: 12px;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease;
}

.whatsapp-connect-btn:hover {
    background: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
}

.whatsapp-connect-btn i {
    font-size: 18px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .ctm-chat-widget {
        bottom: 15px;
        right: 15px;
    }

    .chat-toggle-btn {
        width: 55px;
        height: 55px;
    }

    .chat-window {
        width: calc(100vw - 30px);
        height: 65vh;
        bottom: 70px;
        right: 0;
    }

    .chat-options {
        flex-direction: column;
    }

    .chat-option-btn {
        width: 100%;
        text-align: center;
    }
}

/* Hide default WhatsApp float when chat is open */
.ctm-chat-widget.open~.whatsapp-float {
    opacity: 0;
    pointer-events: none;
}