/* Floating chat FAB + Messenger-style panel (global). */

.d360-floating-chat {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 110;
}

.d360-chatfab {
  position: relative;
  z-index: 111;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: var(--wb-blue);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 34, 68, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.d360-chatfab:hover {
  background: var(--wb-blue-dark);
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(0, 34, 68, 0.30), 0 0 0 4px rgba(253, 184, 19, 0.28);
}
.d360-chatfab svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}
.d360-chatfab.is-hidden {
  display: none;
}

.d360-chatfab__label {
  position: absolute;
  right: calc(56px + 12px);
  bottom: 50%;
  transform: translateY(50%);
  z-index: 110;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--wb-navy);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(0, 34, 68, 0.20);
}
.d360-floating-chat.is-open .d360-chatfab__label {
  display: none;
}
.d360-chatfab__label::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translateY(-50%) rotate(45deg);
  background: #fff;
  border-right: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

.d360-chatwin {
  position: fixed;
  right: 0;
  bottom: 68px;
  z-index: 109;
  width: min(400px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 120px));
  background: var(--bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 34, 68, 0.2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.2s, transform 0.2s;
}
.d360-chatwin.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.d360-chatwin.is-minimized {
  max-height: 48px;
  overflow: hidden;
}
.d360-chatwin.is-expanded {
  width: min(560px, calc(100vw - 48px));
  max-height: min(720px, calc(100vh - 96px));
}
.d360-chatwin.is-expanded .d360-chatwin__messages {
  max-height: none;
  min-height: 280px;
}
.d360-chatwin__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--wb-blue);
  color: #fff;
  flex-shrink: 0;
}
.d360-chatwin__title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.d360-chatwin__controls {
  display: flex;
  gap: 4px;
}
.d360-chatwin__btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.d360-chatwin__btn:hover {
  background: rgba(255, 255, 255, 0.28);
}
.d360-chatwin__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.d360-chatwin__welcome {
  padding: 16px;
  font-size: 13px;
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  line-height: 1.45;
}
.d360-chatwin__welcome[hidden] {
  display: none;
}
.d360-chatwin__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.d360-chatwin__presets[hidden] {
  display: none;
}
.d360-chatwin__preset {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--wb-navy);
  background: #fff;
  cursor: pointer;
}
.d360-chatwin__preset:hover:not(:disabled) {
  border-color: var(--wb-blue);
  background: var(--wb-blue-wash);
}
.d360-chatwin__preset:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.d360-chatwin__messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 200px;
  max-height: 320px;
}
.d360-chatwin__messages[hidden] {
  display: none;
}
.d360-chatwin__messages .d360-chat__msg {
  margin-bottom: 10px;
}
.d360-chatwin__messages .d360-chat__msg--assistant .d360-chat__bubble,
.d360-chatwin__messages .d360-chat__msg--assistant > p {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 4px;
  padding: 10px 14px;
}
.d360-chatwin__messages .d360-chat__msg--user {
  margin-left: auto;
  max-width: 88%;
}
.d360-chatwin__messages .d360-chat__msg--user > p {
  background: var(--wb-blue);
  color: #fff;
  border-radius: 12px 12px 4px 12px;
  padding: 10px 14px;
}
.d360-chatwin.is-minimized .d360-chatwin__presets,
.d360-chatwin.is-minimized .d360-chatwin__messages,
.d360-chatwin.is-minimized .d360-chatwin__form,
.d360-chatwin.is-minimized .d360-chatwin__welcome {
  display: none;
}
.d360-chatwin__form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
.d360-chatwin__input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  resize: none;
  min-height: 36px;
  max-height: 80px;
}
.d360-chatwin__send {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--wb-blue);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}
.d360-chatwin__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (min-width: 601px) {
  .d360-floating-chat.is-open .d360-chatfab {
    opacity: 0.92;
  }
}
@media (max-width: 600px) {
  .d360-floating-chat { right: 16px; bottom: 16px; }
  .d360-chatwin { right: 0; bottom: 68px; width: calc(100vw - 32px); }
  .d360-chatfab__label { display: none; }
  .d360-chatwin__btn#d360-chatwin-expand { display: none; }
}
