:host {
  display: block;
  position: relative;
  font-family: system-ui, sans-serif;
  z-index: 1000;

  /* Temavariabler */
  --chat-bg: #ffffff;
  --chat-text: #333333;
  --chat-accent: #26a69a;
  --chat-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  --chat-radius: 6px;

  --confidence-high-bg: #e0f8e9;
  --confidence-high-text: #2e7d32;
  --confidence-medium-bg: #fff8e1;
  --confidence-medium-text: #f9a825;
  --confidence-low-bg: #ffebee;
  --confidence-low-text: #c62828;
}

/* Inputfält + knapp */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--chat-bg);
  border-radius: var(--chat-radius);
  padding: 0.3rem 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  min-width: 240px;
}

input[part="input"] {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.9rem;
  padding: 0.4rem;
  background: transparent;
  color: var(--chat-text);
}

.ask-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
}

.ask-button img {
  width: 20px;
  height: 20px;
}

.spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Svarspanel */
.response-box {
  position: absolute;
  top: calc(100% + 4px); /* direkt under input-wrapper */
  left: 0;
  background: var(--chat-bg);
  box-shadow: var(--chat-shadow);
  border-radius: var(--chat-radius);
  padding: 1rem 1rem 2.5rem 1rem; /* extra bottenutrymme för knappar */
  min-width: 280px;
  max-width: 400px;
  z-index: 9999;
  font-size: 0.85rem;
  color: var(--chat-text);
}

.response-box p {
  margin: 0 0 0.5rem 0;
}

/* Stäng-knapp i nedre högra hörnet */
.close-button {
  position: absolute;
  bottom: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #888;
  cursor: pointer;
  line-height: 1;
}

/* Responsiv justering */
@media (max-width: 600px) {
  .input-wrapper {
    min-width: 100%;
  }

  .response-box {
    max-width: 100%;
    left: 0;
    right: auto;
  }
}

button img {
  width: 16px;
  height: 16px;
}