/* ==================================
   HUNONIC CHAT BOT - CUSTOM CSS (NO TAILWIND)
   ================================== */

/* Reset & Base Styles */
#chat-box,
#chat-box *,
#chat-messages,
#chat-messages * {
    box-sizing: border-box;
}
#chat-box button, .chat-input-container #button{
    margin: 0!important;
}
#chat-bot *, #chat-messages *, #hunonic-chat-bot-textarea, .message-text{
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

#hunonic-chat-bot-textarea{
    font-size: 16px;
}
#hunonic-chat-bot-textarea:placeholder-shown {
    font-size: 16px;
}
#chat-box textarea {
    margin-bottom: 0 !important;
}
.message-body{
    font-size: 14px !important;
}
/* ==================================
   CHAT TOGGLE BUTTON
   ================================== */
#chat-toggle-wrapper {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 9999;
}

.chat-toggle-btn {
    position: relative;
    cursor: pointer;
}

.pulse-ring-bg {
    position: absolute;
    inset: 0;
    background-color: #10b981;
    border-radius: 50%;
    animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.chat-toggle-icon {
    position: relative;
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, #00b33d 0%, #00a037 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    transform: scale(1);
    transition: all 0.3s ease;
}

.chat-toggle-btn:hover .chat-toggle-icon {
    transform: scale(1.1);
}

#chat-icon {
    font-size: 26px;
    padding: 10px;
    transition: transform 0.3s ease;
}

.chat-icon-rotate {
    transform: rotate(180deg);
}

/* ==================================
   CHAT BOX
   ================================== */
.chat-box {
    position: fixed;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 15px 20px -5px rgba(0, 0, 0, 0.1), 0 8px 8px -5px rgba(0, 0, 0, 0.04);
    z-index: 999998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: solid 1px #f1f1f1;
    transform: scale(0);
    transform-origin: bottom right;
    transition: all 0.3s ease;
}

.chat-box-closed {
    transform: scale(0);
    opacity: 0;
}

.chat-box-open {
    transform: scale(1);
    opacity: 1;
    animation: slideUp 0.3s ease-out;
}

/* Responsive Chat Box */
@media (max-width: 600px) {
    .chat-box {
        width: 100vw !important;
        height: 100% !important;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}

@media (min-width: 600px) {
    .chat-box {
        height: 700px;
        width: 580px !important;
        max-height: 100vw !important;
        max-width: 90vw !important;
        bottom: 14px;
        right: 14px;
    }
}

/* ==================================
   CHAT HEADER
   ================================== */
#chat-header {
    background: linear-gradient(135deg, #00b33d 0%, #00a037 100%);
    color: white;
    padding: 5px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.chat-avatar {
    width: 24px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.chat-bot-name {
    font-weight: 500;
    font-size: 14px;
    line-height: 16px !important;
    margin: 0;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 14px !important;
}

.status-indicator {
    width: 6px;
    height: 6px;
    background-color: #86efac;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.status-text {
    opacity: 0.9;
    font-size: 13px;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.chat-close-btn:hover {
    color: white;
}

/* ==================================
   CHAT MESSAGES
   ================================== */
.chat-messages {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    background-color: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #e5e7eb;
    border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: #d1d5db;
}

/* Message Wrapper */
.message-wrapper {
    display: flex;
    width: 100%;
}

.message-left {
    justify-content: flex-start;
}

.message-right {
    justify-content: flex-end;
}

/* Message Bubble */
.message-bubble {
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1.3;
    border-radius: 12px;
    max-width: 85%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message-bot {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #374151;
    border-bottom-left-radius: 4px;
}

.message-user {
    background: linear-gradient(135deg, #00b33d 0%, #00a037 100%);
    color: #f8f8f8 !important;
    border-bottom-right-radius: 4px;
}

/* Message Header */
.message-header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.message-sender {
    font-size: 14px;
    color: #273141;
}

.message-time-right {
    font-size: 12px;
    color: #eff8ff;
}
.message-time-left{
    font-size: 12px;
    color: #677181;
}

.message-time-right {
    text-align: right;
    margin-bottom: 4px;
}

.message-time-right span {
    opacity: 0.8;
}

/* Message Content */
.message-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.message-text {
    order: 2;
    white-space: pre-wrap;
    -webkit-font-smoothing: subpixel-antialiased !important;
    -moz-osx-font-smoothing: auto !important;
}

/* Message Links */
.message-bot a {
    color: #1e90ff;
    text-decoration: none;
}

.message-bot a:hover {
    color: #d0814b;
    text-decoration: underline;
}

/* Icons */
.img-icon-hunonic-ai {
    width: 18px;
    height: auto;
}

.img-icon-hunonic-ai-botname {
    border: solid 1px #e7e7e7;
    border-radius: 3px;
    width: 24px;
    height: auto;
}

/* Message Typography */
#chat-messages h1 {
    font-size: 18px;
    margin: 8px 0;
}

#chat-messages h2 {
    font-size: 17px;
    margin: 8px 0;
}

#chat-messages h3 {
    font-size: 16px;
    padding: 0;
    margin: 8px 0;
}

#chat-messages h4 {
    font-size: 15px;
    margin: 6px 0;
}

#chat-messages h5,
#chat-messages h6 {
    font-size: 14px;
    margin: 6px 0;
}

.message-bot > .prose > ul > li > p:first-child {
    margin-top: 10px !important;
}

.message-bot .message-text> ul {
    padding: 0!important;
}

.message-bot .message-text> ul>li {
    list-style-type: none;
}

.message-bot ul li > ul li::before {
    content: "- " !important;
}

.message-content .message-text p {
    font-size: 14px !important;
    margin: 5px 0 !important;
}

/* ==================================
   SUGGESTED QUESTIONS
   ================================== */
.suggested-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid #f1f1f1;
    background-color: #ffffff;
    transition: all 0.3s ease;
}

.suggested-question {
    font-size: 13px;
    padding: 6px 12px;
    background-color: #f6f6f6;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.suggested-question:hover {
    background-color: #e6f7ff;
    border-color: #00a037;
    color: #00a037;
}

.fade-out {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

/* ==================================
   CHAT INPUT
   ================================== */
.chat-input-wrapper {
    padding: 8px 12px;
    border-top: 1px solid #e5e7eb;
    background-color: white;
    /*height: 66px !important;*/
    /*max-height: 66px !important;*/
}

.chat-input-container {
    padding: 0 !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.input-btn:hover {
    color: #374151;
    background-color: #f3f4f6;
}

.input-btn i {
    font-size: 14px;
}

.textarea-wrapper {
    flex: 1;
    position: relative;
}

#hunonic-chat-bot-textarea {
    width: 100%;
    padding: 6px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    font-size: 16px;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    overflow-y: auto;
}

#hunonic-chat-bot-textarea:focus {
    border-color: #00a037;
    box-shadow: 0 0 0 2px rgba(0, 160, 55, 0.2);
}

.send-btn {
    background: linear-gradient(135deg, #00b33d 0%, #00a037 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn i {
    font-size: 12px;
}

.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================================
   IMAGE UPLOAD AREA
   ================================== */
.image-upload-area {
    display: none;
    padding: 10px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.image-upload-area.show {
    display: block;
}

.image-preview {
    position: relative;
    display: inline-block;
    margin: 5px;
}

.image-preview img {
    max-width: 80px;
    max-height: 80px;
    border-radius: 4px;
    border: 2px solid #e5e7eb;
}

.image-preview .remove-image {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-progress {
    background: rgba(0, 179, 61, 0.1);
    border: 1px dashed #00a037;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    font-size: 12px;
    color: #00a037;
    margin: 5px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-progress .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #00a037;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* ==================================
   MESSAGE IMAGES - MESSENGER STYLE
   ================================== */
.message-images {
    margin: 8px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 100%;
    order: 1;
}

.message-image {
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.message-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Single image */
.message-images.single-image .message-image {
    max-width: 280px;
    max-height: 200px;
    width: auto;
    height: auto;
}

/* Two images */
.message-images.two-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    max-width: 280px;
}

.message-images.two-images .message-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

/* Three images */
.message-images.three-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
    max-width: 280px;
    height: 200px;
}

.message-images.three-images .message-image:first-child {
    grid-row: 1 / 3;
    height: 100%;
}

.message-images.three-images .message-image:not(:first-child) {
    height: 96px;
}

/* Four images */
.message-images.four-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
    max-width: 280px;
    height: 200px;
}

.message-images.four-images .message-image {
    width: 100%;
    height: 96px;
    object-fit: cover;
}

/* More than 4 images */
.message-images.multiple-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
    max-width: 280px;
    height: 200px;
    position: relative;
}

.message-images.multiple-images .message-image {
    width: 100%;
    height: 96px;
    object-fit: cover;
}

.message-images.multiple-images .image-overlay {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: #f8f8f8 !important;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.message-images.multiple-images .image-overlay:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* User message images on right */
.message-user .message-images {
    align-self: flex-end;
}

/* Bot message images on left */
.message-bot .message-images {
    align-self: flex-start;
}

/* ==================================
   IMAGE MODAL
   ================================== */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    backdrop-filter: blur(4px);
}

.image-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-modal img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    object-fit: contain;
}

.image-modal .close-modal {
    position: absolute !important;;
    top: -40px !important;
    right: 0  !important;;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px !important;
    height: 40px !important;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    color: #333;
    margin: 0 !important;
}

.image-modal .close-modal:hover {
    background: white;
    transform: scale(1.1);
}

.image-modal .image-counter {
    margin-top: 15px;
    color: #f8f8f8 !important;
    font-size: 14px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
}

.image-modal .nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    color: #333;
}

.image-modal .nav-button:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.image-modal .nav-button.prev {
    left: 20px;
}

.image-modal .nav-button.next {
    right: 20px;
}

/* ==================================
   TYPING INDICATOR
   ================================== */
.typing-dots {
    display: inline-flex;
    align-items: center;
    padding: 4px 0;
}

.typing-dots span {
    height: 4px;
    width: 4px;
    margin: 0 1px;
    background-color: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

/* ==================================
   UTILITY CLASSES
   ================================== */
.hidden {
    display: none !important;
}

.text-wrap-break {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    overflow: hidden !important;
}

.text-xs {
    white-space: pre-wrap;
    font-size: 14px;
}

.message-recalled {
    color: #a2a2a2 !important;
}

.chat-bubble-user {
    /* User-specific bubble styles if needed */
}

/* ==================================
   ANIMATIONS
   ================================== */
@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    80%, 100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.chat-bubble-enter {
    animation: bubbleEnter 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

/* ==================================
   RESPONSIVE ADJUSTMENTS
   ================================== */
@media (max-width: 480px) {
    .message-bubble {
        max-width: 90%;
    }

    .message-images.single-image .message-image,
    .message-images.two-images,
    .message-images.three-images,
    .message-images.four-images,
    .message-images.multiple-images {
        max-width: 240px;
    }
}
.suggested-question, .message-bot, #hunonic-chat-bot-textarea{
    color: #374151;
}
#image-btn{
    padding: 0 5px !important;
    line-height: 1 !important;
}
#image-btn .fa-image{
    font-size: 24px !important;
    margin-bottom: 5px;
    /*color: #374151;*/
}
#image-btn .fa-image:hover{
    /*color: #536583;*/
}
#image-btn:hover{
    background: none;
}
.message-send-failed{
    color: #dadada;
    font-size: 14px !important;
}