/* ==========================================================================
   DIVA Chatbot CSS - Speedonet Broadband Support Assistant
   Namespaced under .diva-chatbot to prevent style leaks or conflicts.
   ========================================================================== */

/* Floating Launcher Button Integration */
.floating-buttons-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: flex-end;
}

.floating-btn.btn-floating-diva {
    background: linear-gradient(135deg, #0b2a6f 0%, #1649b8 100%);
    box-shadow: 0 4px 18px rgba(11, 42, 111, 0.45);
    position: relative;
    border: 2px solid #ffffff;
    cursor: pointer;
    overflow: visible;
}

.floating-btn.btn-floating-diva:hover {
    box-shadow: 0 6px 24px rgba(11, 42, 111, 0.65);
    transform: scale(1.12) translateY(-2px);
}

.floating-btn.btn-floating-diva .diva-launcher-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Subtle Pulse Ring Animation for Launcher */
.floating-btn.btn-floating-diva::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    border: 2px solid rgba(11, 42, 111, 0.6);
    animation: divaPulse 2.4s infinite ease-out;
    pointer-events: none;
}

@keyframes divaPulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.18); opacity: 0; }
    100% { transform: scale(0.95); opacity: 0; }
}

/* Chat Window Container */
.diva-chat-window {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 390px;
    height: 620px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(226, 232, 240, 0.9);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                visibility 0.3s ease;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.diva-chat-window.diva-active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    display: flex !important;
    z-index: 999999 !important;
}

/* Header */
.diva-chat-header {
    background: linear-gradient(135deg, #0b2a6f 0%, #1649b8 100%);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
}

.diva-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.diva-header-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.diva-header-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #ffffff;
    object-fit: cover;
    background: #ffffff;
}

.diva-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #0db531;
    border: 2px solid #ffffff;
    border-radius: 50%;
}

.diva-header-info {
    display: flex;
    flex-direction: column;
}

.diva-header-title {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
    color: #ffffff;
    letter-spacing: 0.3px;
}

.diva-header-subtitle {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 2px;
}

.diva-header-online-text {
    font-size: 10.5px;
    color: #4ade80;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.diva-header-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.diva-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Header Dropdown Menu */
.diva-header-menu {
    position: absolute;
    top: 55px;
    right: 18px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    border: 1px solid #e2e8f0;
    padding: 6px 0;
    display: none;
    z-index: 10;
    min-width: 150px;
}

.diva-header-menu.show {
    display: block;
    animation: divaFadeIn 0.2s ease;
}

.diva-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #334155;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.diva-menu-item:hover {
    background: #f1f5f9;
    color: #0b2a6f;
}

/* Chat Body */
.diva-chat-body {
    flex: 1;
    background: #f8fafc;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.diva-chat-body::-webkit-scrollbar {
    width: 5px;
}

.diva-chat-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Date Pill */
.diva-date-pill {
    align-self: center;
    background: #e2e8f0;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    margin: 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Messages Base */
.diva-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 88%;
    animation: divaMsgSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Bot Message */
.diva-msg-row.diva-bot-row {
    align-self: flex-start;
}

.diva-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #cbd5e1;
}

.diva-bot-bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 15px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    word-break: break-word;
}

.diva-bot-bubble p {
    margin: 0 0 8px 0;
}

.diva-bot-bubble p:last-child {
    margin-bottom: 0;
}

.diva-bot-bubble ul {
    margin: 6px 0;
    padding-left: 18px;
}

.diva-bot-bubble li {
    margin-bottom: 4px;
}

/* User Message */
.diva-msg-row.diva-user-row {
    align-self: flex-end;
    justify-content: flex-end;
}

.diva-user-bubble {
    background: #0b2a6f;
    color: #ffffff;
    border-radius: 18px 18px 4px 18px;
    padding: 11px 15px;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 3px 10px rgba(11, 42, 111, 0.22);
    word-break: break-word;
}

/* Timestamps */
.diva-timestamp {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    display: block;
}

.diva-bot-row .diva-timestamp {
    text-align: left;
    margin-left: 36px;
}

.diva-user-row .diva-timestamp {
    text-align: right;
    margin-right: 4px;
}

/* Typing Indicator */
.diva-typing-bubble {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 18px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.diva-typing-dot {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: divaTyping 1.4s infinite ease-in-out both;
}

.diva-typing-dot:nth-child(1) { animation-delay: 0s; }
.diva-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.diva-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes divaTyping {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.1); opacity: 1; background: #0b2a6f; }
}

/* Quick Replies Container */
.diva-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    align-self: flex-start;
    animation: divaMsgSlide 0.3s ease forwards;
}

.diva-quick-btn {
    background: #eef2ff;
    color: #0b2a6f;
    border: 1.5px solid #c7d2fe;
    padding: 8px 15px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    text-align: left;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.diva-quick-btn:hover {
    background: #0b2a6f;
    color: #ffffff;
    border-color: #0b2a6f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(11, 42, 111, 0.25);
}

.diva-quick-btn:active {
    transform: translateY(0);
}

/* Action Buttons inside Bot Message (e.g. WhatsApp, Call, Plan Link) */
.diva-action-btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.diva-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none !important;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.diva-action-btn.btn-wa {
    background: #0db531;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(13, 181, 49, 0.3);
}

.diva-action-btn.btn-wa:hover {
    background: #0ba02b;
    transform: translateY(-1px);
}

.diva-action-btn.btn-call {
    background: #e21a22;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(226, 26, 34, 0.3);
}

.diva-action-btn.btn-call:hover {
    background: #c7131a;
    transform: translateY(-1px);
}

.diva-action-btn.btn-plan {
    background: #0b2a6f;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(11, 42, 111, 0.3);
}

.diva-action-btn.btn-plan:hover {
    background: #101828;
    transform: translateY(-1px);
}

/* Chat Footer & Input */
.diva-chat-footer {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.diva-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.diva-chat-input {
    width: 100%;
    border: 1.5px solid #cbd5e1;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8fafc;
}

.diva-chat-input:focus {
    border-color: #0b2a6f;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(11, 42, 111, 0.12);
}

.diva-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0b2a6f;
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.diva-send-btn:hover {
    background: #1649b8;
    transform: scale(1.05);
}

.diva-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* Mobile Responsiveness */
@media (max-width: 575px) {
    .diva-chat-window {
        width: calc(100vw - 20px) !important;
        max-width: 420px !important;
        height: calc(100vh - 85px) !important;
        max-height: 620px !important;
        bottom: 10px !important;
        right: 10px !important;
        border-radius: 16px !important;
        z-index: 9999999 !important;
    }

    .floating-buttons-container {
        bottom: 14px !important;
        right: 12px !important;
        gap: 8px !important;
        z-index: 999999 !important;
    }

    .floating-btn {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
    }

    .floating-btn.btn-floating-diva .diva-launcher-img {
        width: 26px !important;
        height: 26px !important;
    }
}
