/* =================== CHAT WIDGET =================== */

/* Container chính - định vị ở góc dưới bên phải */
.chat-bubble-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Biểu tượng hỗ trợ (bubble) */
.chat-bubble {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 1;
    transform: scale(1);
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0);
}

/* Khung chat (widget) - Định vị và trạng thái ẩn ban đầu */
.chat-widget {
    position: absolute;
    bottom: 5px;
    right: 0;
    width: 600px;
    height: 450px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15) !important;
    font-family: Arial, sans-serif;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease-in-out;
    transform-origin: bottom right;
    border: 1px solid #e0e0e0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.chat-bubble-container.active .chat-bubble {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

.chat-bubble-container.active .chat-widget {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat container và sidebar */
.chat-container {
    display: flex;
    height: 100%;
}

.chat-sidebar {
    width: 150px;
    background-color: #2c5e6b;
    padding-top: 20px;
    flex-shrink: 0;
}

.chat-sidebar nav {
    display: flex;
    flex-direction: column;
}

.sidebar-item {
    color: #fff;
    text-decoration: none;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    position: relative;
    border-left: 4px solid transparent;
    transition: background-color 0.2s;
}

.sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: orange;
}

.sidebar-item.active {
    background-color: #fff;
    color: #333;
    border-left-color: #2c5e6b;
    font-weight: bold;
}

.sidebar-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.notification-badge {
    background-color: #f36e21;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.chat-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: #fff;
}

.chat-content {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 20px;
}

.chat-content.active {
    display: flex;
}

.chat-close-btn {
    position: absolute;
    top: 2px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
    z-index: 10;
}

/* Pre-chat screen */
#pre-chat-screen, #guest-info-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.avatar {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
}

#pre-chat-screen h2 {
    font-size: 22px;
    color: #333;
    margin-bottom: 25px;
}

#pre-chat-screen .form-group,
.guest-form .form-group {
    width: 100%;
    max-width: 300px;
    margin-bottom: 15px;
}

#pre-chat-screen .form-control,
.guest-form .form-control {
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    width: 100%;
}

.btn-start-chat {
    background-color: #fdb913;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    max-width: 300px;
    transition: background-color 0.2s;
}

.suggestion-links {
    margin-top: 20px;
    font-size: 14px;
}

.suggestion-links a {
    color: #555;
    text-decoration: none;
    margin: 0 5px;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.message {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
}

.message.bot {
    align-self: flex-start;
}

.message.bot .message-text {
    background-color: #f1f0f0;
    color: #333;
    border-bottom-left-radius: 5px;
}

.message.user {
    align-self: flex-end;
}

.message.user .message-text {
    background-color: #2c5e6b;
    color: white;
    border-bottom-right-radius: 5px;
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
}

.message-text {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
}

/* Chat input form */
.chat-input-form {
    display: flex;
    border-top: 1px solid #e0e0e0;
    padding: 15px 10px 10px 10px;
}

.chat-input-form input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 16px;
    margin-right: 10px;
}

.send-btn {
    background-color: #2c5e6b;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
}

/* =================== MEDIA QUERIES =================== */
@media (max-width: 1024px) {
    .chat-widget {
        width: 500px;
        height: 400px;
    }
}

@media (max-width: 768px) {
    .chat-widget {
        width: 90vw;
        height: 60vh;
        right: 5%;
        bottom: 10px;
    }
    .chat-bubble {
        width: 70px;
        height: 70px;
        font-size: 20px;
    }
    .chat-sidebar {
        width: 100px;
    }
}

@media (max-width: 480px) {
    .chat-widget {
        width: 95vw;
        height: 65vh;
        right: 2.5%;
        bottom: 10px;
    }
    .chat-bubble {
        width: 60px;
        height: 60px;
        font-size: 18px;
    }
    .chat-sidebar {
        width: 80px;
    }
}
