.avc-chat-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: #284973;
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 15px 22px;
  font: 600 15px Arial, sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,.22);
}

.avc-chat-button:hover {
  background: #1d3657;
}

.avc-chat-panel {
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 510px;
  max-height: calc(100vh - 110px);
  background: white;
  border-radius: 14px;
  box-shadow: 0 8px 35px rgba(0,0,0,.2);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: Arial, sans-serif;
}

.avc-chat-panel.open {
  display: flex;
}

.avc-chat-header {
  background: #284973;
  color: white;
  padding: 18px;
  font-size: 17px;
  font-weight: bold;
}

.avc-chat-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.avc-chat-content input,
.avc-chat-content textarea,
.avc-chat-content select {
  width: 100%;
  box-sizing: border-box;
  padding: 11px;
  margin: 8px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font: 14px Arial, sans-serif;
}

.avc-chat-action {
  width: 100%;
  background: #284973;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 10px;
}

.avc-chat-article {
  display: block;
  padding: 12px;
  margin: 8px 0;
  background: #f3f6fa;
  border-radius: 6px;
  color: #284973;
  text-decoration: none;
}

.avc-chat-article:hover {
  background: #e5edf7;
}

/* Compact Auction Support header */
.avc-chat-header {
  min-height: 72px;
  padding: 10px 16px;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.avc-chat-logo {
  width: 46px;
  height: 46px;
  padding: 4px;
  border-radius: 50%;
  background: white;
}

.avc-chat-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.avc-chat-header-title {
  flex: 1;
  min-width: 0;
}

.avc-chat-header-title strong {
  font-size: 16px;
  line-height: 1.3;
}

/* Keep logo and title on the same line */
.avc-chat-panel .avc-chat-header {
  display: flex;
  flex-direction: row !important;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 68px;
  padding: 10px 16px;
}

.avc-chat-panel .avc-chat-logo {
  display: flex;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
}

.avc-chat-panel .avc-chat-header-title {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.avc-chat-panel .avc-chat-header-title strong {
  display: block;
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

/* Simple white back arrow */
.avc-chat-panel .avc-chat-back {
  appearance: none;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none;
  padding: 0;
  width: 20px;
  min-width: 20px;
  height: 32px;
  color: #ffffff;
  cursor: pointer;
}

.avc-chat-panel .avc-chat-back span {
  color: #ffffff;
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
}

/* Live customer conversation */
.avc-chat-panel #avc-chat-conversation:not([hidden]) {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.avc-chat-panel #avc-chat-status {
  padding: 10px 0;
  font-size: 12px;
  color: #526579;
}

.avc-chat-panel #avc-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.avc-chat-panel .avc-message {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.avc-chat-panel .avc-message.customer {
  align-self: flex-end;
  background: #284973;
  color: white;
}

.avc-chat-panel .avc-message.support {
  align-self: flex-start;
  background: #f0f3f7;
  color: #25364a;
}

.avc-chat-panel #avc-chat-message-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #e1e5ea;
}

.avc-chat-panel #avc-chat-message-input {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.avc-chat-panel #avc-chat-send {
  width: auto;
  margin: 0;
}

.avc-chat-panel .avc-chat-action:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Keep live chat messages scrollable, not the Send button */
.avc-chat-panel:has(#avc-chat-conversation:not([hidden])) {
  overflow: hidden;
}

.avc-chat-panel #avc-chat-conversation:not([hidden]) {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.avc-chat-panel #avc-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.avc-chat-panel #avc-chat-message-form {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  background: white;
  padding-bottom: 8px;
}

.avc-chat-panel #avc-chat-message-input {
  width: 100%;
  box-sizing: border-box;
}

/* Fix scrolling inside the support panel */
.avc-chat-panel .avc-chat-header {
  flex-shrink: 0;
}

.avc-chat-panel .avc-chat-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Let the conversation fill the available space */
.avc-chat-panel .avc-chat-content:has(#avc-chat-conversation:not([hidden])) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.avc-chat-panel #avc-chat-conversation:not([hidden]) {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.avc-chat-panel #avc-chat-message-form {
  position: static;
  flex-shrink: 0;
}

/* Red End Chat button */
.avc-chat-panel .avc-chat-end:not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #c62828;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.avc-chat-panel .avc-chat-end:hover {
  background: #a91f1f;
}

/* Live chat attachment button */
.avc-chat-panel #avc-chat-attach {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  line-height: 1;
}
