/* ==========================================================================
   1. WIDGET LAYOUT (Cố định vị trí)
   ========================================================================== */
#n8n-chat-widget { 
    position: fixed !important; bottom: 20px !important; right: 20px !important; 
    z-index: 999999 !important; font-family: sans-serif !important; 
}
@media only screen and (max-width: 768px) {
    #n8n-chat-widget { bottom: 80px !important; right: 10px !important; }
}

/* Nút toggle (Mất nền) */
#chat-toggle { 
    width: 55px; 
    height: 55px; 
    background: #0084ff !important; /* Đặt lại nền xanh */
    border-radius: 50%; 
    cursor: pointer; 
    color: #ffffff; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 26px; 
    box-shadow: 0 4px 15px rgba(0,132,255,0.4); 
    transition: 0.3s;
    position: fixed;
    bottom: 90px; /* Đẩy lên cao hơn (vị trí cũ là 20px) */
    right: 20px;
    z-index: 99999;
}
#chat-toggle:hover { transform: scale(1.05); }
/* Điều chỉnh lại vị trí widget cho mobile để không bị đè */
@media only screen and (max-width: 768px) {
    #chat-toggle { bottom: 120px !important; right: 10px !important; }
}

/* ==========================================================================
   2. CHAT WINDOW (Khung chat chính)
   ========================================================================== */
.ttc-window { 
    display: flex; width: 320px; height: 450px; background: #fff; 
    border-radius: 15px; flex-direction: column; margin-bottom: 15px; 
    box-shadow: 0 5px 25px rgba(0,0,0,0.2); overflow: hidden; border: 1px solid #ddd; 
}
.ttc-header { padding: 12px 15px; background: #0084ff; color: #fff; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.ttc-close { cursor: pointer; font-size: 20px; }

/* ==========================================================================
   3. CHAT CONTENT (Lịch sử hội thoại)
   ========================================================================== */
.ttc-content { flex: 1; overflow-y: auto; padding: 12px; font-size: 14px; background: #fafafa; }
.ttc-msg-box { margin: 6px 0; padding: 8px 12px; border-radius: 12px; max-width: 80%; line-height: 1.4; word-wrap: break-word; }
.ttc-msg-user { background: #0084ff; color: #fff; margin-left: auto; }
.ttc-msg-bot { background: #e0e0e0; color: #333; }

/* ==========================================================================
   4. TOOLBAR (Thanh công cụ - Ép sát 1 hàng)
   ========================================================================== */
.ttc-toolbar { 
    display: flex; align-items: center; justify-content: space-between; 
    padding: 2px 5px !important; background: #f8f9fa; border-bottom: 1px solid #eee; height: 30px; 
}
.ttc-group { display: flex; align-items: center; gap: 0px !important; }

/* Nút bấm (Tối ưu click area) */
.ttc-btn, .format-btn { 
    border: none; background: transparent; cursor: pointer; 
    padding: 2px 3px !important; border-radius: 3px; font-size: 14px !important; color: #444; 
    margin: 1px;
}
.ttc-btn:hover, .format-btn:hover { background: #dcdcdc; }

/* Kho icon (Ẩn hiện) */
.ttc-icon-list { display: none; flex-wrap: wrap; gap: 4px; padding: 6px; background: #fff; border-bottom: 1px solid #eee; font-size: 18px; }
.ttc-emoji { cursor: pointer; padding: 1px 2px !important; border-radius: 3px; font-size: 16px !important; }
.ttc-emoji:hover { background: #dcdcdc; }
#ttc-more-emoji { margin-left: 2px !important; font-size: 10px !important; cursor: pointer; border:none; background:transparent; }
/* Thêm vào phần 4. TOOLBAR trong style.css */
.ttc-size-btn { 
    font-weight: bold; cursor: pointer; border: none; background: transparent; 
    padding: 2px 4px !important; font-size: 14px !important; color: #333; 
}
.ttc-size-btn:hover { background: #dcdcdc; }
#ttc-color-picker{font-size: 1px;}

/* ==========================================================================
   5. INPUT AREA (Ô nhập liệu)
   ========================================================================== */
.ttc-input-wrapper { display: flex; border-top: 1px solid #eee; background: #fff; align-items: center; padding: 4px; }
.ttc-editor { padding: 8px; outline: none; flex: 1; min-height: 20px; font-size: 14px; background: #fff; }
.ttc-editor:empty:before { content: attr(data-placeholder); color: #bbb; }
.ttc-btn-send { background: #0084ff; color: #fff; border: none; padding: 5px 10px; cursor: pointer; border-radius: 4px; font-size: 13px; font-weight: 600; margin-left: 5px; }
.ttc-btn-send:hover { background: #0073e6; }