/*
 * iZakat Chatbot - STEP 3
 * Floating chatbot UI
 *
 * Tukar warna utama di sini jika portal iZakat ada warna rasmi lain.
 */

#izakat-chatbot {
    position: fixed;
    right: 25px;
    bottom: 25px;
    z-index: 99999;
    font-family: Arial, Helvetica, sans-serif;
}

/* Floating button */
#izakat-chatbot-toggle {
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 50%;
    background: #283891;
    color: #fff;
    box-shadow: 0 5px 18px rgba(0,0,0,.25);
    cursor: pointer;
    transition: all .2s ease;
    padding: 0;
}

#izakat-chatbot-toggle:hover {
    transform: scale(1.06);
    box-shadow: 0 7px 22px rgba(0,0,0,.30);
}

.izakat-bot-icon {
    font-size: 30px;
    line-height: 62px;
}

#izakat-chatbot-toggle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Chat window */
#izakat-chat-window {
    display: none;
    position: absolute;
    right: 0;
    bottom: 78px;
    width: 380px;
    height: 590px;
    max-width: calc(100vw - 30px);
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 12px 45px rgba(0,0,0,.25);
    border: 1px solid rgba(0,0,0,.08);
}

/* Header */
.izakat-chat-header {
    height: 74px;
    background: #283891;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.izakat-chat-brand {
    display: flex;
    align-items: center;
    min-width: 0;
}

/* Avatar Ustaz Zakat - Header */
.izakat-chat-brand .ustaz-avatar {
    width: 43px;
    height: 43px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    flex: 0 0 43px;
    margin-right: 10px;
}

/* Avatar Ustaz Zakat - Mesej */
.izakat-message-bot .ustaz-avatar {
    width: 31px;
    height: 31px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    flex: 0 0 31px;
    margin-right: 8px;
}

.izakat-chat-avatar {
    width: 43px;
    height: 43px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 23px;
}

.izakat-chat-title {
    font-size: 16px;
    font-weight: 700;
}

.izakat-chat-status {
    margin-top: 3px;
    font-size: 11px;
    opacity: .9;
}

.izakat-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #35d07f;
    margin-right: 4px;
}

.izakat-chat-actions {
    display: flex;
    gap: 4px;
}

.izakat-chat-actions button {
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 23px;
    line-height: 25px;
    cursor: pointer;
    border-radius: 50%;
}

.izakat-chat-actions button:hover {
    background: rgba(255,255,255,.14);
}

/* Messages */
#izakat-chat-messages {
    height: 390px;
    overflow-y: auto;
    padding: 18px 15px;
    background: #f5f7fb;
    scroll-behavior: smooth;
}

.izakat-message {
    display: flex;
    margin-bottom: 15px;
}

.izakat-message-user {
    justify-content: flex-end;
}

.izakat-message-avatar {
    flex: 0 0 31px;
    width: 31px;
    height: 31px;
    border-radius: 50%;
    background: #283891;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-right: 8px;
}

.izakat-message-user .izakat-message-avatar {
    display: none;
}

.izakat-message-content {
    max-width: 84%;
}

.izakat-message-user .izakat-message-content {
    max-width: 82%;
}

.izakat-bubble {
    padding: 11px 13px;
    border-radius: 14px;
    background: #fff;
    color: #222;
    font-size: 13px;
    line-height: 1.55;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    word-wrap: break-word;
}

.izakat-message-user .izakat-bubble {
    background: #283891;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.izakat-message-bot .izakat-bubble {
    border-bottom-left-radius: 4px;
}

.izakat-message-time {
    font-size: 9px;
    color: #8b8f99;
    margin-top: 4px;
}

.izakat-message-user .izakat-message-time {
    text-align: right;
}

.izakat-source {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid #eee;
    font-size: 10px;
    color: #777;
}

.izakat-category {
    display: inline-block;
    margin-top: 7px;
    padding: 3px 7px;
    border-radius: 20px;
    background: #eef1ff;
    color: #283891;
    font-size: 9px;
    font-weight: 700;
}

/* Quick questions */
.izakat-quick-title {
    color: #666;
    font-size: 11px;
    margin: 4px 0 8px 39px;
}

.izakat-quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: 39px;
    margin-bottom: 15px;
}

.izakat-quick-btn {
    background: #fff;
    color: #283891;
    border: 1px solid #d8ddf3;
    border-radius: 18px;
    padding: 7px 10px;
    font-size: 10px;
    cursor: pointer;
}

.izakat-quick-btn:hover {
    background: #eef1ff;
}

/* Typing */
.izakat-typing {
    display: none;
    height: 28px;
    align-items: center;
    padding: 0 16px;
    color: #888;
    font-size: 9px;
    background: #f5f7fb;
}

.izakat-typing span {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 3px;
    border-radius: 50%;
    background: #283891;
    animation: izakatTyping 1s infinite;
}

.izakat-typing span:nth-child(2) {
    animation-delay: .15s;
}

.izakat-typing span:nth-child(3) {
    animation-delay: .30s;
}

.izakat-typing em {
    margin-left: 6px;
    font-style: normal;
}

@keyframes izakatTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: .5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Footer */
.izakat-chat-footer {
    background: #fff;
    border-top: 1px solid #e5e5e5;
    padding: 10px 12px 9px;
}

.izakat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 7px;
}

#izakat-chat-input {
    flex: 1;
    resize: none;
    min-height: 38px;
    max-height: 85px;
    border: 1px solid #d8dce6;
    border-radius: 19px;
    outline: none;
    padding: 10px 13px;
    font-size: 12px;
    line-height: 1.35;
    font-family: Arial, Helvetica, sans-serif;
    box-sizing: border-box;
}

#izakat-chat-input:focus {
    border-color: #283891;
    box-shadow: 0 0 0 2px rgba(40,56,145,.08);
}

#izakat-chat-send {
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    border: 0;
    border-radius: 50%;
    background: #283891;
    color: #fff;
    cursor: pointer;
    font-size: 17px;
}

#izakat-chat-send:hover {
    background: #1e2d78;
}

#izakat-chat-send:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.izakat-disclaimer {
    text-align: center;
    margin-top: 5px;
    color: #999;
    font-size: 8px;
}

/* Mobile */
@media (max-width: 480px) {

    #izakat-chatbot {
        right: 14px;
        bottom: 14px;
    }

    #izakat-chatbot-toggle {
        width: 56px;
        height: 56px;
    }

    .izakat-bot-icon {
        font-size: 27px;
        line-height: 56px;
    }
	
	#izakat-chatbot-toggle img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		display: block;
	}	

    #izakat-chat-window {
        right: -2px;
        bottom: 68px;
        width: calc(100vw - 28px);
        height: calc(100vh - 90px);
        max-height: none;
        border-radius: 16px;
    }

    #izakat-chat-messages {
        height: calc(100% - 155px);
    }
}

.izakat-related-title {
    font-size: 12px;
    font-weight: 600;
    color: #283891;
    margin-top: 12px;
    margin-bottom: 7px;
}

.izakat-related-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.izakat-related-btn {
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid #d9def2;
    color: #283891;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.izakat-related-btn:hover {
    background: #f3f5ff;
    border-color: #283891;
}

/* ===============================
   PILIH TOPIK
   =============================== */

.izakat-topic-title {
    font-size: 12px;
    font-weight: 600;
    color: #283891;
    margin-top: 12px;
    margin-bottom: 8px;
}

.izakat-topic-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 4px;
}

.izakat-topic-btn {
    width: 100%;
    min-height: 38px;
    padding: 7px 9px;

    background: #fff;
    border: 1px solid #d9def2;
    border-radius: 9px;

    color: #283891;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;

    text-align: center;
    cursor: pointer;

    transition: all 0.2s ease;
    box-sizing: border-box;
}

.izakat-topic-btn:hover {
    background: #283891;
    border-color: #283891;
    color: #fff;
}

.izakat-topic-btn:active {
    transform: scale(0.97);
}

.izakat-topic-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.izakat-topic-btn i {
    font-size: 12px;
    width: 14px;
    text-align: center;
}

.izakat-topic-btn span {
    display: inline-block;
}