/* Live chat widget (public site) */
.chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(14, 58, 140, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab[aria-expanded="true"] { background: var(--primary-dark); }

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 86px;
  z-index: 9001;
  width: min(380px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 120px));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(14, 58, 140, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel.open { display: flex; }

.chat-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 12px 14px 16px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
}
.chat-panel-head-text { flex: 1; min-width: 0; }
.chat-panel-head strong { display: block; font-size: 15px; }
.chat-panel-head span { font-size: 12px; opacity: 0.9; }
.chat-panel-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}
.chat-panel-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.chat-panel-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: var(--bg-soft);
  min-height: 200px;
  max-height: 340px;
}
.chat-bubble {
  max-width: 88%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}
.chat-bubble.visitor {
  margin-left: auto;
  background: var(--secondary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble.staff {
  margin-right: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-bubble time {
  display: block;
  font-size: 10px;
  opacity: 0.75;
  margin-top: 4px;
}
.chat-panel-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px 12px;
}

.chat-panel-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.chat-panel-foot textarea {
  width: 100%;
  resize: none;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  min-height: 72px;
  box-sizing: border-box;
}
.chat-panel-foot textarea:focus {
  outline: none;
  border-color: var(--secondary);
}
.chat-panel-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  gap: 8px;
}
.chat-panel-actions .btn {
  padding: 8px 18px;
  font-size: 13px;
  border-radius: 30px;
  border: none;
}
