/* helperai.css */

/* Floating Button (Instagram Ring Style dengan Tone Elegan Majlis) */
.ai-chat-trigger {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37, #aa771c, #5c4033);
    padding: 3px;
    box-shadow: 0 8px 24px rgba(92, 64, 51, 0.25);
    cursor: pointer;
    z-index: 9998;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.ai-chat-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 28px rgba(92, 64, 51, 0.35);
}

.ai-trigger-inner {
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #5c4033;
}

/* Fullscreen Overlay + Blur Effect */
.ai-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(43, 30, 24, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Card Zoom/Expand Animation */
.ai-modal-card {
    width: 90%;
    max-width: 420px;
    height: 80vh;
    max-height: 620px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.6);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ai-modal-overlay.active .ai-modal-card {
    transform: scale(1);
}

/* Header */
.ai-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f2ede9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
}

.ai-header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37, #aa771c);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.3);
}

.ai-header-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #2b1e18;
}

.ai-header-info span {
    font-size: 12px;
    color: #8c7a70;
}

.ai-close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #5c4033;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-close-btn:hover {
    background: #f7f4f2;
}

/* Chat Body */
.ai-card-body {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #faf8f5;
    justify-content: flex-start;
}

.ai-bubble {
    padding: 12px 16px;
    border-radius: 20px;
    max-width: 82%;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.ai-user-bubble {
    background: #5c4033;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    text-align: right !important;
    box-shadow: 0 4px 12px rgba(92, 64, 51, 0.15);
}

.ai-assistant-bubble {
    background: #f0ebe6;
    color: #2b1e18;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    text-align: left !important;
    direction: ltr !important;
}

/* Kecilkan saiz gelembung khas untuk loading */
.ai-bubble.ai-typing-bubble {
    padding: 8px 14px;
    min-width: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Animasi Titik Loading di Tengah */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 16px;
}

.ai-typing-indicator span {
    width: 5px;
    height: 5px;
    background-color: #aa771c;
    border-radius: 50%;
    display: inline-block;
    animation: aiDotBounce 1.4s infinite ease-in-out both;
}

.ai-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes aiDotBounce {
    0%, 80%, 100% { 
        transform: scale(0);
    } 
    40% { 
        transform: scale(1.0);
    }
}

/* Gaya Butang Action (Pill-shaped, Eksklusif) */
.ai-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    background: #5c4033;
    color: #ffffff;
    padding: 9px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(92, 64, 51, 0.2);
    transition: all 0.2s ease;
}

.ai-action-btn:hover {
    background: #432e24;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(92, 64, 51, 0.3);
}

/* Warna khas butang WhatsApp */
.ai-whatsapp-btn {
    background: linear-gradient(135deg, #25d366, #128c7e);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
}

.ai-whatsapp-btn:hover {
    background: linear-gradient(135deg, #1ebe5d, #0f756a);
    box-shadow: 0 6px 15px rgba(37, 211, 102, 0.35);
}

/* Footer Input */
.ai-card-footer {
    padding: 12px 16px;
    border-top: 1px solid #f2ede9;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
}

.ai-card-footer input {
    flex: 1;
    border: 1px solid #e3dbd5;
    border-radius: 22px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    background: #faf8f5;
    color: #2b1e18;
    transition: border-color 0.2s, background 0.2s;
}

.ai-card-footer input:focus {
    border-color: #d4af37;
    background: #ffffff;
}

.ai-send-btn {
    background: none;
    border: none;
    color: #aa771c;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 10px;
    transition: color 0.2s;
}

.ai-send-btn:hover {
    color: #5c4033;
}