/* =========================================================================
   NIVIX AI CHATBOT STYLES
   ========================================================================= */

/* --- Chatbot Widget Container --- */
.nivix-chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 40px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: 'Inter', sans-serif;
    pointer-events: none;
}

.nivix-avatar-wrapper,
.nivix-chat-window {
    pointer-events: auto;
}

/* --- The Avatar Asset --- */
.nivix-avatar-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    cursor: pointer;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 15px rgba(0, 240, 255, 0.4));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nivix-avatar-wrapper:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 25px rgba(0, 240, 255, 0.7));
}

.nivix-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Notification badge */
.nivix-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff003c;
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #000;
    box-shadow: 0 0 10px rgba(255, 0, 60, 0.6);
    animation: pulse 2s infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nivix-badge.active {
    opacity: 1;
}

/* --- Chat Window --- */
.nivix-chat-window {
    width: 350px;
    height: 400px;
    max-height: 55vh;
    background: rgba(10, 15, 30, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 240, 255, 0.1) inset;
    
    /* Reveal Animation starting state */
    transform-origin: bottom right;
    transform: scale(0.5) translateY(50px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nivix-chat-window.active {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* --- Header --- */
.nivix-chat-header {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(112, 0, 255, 0.2));
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nivix-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nivix-header-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    padding: 2px;
    border: 1px solid rgba(0, 240, 255, 0.5);
}

.nivix-header-text h3 {
    color: #fff;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nivix-status-dot {
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    box-shadow: 0 0 8px #00ff88;
}

.nivix-header-text p {
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    font-size: 12px;
}

.nivix-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.nivix-close-btn:hover {
    color: #fff;
}

/* --- Messages Area --- */
.nivix-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    
    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 240, 255, 0.3) transparent;
}

.nivix-chat-body::-webkit-scrollbar {
    width: 6px;
}
.nivix-chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.nivix-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.3);
    border-radius: 10px;
}

/* --- Message Bubbles --- */
.nivix-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    animation: slideUp 0.3s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

.nivix-msg.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 4px;
}

.nivix-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.8), rgba(0, 120, 255, 0.8));
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 240, 255, 0.2);
}

/* --- Typing Indicator --- */
.nivix-typing {
    display: flex;
    gap: 4px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    margin-bottom: 5px;
}

.nivix-typing-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.nivix-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.nivix-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.nivix-typing-dot:nth-child(3) { animation-delay: 0s; }

/* --- Quick Actions --- */
.nivix-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    animation: slideUp 0.3s ease-out 0.2s forwards;
    opacity: 0;
    transform: translateY(10px);
}

.nivix-action-btn {
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: #00f0ff;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.nivix-action-btn:hover {
    background: rgba(0, 240, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 240, 255, 0.2);
}

/* --- Input Area --- */
.nivix-chat-input-area {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 10px;
    position: relative;
}

.nivix-input-field {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 15px;
    border-radius: 20px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.nivix-input-field::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.nivix-input-field:focus {
    border-color: rgba(0, 240, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.nivix-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-1, #00f0ff), var(--accent-2, #7000ff));
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.nivix-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

/* --- Animations --- */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 0, 60, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(255, 0, 60, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 0, 60, 0); }
}

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

@keyframes slideUp {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Mobile Responsiveness - Enhanced */
@media (max-width: 480px) {
    .nivix-chatbot-container {
        bottom: 15px;
        right: 15px;
        z-index: 9998;
    }

    .nivix-avatar-wrapper {
        width: 100px;
        height: 100px;
    }

    .nivix-chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 150px);
        max-height: 70vh;
        border-radius: 15px;
    }

    .nivix-chat-header {
        padding: 12px 15px;
    }

    .nivix-header-text h3 {
        font-size: 14px;
    }

    .nivix-header-avatar {
        width: 35px;
        height: 35px;
    }

    .nivix-messages {
        padding: 12px;
    }

    .nivix-message {
        padding: 8px 12px;
        border-radius: 10px;
    }

    .nivix-message.user {
        margin-left: 10px;
    }

    .nivix-message.bot {
        margin-right: 10px;
    }

    .nivix-input-wrapper {
        padding: 10px;
        gap: 8px;
    }

    .nivix-input-field {
        font-size: 13px;
        padding: 10px 12px;
    }

    .nivix-send-btn {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 576px) {
    .nivix-avatar-wrapper {
        width: 110px;
        height: 110px;
    }

    .nivix-chat-window {
        width: calc(100vw - 35px);
        max-height: 65vh;
    }
}

@media (max-width: 992px) {
    .nivix-chatbot-container {
        bottom: 25px;
        right: 25px;
    }

    .nivix-avatar-wrapper {
        width: 120px;
        height: 120px;
    }

    .nivix-chat-window {
        width: 320px;
        height: 450px;
        max-height: 60vh;
    }
}

/* Keep phone overrides last so they are not overridden by max-width:992 rules */
@media (max-width: 576px) {
    .nivix-chatbot-container {
        bottom: 15px;
        right: 12px;
    }

    .nivix-avatar-wrapper {
        width: 100px;
        height: 100px;
    }

    .nivix-chat-window {
        width: calc(100vw - 24px);
        height: calc(100vh - 150px);
        max-height: 68vh;
    }
}

@media (max-width: 480px) {
    .nivix-chatbot-container {
        bottom: 12px;
        right: 10px;
    }

    .nivix-avatar-wrapper {
        width: 92px;
        height: 92px;
    }
}
