.amazon-chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 360px;
  height: 520px;
  min-width: 320px;
  min-height: 420px;
  max-width: 90vw;
  max-height: 86vh;
  z-index: 9999;
  background: #f7fafc;
  border: 1px solid #d9e2ec;
  border-radius: 16px;
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.amazon-chat-widget.minimized {
  min-height: 52px;
  min-width: 220px;
}

.amazon-chat-header {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 14px;
  background: linear-gradient(135deg, #0b4f6c 0%, #126782 58%, #1b7d95 100%);
  color: #fff;
  cursor: move;
  user-select: none;
  border-radius: 16px 16px 0 0;
  position: relative;
  z-index: 10;
}

.amazon-chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.amazon-chat-title-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a7f3d0;
  box-shadow: 0 0 0 3px rgba(167, 243, 208, 0.25);
}

.amazon-chat-actions {
  display: flex;
  gap: 6px;
}

.amazon-chat-btn {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  line-height: 26px;
  text-align: center;
}

.amazon-chat-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.amazon-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, #f8fbfd 0%, #f3f7fb 100%);
  overflow: hidden;
  border-radius: 0 0 16px 16px;
}

.amazon-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.amazon-chat-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.amazon-chat-msg.user {
  align-self: flex-end;
  background: #1666c1;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.amazon-chat-msg.assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #dde5ee;
  color: #1f2d3d;
  border-bottom-left-radius: 4px;
}

.amazon-chat-sources {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #d1d5db;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.amazon-chat-sources a {
  color: #155e96;
  text-decoration: none;
  font-size: 12px;
}

.amazon-chat-sources a:hover {
  text-decoration: underline;
}

.amazon-chat-input-wrap {
  flex-shrink: 0;
  border-top: 1px solid #dfe6ee;
  background: #fff;
  padding: 10px;
}

.amazon-chat-input-row {
  display: flex;
  gap: 8px;
}

.amazon-chat-input {
  flex: 1;
  min-height: 38px;
  max-height: 120px;
  padding: 8px 10px;
  border: 1px solid #ccd6df;
  border-radius: 8px;
  font-size: 13px;
  resize: vertical;
}

.amazon-chat-input:focus {
  outline: none;
  border-color: #1b7d95;
  box-shadow: 0 0 0 2px rgba(27, 125, 149, 0.14);
}

.amazon-chat-send {
  width: 72px;
  border: none;
  border-radius: 8px;
  background: #1b7d95;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.amazon-chat-send:hover {
  background: #166a7f;
}

.amazon-chat-send:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.amazon-chat-hint {
  margin-top: 6px;
  font-size: 11px;
  color: #6b7480;
}

.amazon-chat-resizer {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, #9caec1 50%);
}

.amazon-chat-widget.minimized .amazon-chat-body,
.amazon-chat-widget.minimized .amazon-chat-resizer {
  display: none;
}

.amazon-chat-widget.minimized .amazon-chat-header {
  border-radius: 16px;
}

@media (max-width: 1200px) {
  .amazon-chat-widget {
    right: 14px;
    bottom: 14px;
  }
}

@media (max-width: 768px) {
  .amazon-chat-widget {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    height: 70vh;
    max-width: none;
    min-width: 0;
  }

  .amazon-chat-widget.minimized {
    left: auto;
    right: 8px;
    width: 200px;
    min-width: 200px;
  }
}
