/* ===========================
   NIVS Conference Chatbot UI
   Responsive • Clean • Bilingual
=========================== */

/* Chat Button */
#nivs-chat-button {
    width: 52px;
    height: 52px;
    background: #8b0000;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 9999;
}

.nivs-chat-info-box {
    margin: 20px 0;
    padding: 10px 14px;
    border-left: 4px solid #8b0000;
    background: #fdf5f5;
    font-size: 14px;
    color: #4a1c1c;
    border-radius: 6px;
}


/* Wrapper for button + label */
#nivs-chat-button-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9999;
}

/* Move original button to be relative to wrapper */
#nivs-chat-button {
    position: relative;
    bottom: 0;
    right: 0;
}

/* Label bubble */
#nivs-chat-label {
    background: #ffffff;
    color: #5a2222;
    border-radius: 20px;
    padding: 6px 10px;
    font-size: 11px;
    line-height: 1.3;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
    border: 1px solid #e0caca;
    white-space: nowrap;
    cursor: pointer;
}

#nivs-chat-label span {
    font-size: 10px;
    color: #8b0000;
    font-weight: 600;
}

/* Clicking label also opens chat */
#nivs-chat-label:hover {
    background: #fdf5f5;
}

/* On small screens, hide label and just show button */
@media (max-width: 480px) {
    #nivs-chat-label {
        display: none;
    }
}


/* Chat Window */
#nivs-chat-window {
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: 350px;
    max-height: 520px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: "Segoe UI", system-ui, sans-serif;
}

/* Header */
.nivs-chat-header {
    background: #8b0000;
    color: #fff;
    padding: 10px 12px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

/* Close Button */
#nivs-chat-close {
    cursor: pointer;
    font-size: 20px;
    margin-left: 5px;
}

/* Language Switch Buttons */
.nivs-lang-switch {
    display: flex;
    gap: 4px;
}

.nivs-lang-switch button {
    background: #ffffff22;
    border: 1px solid #ffffff55;
    color: #fff;
    padding: 3px 6px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
}

.nivs-lang-switch button.active {
    background: #fff;
    color: #8b0000;
    border-color: #fff;
    font-weight: 600;
}

/* Chat Messages Area */
#nivs-chat-messages {
    padding: 12px;
    height: 320px;
    overflow-y: auto;
    background: #faf5f5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Fade-in animation */
@keyframes nivsFadeInUp {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bot & User Messages */
.bot-message {
    background: #f1e0e0;
    color: #3a1a1a;
    padding: 10px 12px;
    border-radius: 10px;
    border-left: 4px solid #8b0000;
    max-width: 85%;
    align-self: flex-start;
    font-size: 14px;
    line-height: 1.4;
    animation: nivsFadeInUp 0.18s ease-out;
}

.user-message {
    background: #e3f2fd;
    color: #0d47a1;
    padding: 10px 12px;
    border-radius: 10px;
    border-right: 4px solid #0d47a1;
    max-width: 85%;
    align-self: flex-end;
    font-size: 14px;
    line-height: 1.4;
    text-align: right;
    animation: nivsFadeInUp 0.18s ease-out;
}

/* Typing state */
.bot-message.typing {
    opacity: 0.7;
    font-style: italic;
}

/* Quick Replies */
#nivs-quick-replies {
    padding: 8px 10px;
    background: #f7eded;
    border-top: 1px solid #e0caca;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.nivs-quick-btn {
    border: 1px solid #c09a9a;
    background: #ffffff;
    color: #5a2222;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
}

.nivs-quick-btn:hover {
    background: #f1e0e0;
}

/* Input Area */
.nivs-chat-input-area {
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
}

#nivs-chat-input {
    flex: 1;
    border: none;
    padding: 12px;
    font-size: 14px;
    outline: none;
    background: #fff;
}

/* Mic button */
#nivs-chat-mic {
    border: none;
    background: #f3e3e3;
    padding: 0 10px;
    font-size: 16px;
    cursor: pointer;
    height: 100%;
}

/* Send button */
#nivs-chat-send {
    border: none;
    background: #8b0000;
    color: #fff;
    padding: 0 14px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    height: 100%;
}

#nivs-chat-send:hover {
    background: #a00000;
}

/* Scrollbar Style */
#nivs-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#nivs-chat-messages::-webkit-scrollbar-thumb {
    background: #c9b1b1;
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 480px) {
    #nivs-chat-window {
        width: calc(100% - 40px);
        right: 20px;
        bottom: 80px;
    }
}

/* ---------------------------
   Dark mode (prefers-color-scheme)
--------------------------- */
@media (prefers-color-scheme: dark) {
    #nivs-chat-window {
        background: #181818;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
    }

    .nivs-chat-header {
        background: #5c0000;
    }

    #nivs-chat-messages {
        background: #101010;
    }

    .bot-message {
        background: #2b1a1a;
        color: #f5eaea;
        border-left-color: #d46b6b;
    }

    .user-message {
        background: #1b2836;
        color: #e3f2fd;
        border-right-color: #64b5f6;
    }

    #nivs-quick-replies {
        background: #1c1111;
        border-top-color: #342020;
    }

    .nivs-quick-btn {
        background: #181818;
        color: #f5eaea;
        border-color: #5c3b3b;
    }

    .nivs-quick-btn:hover {
        background: #2b1a1a;
    }

    .nivs-chat-input-area {
        border-top-color: #333;
    }

    #nivs-chat-input {
        background: #181818;
        color: #f5f5f5;
    }

    #nivs-chat-mic {
        background: #2b1a1a;
        color: #f5eaea;
    }

    #nivs-chat-send {
        background: #b71c1c;
    }

    #nivs-chat-send:hover {
        background: #d32f2f;
    }

    #nivs-chat-messages::-webkit-scrollbar-thumb {
        background: #555;
    }
}

/* Video toggle button in header */
#nivs-toggle-video {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
}

/* Video container inside chat window */
.nivs-video-container {
    width: 100%;
    height: 240px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nivs-video-inner {
    width: 100%;
    height: 100%;
}

.nivs-video-inner iframe {
    width: 100%;
    height: 100%;
    border: none;
}