/* =========================================
   Sericsoft Chatbot Styles
   Colors: Cyan #00A8CE, Magenta #7A2048, Orange #FFA629
   ========================================= */

/* 1. Toggle Button */
.chatbot-toggle-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: #00A8CE;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 168, 206, 0.4);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle-btn:hover {
    transform: scale(1.1);
    background: #008fb0;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #FFA629;
    color: white;
    font-size: 12px;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.notification-badge.hidden {
    display: none;
}

/* 2. Main Container */
#sericsoft-chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 360px;
    max-width: 90vw; /* Responsive fix */
    height: 600px;
    max-height: 70vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: 'Segoe UI', sans-serif;
    transition: all 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

/* Hide state */
#sericsoft-chatbot-container.chatbot-hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    visibility: hidden;
}

/* 3. Header */
.chatbot-header {
    background: linear-gradient(135deg, #00A8CE, #008fb0);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.chatbot-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-info {
    display: flex;
    flex-direction: column;
}

.chatbot-name {
    font-weight: 700;
    font-size: 16px;
}

.chatbot-status {
    font-size: 11px;
    opacity: 0.9;
}

#chatbot-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
}

#chatbot-close-btn:hover {
    opacity: 1;
}

/* 4. Messages Area */
.chatbot-messages {
    flex: 1;
    background: #f8f9fa;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* MESSAGE ROWS */
.message-row {
    display: flex;
    width: 100%; /* Ensures flex container spans width */
}

.message-row.bot {
    justify-content: flex-start;
}

.message-row.user {
    justify-content: flex-end;
}

/* BUBBLES - THE OVERFLOW FIX */
.message-bubble {
    max-width: 80%; /* Limits width */
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    
    /* CRITICAL WRAPPING PROPERTIES */
    word-wrap: break-word;      /* IE/Legacy */
    word-break: break-word;     /* Non-standard but helpful */
    overflow-wrap: anywhere;    /* The modern fix for unbreakable strings */
    white-space: pre-wrap;      /* Preserves paragraphs but allows wrapping */
}

.message-row.bot .message-bubble {
    background: #ffffff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-top-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.message-row.user .message-bubble {
    background: #7A2048; /* Sericsoft Maroon */
    color: white;
    border-top-right-radius: 2px;
    box-shadow: 0 2px 5px rgba(122, 32, 72, 0.2);
}

/* 5. Quick Replies (Chips) */
.chatbot-quick-actions {
    padding: 0 16px 8px 16px;
    background: #f8f9fa;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-chip {
    background: white;
    border: 1px solid #00A8CE;
    color: #00A8CE;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-chip:hover {
    background: #00A8CE;
    color: white;
}

/* 6. Input Area */
.chatbot-input-area {
    padding: 12px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
}

#chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#chatbot-input:focus {
    border-color: #00A8CE;
}

#chatbot-send-btn {
    background: #00A8CE;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#chatbot-send-btn:hover {
    background: #7A2048; /* Change to secondary brand color on hover */
}

.chatbot-footer {
    text-align: center;
    font-size: 10px;
    color: #999;
    padding: 4px 0;
    background: white;
}

/* Typing Indicator Animation */
.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #bbb;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
    margin: 0 2px;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}