/* ============================================================
   MII Chatbot Widget Styles
   Themed to match Made In Ipoh site (#553705 brown, gold)
   ============================================================ */

/* Floating toggle button */
#mii-chat-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    background-color: #553705;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.25s, transform 0.2s;
}
#mii-chat-toggle:hover {
    background-color: #7a5210;
    transform: scale(1.08);
}
#mii-chat-toggle svg {
    width: 28px;
    height: 28px;
    fill: #ffc107;
}
#mii-chat-toggle .chat-close-icon {
    display: none;
}

/* Unread badge */
#mii-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
}

/* Chat window */
#mii-chat-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 360px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    transform: scale(0.85) translateY(30px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    font-family: 'Poppins', sans-serif;
}
#mii-chat-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Chat header */
#mii-chat-header {
    background: linear-gradient(135deg, #553705 0%, #7a5210 100%);
    color: #fff;
    padding: 14px 16px 10px;
    flex-shrink: 0;
}
#mii-chat-header .chat-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffc107;
    margin: 0 0 2px 0;
    letter-spacing: 0.3px;
}
#mii-chat-header .chat-subtitle {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    margin: 0 0 10px 0;
}

/* Language tabs */
#mii-lang-tabs {
    display: flex;
    gap: 6px;
}
.mii-lang-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    color: rgba(255,255,255,0.85);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: background 0.2s, color 0.2s;
}
.mii-lang-btn.active {
    background: #ffc107;
    border-color: #ffc107;
    color: #553705;
}
.mii-lang-btn:hover:not(.active) {
    background: rgba(255,255,255,0.25);
}

/* Messages area */
#mii-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9f6f1;
}
#mii-chat-messages::-webkit-scrollbar {
    width: 5px;
}
#mii-chat-messages::-webkit-scrollbar-thumb {
    background: #d0b080;
    border-radius: 4px;
}

/* Message bubbles */
.mii-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 88%;
    animation: msgSlideIn 0.2s ease;
}
@keyframes msgSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.mii-msg.bot {
    align-self: flex-start;
}
.mii-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.mii-msg .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #553705;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}
.mii-msg .bubble {
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}
.mii-msg.bot .bubble {
    background: #fff;
    color: #2d2d2d;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.09);
}
.mii-msg.user .bubble {
    background: #553705;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.mii-msg .bubble strong {
    color: #553705;
}
.mii-msg.user .bubble strong {
    color: #ffc107;
}
.mii-msg .bubble table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    font-size: 12px;
}
.mii-msg .bubble table th {
    background: #f0e8d8;
    color: #553705;
    padding: 4px 6px;
    text-align: left;
}
.mii-msg .bubble table td {
    padding: 4px 6px;
    border-bottom: 1px solid #eee;
}
.mii-msg .bubble table tr:last-child td {
    border-bottom: none;
}

/* Typing indicator */
.mii-typing .bubble {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 10px 14px;
}
.mii-typing .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #b09060;
    animation: typingBounce 1.2s infinite;
}
.mii-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.mii-typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Quick reply buttons */
#mii-quick-replies {
    padding: 8px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #f9f6f1;
    border-top: 1px solid #ede8e0;
    flex-shrink: 0;
}
.mii-qr-btn {
    background: #fff;
    border: 1.5px solid #c49a40;
    border-radius: 20px;
    color: #553705;
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 12px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: background 0.18s, color 0.18s;
    white-space: nowrap;
}
.mii-qr-btn:hover {
    background: #553705;
    color: #ffc107;
    border-color: #553705;
}

/* Input row */
#mii-chat-input-row {
    display: flex;
    padding: 10px 12px;
    gap: 8px;
    background: #fff;
    border-top: 1px solid #ede8e0;
    flex-shrink: 0;
    align-items: center;
}
#mii-chat-input {
    flex: 1;
    border: 1.5px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    color: #333;
}
#mii-chat-input:focus {
    border-color: #553705;
}
#mii-chat-send {
    background: #553705;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}
#mii-chat-send:hover {
    background: #7a5210;
}
#mii-chat-send svg {
    width: 18px;
    height: 18px;
    fill: #ffc107;
}

/* Mobile responsive */
@media (max-width: 480px) {
    #mii-chat-window {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 90px;
        max-height: 70vh;
    }
    #mii-chat-toggle {
        bottom: 18px;
        right: 18px;
    }
}
