/* SAP Chat Widget (Arabic RTL) */
#sap-chat-launcher {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 2147483000;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font-size: 22px;
  line-height: 56px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0,0,0,.18);
  background: #0d6237;
  color: #fff;
}

#sap-chat-panel {
  position: fixed;
  bottom: 86px;
  right: 18px;
  z-index: 2147483000;
  width: 360px;
  max-width: calc(100vw - 24px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(0,0,0,.18);
  overflow: hidden;
  display: none;
  direction: rtl;
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, Arial;
}

#sap-chat-panel.open { display: flex; flex-direction: column; }

.sap-chat-header {
  padding: 12px 12px;
  background: #0d6237;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sap-chat-title { font-size: 14px; font-weight: 700; }
.sap-chat-sub { font-size: 12px; opacity: .9; }

.sap-chat-close {
  border: 0;
  background: rgba(255,255,255,.15);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
}

.sap-chat-body { display: flex; flex: 1; min-height: 0; }

.sap-chat-threads {
  width: 38%;
  border-left: 1px solid #eee;
  overflow: auto;
  background: #fafafa;
}

.sap-thread-item {
  padding: 10px 10px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
.sap-thread-item:hover { background: #f2f2f2; }
.sap-thread-title { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.sap-thread-preview { font-size: 12px; color: #666; }

.sap-chat-messages {
  width: 62%;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sap-msg-list {
  flex: 1;
  overflow: auto;
  padding: 10px;
  background: #fff;
}

.sap-bubble {
  max-width: 92%;
  margin: 6px 0;
  padding: 10px 10px;
  border-radius: 14px;
  font-size: 13px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.sap-bubble.user {
  margin-left: auto;
  background: #0d6237;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.sap-bubble.assistant {
  margin-right: auto;
  background: #f2f3f5;
  color: #111;
  border-bottom-left-radius: 6px;
}

.sap-chat-input {
  border-top: 1px solid #eee;
  padding: 8px;
  display: flex;
  gap: 8px;
  background: #fff;
}

.sap-chat-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 10px;
  font-size: 13px;
  height: 42px;
  outline: none;
}

.sap-chat-input button {
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  cursor: pointer;
  background: #fcc518;
  color: #111;
  font-weight: 700;
}

.sap-hint {
  padding: 10px;
  font-size: 12px;
  color: #666;
}
