/* ===== Sino Chatbot Floating Button ===== */
.sino-chat-trigger {
    position: fixed;
    bottom: 25px;
    right: 25px;
    left: auto;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #142c54 0%, #1e4080 100%);
    box-shadow: 0 8px 24px rgba(20, 44, 84, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    border: 2px solid rgba(255, 255, 255, 0.25);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    transform: scale(0.5) translateY(50px);
    animation: sinoChatTriggerEntrance 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: 1.5s;
}

.sino-chat-trigger:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 28px rgba(20, 44, 84, 0.45);
}

.sino-chat-trigger .chat-icon-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.sino-chat-trigger i {
    color: white;
    font-size: 26px;
    transition: transform 0.3s;
}

.sino-chat-trigger .trigger-label {
    position: absolute;
    bottom: -18px;
    background: #ab2424;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(171, 36, 36, 0.3);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Notification dot */
.sino-chat-trigger .notification-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #ff4b2b;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 0 rgba(255, 75, 43, 0.7);
    animation: sinoChatPulse 2s infinite;
}

/* ===== Chat Window Widget ===== */
.sino-chat-widget {
    position: fixed;
    bottom: 95px;
    right: 25px;
    left: auto;
    width: 380px;
    height: 600px;
    max-height: calc(90vh - 120px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(20, 44, 84, 0.1);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(20, 44, 84, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sino-chat-widget.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.sino-chat-header {
    background: linear-gradient(135deg, #142c54 0%, #1e4080 100%);
    padding: 16px 20px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sino-chat-header .header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sino-chat-header .bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sino-chat-header .bot-avatar img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.sino-chat-header .status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #25d366;
    border-radius: 50%;
    border: 2px solid #142c54;
}

.sino-chat-header .bot-title {
    font-weight: 700;
    font-size: 16px;
    margin: 0;
    line-height: 1.2;
}

.sino-chat-header .bot-status {
    font-size: 12px;
    opacity: 0.85;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sino-chat-header .close-chat-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.sino-chat-header .close-chat-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

/* Chat Body / Messages Area */
.sino-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8fafc;
}

/* Scrollbar styling */
.sino-chat-messages::-webkit-scrollbar {
    width: 5px;
}
.sino-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.sino-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Message Bubble structure */
.chat-msg {
    display: flex;
    max-width: 85%;
    flex-direction: column;
    animation: sinoChatBubbleEntrance 0.3s ease-out forwards;
}

.chat-msg.bot {
    align-self: flex-start;
}

.chat-msg.user {
    align-self: flex-end;
}

.chat-msg-bubble {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.chat-msg.bot .chat-msg-bubble {
    background: white;
    color: #1e293b;
    border: 1px solid rgba(20, 44, 84, 0.06);
    border-top-left-radius: 2px;
}

.chat-msg.user .chat-msg-bubble {
    background: linear-gradient(135deg, #1e4080 0%, #142c54 100%);
    color: white;
    border-top-right-radius: 2px;
}

.chat-msg-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    margin-left: 4px;
    margin-right: 4px;
}

.chat-msg.user .chat-msg-time {
    align-self: flex-end;
}

/* Quick Suggestion Chips Container */
.sino-chat-suggestions {
    display: none !important;
}

.suggestion-chip {
    background: white;
    border: 1px solid rgba(20, 44, 84, 0.15);
    color: #142c54;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.suggestion-chip:hover {
    background: #e8f0fe;
    border-color: #1e4080;
    color: #1e4080;
    transform: translateY(-1px);
}

/* Footer Input Area */
.sino-chat-footer {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid rgba(20, 44, 84, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sino-chat-footer input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.sino-chat-footer input:focus {
    border-color: #1e4080;
    box-shadow: 0 0 0 3px rgba(30, 64, 128, 0.1);
}

.sino-chat-footer button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #142c54;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sino-chat-footer button:hover {
    background: #ab2424;
    transform: scale(1.05);
}

.sino-chat-footer button i {
    font-size: 16px;
}

/* Typing / Loading indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    align-items: center;
    justify-content: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: sinoChatBlink 1.4s infinite both;
}

.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }

/* ===== Animations ===== */
@keyframes sinoChatTriggerEntrance {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(50px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes sinoChatPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 75, 43, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 75, 43, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 75, 43, 0);
    }
}

@keyframes sinoChatBubbleEntrance {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes sinoChatBlink {
    0% { opacity: .2; }
    20% { opacity: 1; }
    100% { opacity: .2; }
}

/* ===== Direction Adjustments (RTL) ===== */
html[dir="rtl"] .sino-chat-trigger {
    right: auto;
    left: 25px;
}

html[dir="rtl"] .sino-chat-widget {
    right: auto;
    left: 25px;
}

html[dir="rtl"] .chat-msg.bot {
    align-self: flex-start;
}

html[dir="rtl"] .chat-msg.user {
    align-self: flex-end;
}

html[dir="rtl"] .chat-msg.bot .chat-msg-bubble {
    border-top-left-radius: 14px;
    border-top-right-radius: 2px;
}

html[dir="rtl"] .chat-msg.user .chat-msg-bubble {
    border-top-right-radius: 14px;
    border-top-left-radius: 2px;
}

/* ===== Responsive Behavior (Mobile) ===== */
@media (max-width: 576px) {
    .sino-chat-trigger {
        bottom: 20px;
        right: 20px;
        left: auto;
        width: 54px;
        height: 54px;
    }
    
    html[dir="rtl"] .sino-chat-trigger {
        left: 20px;
        right: auto;
    }

    .sino-chat-widget {
        bottom: 0;
        right: 0;
        left: auto;
        width: 100vw;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }
    
    html[dir="rtl"] .sino-chat-widget {
        left: 0;
        right: auto;
    }
}
