/* Tùy chỉnh thanh cuộn */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9; /* secondary-100 or gray-100 */
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: #b42c1c; /* primary-600 */
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #872115; /* primary-700 or darker shade */
}

/* Hiệu ứng ripple */
@keyframes ripple {
    to {
        transform: scale(2.5);
        opacity: 0;
    }
}
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4); /* White with opacity */
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none; /* Prevent ripple from interfering with clicks */
}

/* Hiệu ứng fade-out cho thông báo (nếu còn sử dụng) */
.fade-out {
    animation: fadeOut 0.3s forwards;
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Style cho bubble chat */
#chatMessages > div {
    transition: all 0.3s ease;
    transform-origin: bottom;
}
#chatMessages > div:hover {
    /* subtle lift effect */
    /* transform: translateY(-1px); */ 
}

/* Style cho tin nhắn của bot */
#chatMessages > div:not(.items-end) .message-content {
    position: relative;
}
/* Triangle for bot message - Adjusted for Tailwind rounded classes */
/* This might need fine-tuning depending on exact rounding */
/* #chatMessages > div:not(.items-end) .message-content::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -7px; 
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 10px 10px 0;
    border-color: transparent #f1f5f9 transparent transparent; 
} */

/* Style cho tin nhắn của người dùng */
#chatMessages > div.items-end > div:last-of-type { /* Target the message bubble itself */
    position: relative;
}
/* Triangle for user message */
/* #chatMessages > div.items-end > div:last-of-type::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: -7px; 
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 10px 0 0;
    border-color: #b42c1c transparent transparent transparent;
} */

/* Hiệu ứng loading cho typing indicator (nếu có #typingIndicator) */
/* #typingIndicator .animate-bounce {
    animation: bounce 1.4s infinite ease-in-out both;
} */

/* Hiệu ứng cho tin nhắn mới */
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}
.animate-pop-in {
    animation: popIn 0.3s forwards;
}

/* Style cho khu vực nhắn tin */
#messageInput:focus {
    box-shadow: 0 0 0 2px rgba(180, 44, 28, 0.2); /* primary-600 with opacity */
}

/* Style cho nút gửi tin nhắn */
#sendButton:hover svg {
    /* transform: translateX(2px); */ /* Subtle movement */
    transition: transform 0.2s ease;
}

/* Style cho bubble khi hover */
#chatMessages > div .message-content:hover,
#chatMessages > div > div:last-of-type:hover { /* Target user bubble too */
    /* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08); */ /* Subtle shadow */
}

/* Style cho nút bong bóng lịch sử */
#historyBubbleButton {
    box-shadow: 0 4px 12px rgba(180, 44, 28, 0.3); /* primary-600 shadow */
    transition: all 0.3s ease;
    will-change: transform;
}
#historyBubbleButton:active {
    transform: scale(0.9);
}

/* Animation cho nút bong bóng */
@keyframes float-bubble {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-4px) rotate(3deg); }
}
#historyBubbleButton {
    animation: float-bubble 3s ease-in-out infinite;
}
#historyBubbleButton:hover {
    animation: none; /* Stop floating on hover */
    transform: scale(1.1);
}

/* Badge Counter Animation (Nếu có counter trong bubble) */
/* @keyframes pulse-badge {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
#historyBubbleButton span {
    animation: pulse-badge 2s infinite;
} */

/* Tùy chỉnh cho Chat Area (Media Queries) */
@media (max-width: 767px) {
    /* Ensure chat area takes full width when history is hidden */
    /* .md\:w-2\/3 { 
        width: 100%; 
    } */
    
    #chatContainer {
        padding: 10px; /* Slightly less padding on mobile */
    }
    
    #welcomeMessage {
        padding: 10px;
    }
    
    .break-words {
        word-break: break-word; /* Ensure long words wrap */
    }
    
    /* Hide header toggle button, prefer bubble */
    #toggleHistoryButton {
        display: none;
    }
}

/* Style cho sidebar lịch sử trên mobile */
#chatHistorySidebar {
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    /* Ensure smooth transition */
    transition: transform 0.3s ease-in-out;
}

.history-item {
    border-left: 3px solid transparent;
    transition: background-color 0.2s ease, border-left-color 0.2s ease;
}

.history-item:hover,
.history-item.active {
    background-color: #fef3f2; /* primary-50 */
    border-left-color: #b42c1c; /* primary-600 */
}
/* Style active item specifically */
.history-item.active {
     background-color: #fee2e2; /* primary-100 */
}

/* Safari-specific height fix (Might need adjustment based on actual layout) */
/* @supports (-webkit-touch-callout: none) {
    #chatContainerWrapper {
        height: 100%;
        min-height: 350px;
    }
} */

/* Handle edge cases in different browsers (Might need adjustment) */
/* @supports (not (-webkit-touch-callout: none)) {
    #chatContainerWrapper {
        height: 100%;
        min-height: 400px;
    }
} */

/* Tối ưu cho chế độ tablet (Example) */
/* @media (min-width: 641px) and (max-width: 1023px) {
    #chatContainerWrapper {
        min-height: 450px;
    }
} */

/* Tối ưu cho màn hình portrait (Example) */
/* @media (orientation: portrait) and (max-width: 767px) {
    .container { 
        height: calc(100vh - 16px);
    }
} */

/* Ngăn scrolling background khi mở sidebar */
body.sidebar-open {
    overflow: hidden;
    /* position: fixed; Might cause issues, test carefully */
    /* width: 100%; */
    /* height: 100%; */
} 