/* === CHATBOT & HERO CHARACTER VER. SCRIPT === */

/* --- 1. HERO CARD (Characters) --- */
.ai-chatbot-hero.version-char {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #ffffff 30%, #f0f7ff 100%);
    border-radius: 20px;
    padding: 30px 40px;
    margin: 30px 0 40px 0;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 10px 30px rgba(0, 48, 91, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.ai-chatbot-hero.version-char:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 48, 91, 0.12);
}

/* Decorative Background Element */
.ai-chatbot-hero.version-char::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(33, 150, 243, 0.1) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.chatbot-hero-text {
    flex: 1;
    z-index: 1;
    padding-right: 20px;
    text-align: left;
}

.hero-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(33, 150, 243, 0.1);
    color: #2196f3;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #2196f3;
    border-radius: 50%;
    animation: pulse-light 1.5s infinite;
}

@keyframes pulse-light {
    0% {
        box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(33, 150, 243, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(33, 150, 243, 0);
    }
}

.chatbot-hero-text h3 {
    font-size: 1.5rem;
    color: #00305b;
    margin-bottom: 10px;
    line-height: 1.35;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.chatbot-hero-text p {
    color: #555;
    font-size: 1rem;
    margin-bottom: 25px;
    line-height: 1.6;
}

.ai-chatbot-btn {
    background: #00305b;
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 48, 91, 0.2);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.ai-chatbot-btn:hover {
    background: #2196f3;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(33, 150, 243, 0.3);
}

.ai-chatbot-btn::after {
    content: '\f178';
    /* FontAwesome arrow-right */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.9em;
    transition: transform 0.2s;
}

.ai-chatbot-btn:hover::after {
    transform: translateX(4px);
}

.chatbot-hero-img {
    flex-shrink: 0;
    width: 140px;
    height: 140px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.img-circle-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 50%;
    z-index: -1;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.chatbot-hero-img img {
    height: 110%;
    object-fit: contain;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.1));
}


/* --- 2. CHAT MODAL IMPROVEMENTS --- */

/* Modal Specific Styles */
#consultModal {
    z-index: 10001;
}

.chat-modal-content {
    width: 760px;
    max-width: 96%;
    height: 82vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    border-radius: 20px;
    overflow: hidden;
    background: #f8f9fa;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

/* Chat Header */
.chat-header {
    background: #00305b;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    z-index: 10;
    position: relative;
}

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

.consultant-avatar {
    width: 48px;
    height: 48px;
    background: aliceblue;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.consultant-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

/* Image Avatar Wrapper used in HTML */
.image-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.header-info h4 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.online-status {
    font-size: 0.8rem;
    color: #69f0ae;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    font-weight: 500;
}

.close-chat-modal {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    padding: 0;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;
}

.close-chat-modal:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background-color: #f4f7fa;
    background-image: radial-gradient(#e1e7f0 1px, transparent 1px);
    background-size: 20px 20px;
    scroll-behavior: smooth;
}

.message-date {
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 10px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-date::before,
.message-date::after {
    content: '';
    display: block;
    width: 20%;
    height: 1px;
    background: #ddd;
    margin: 0 10px;
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 12px;
    max-width: 100%;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.message.received {
    align-self: flex-start;
}

.message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* Avatar inside Message */
.msg-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    margin-top: 4px;
}

.message-bubble {
    padding: 15px 19px;
    border-radius: 18px;
    font-size: 1.02rem;
    line-height: 1.72;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    position: relative;
    max-width: 82%;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.message.message-rich {
    width: 100%;
}

.message.message-rich .message-bubble {
    flex: 1;
    max-width: none;
    min-width: 0;
    padding: 18px 22px;
    line-height: 1.78;
}

.message.message-rich .message-bubble hr {
    margin: 14px 0;
    border: 0;
    border-top: 1px solid #dde5ee;
}

.message.message-rich .message-bubble a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.message.message-rich .message-bubble .doc-checklist {
    margin-top: 10px;
}

.message.message-rich .message-bubble .doc-checklist ol {
    margin: 0 0 0 1.25rem;
    padding: 0;
}

.message.message-rich .message-bubble .doc-checklist li {
    margin-bottom: 8px;
}

.message.message-rich .message-bubble .doc-checklist li:last-child {
    margin-bottom: 0;
}

.message.message-rich .message-bubble .doc-note {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d8e7f8;
    background: #eef6ff;
    color: #31557a;
    font-size: 0.94rem;
}

.message.received .message-bubble {
    background: white;
    color: #333;
    border-top-left-radius: 4px;
}

.message.sent .message-bubble {
    background: #00305b;
    color: white;
    border-top-right-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: #999;
    margin-top: auto;
    margin-bottom: 2px;
    white-space: nowrap;
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
    animation: slideUp 0.3s ease;
}

.quick-reply-btn {
    background: white;
    border: 1px solid #dce3eb;
    color: #444;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-align: left;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: auto;
    min-width: 200px;
    max-width: 100%;
    line-height: 1.45;
    align-self: flex-end;
}

.quick-reply-btn:hover {
    background: #fff;
    border-color: #2196f3;
    color: #2196f3;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(33, 150, 243, 0.15);
}

.quick-reply-btn i {
    color: #2196f3;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Progress Bars */
.progress-bar-container {
    background-color: #e5e7eb;
    height: 8px;
    border-radius: 4px;
    margin: 10px 0;
    overflow: hidden;
    width: 100%;
}

.progress-bar-fill {
    background-color: #00305b;
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Typing Indicator */
.typing-msg .message-bubble.typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.typing span {
    width: 6px;
    height: 6px;
    background: #aaa;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) {
    animation-delay: 0s;
}

.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input (Visual Only) */
.chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input-area input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    background: #f9f9f9;
    font-size: 0.95rem;
}

.chat-input-area button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #00305b;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    opacity: 0.5;
    cursor: default;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {

    /* Hero Section Mobile */
    .ai-chatbot-hero.version-char {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 25px 20px;
        gap: 20px;
    }

    .chatbot-hero-text {
        padding-right: 0;
        text-align: center;
        width: 100%;
    }

    .chatbot-hero-img {
        margin-bottom: 10px;
        transform: scale(1.1);
    }

    .ai-chatbot-btn {
        width: 100%;
        justify-content: center;
    }

    /* Modal Mobile (Bottom Sheet) */
    .chat-modal-content {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 85vh;
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        margin: 0;
        animation: slideUpModal 0.3s ease-out;
        border: none;
    }

    @keyframes slideUpModal {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .chat-messages {
        padding: 15px;
    }

    .message {
        gap: 8px;
    }

    .message-bubble {
        font-size: 0.96rem;
        padding: 12px 16px;
        line-height: 1.68;
    }

    .message.message-rich .message-bubble {
        padding: 14px 16px;
        line-height: 1.7;
    }

    .quick-reply-btn {
        width: 100%;
        padding: 14px;
    }
}

/* Chat Input Area - Disabled Mode (Guide Text) */
.chat-input-area.disabled-mode {
    display: flex;
    justify-content: center;
    background-color: #ffffff;
    padding: 15px;
    border-top: 1px solid #eee;
}

.input-guide {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f1f3f5;
    padding: 10px 20px;
    border-radius: 30px;
    color: #495057;
    font-size: 0.9rem;
    font-weight: 500;
}

.input-guide i {
    color: #00305b;
}
