.ai-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  font-family: Arial, Helvetica, sans-serif;
}

.ai-chat-launcher {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 8px 16px 8px 9px;
  border: 0;
  border-radius: 999px;
  background: #001d34;
  color: #fff;
  box-shadow: 0 12px 35px rgba(0, 29, 52, 0.28);
  cursor: pointer;
}

.ai-chat-launcher:hover {
  transform: translateY(-1px);
}

.ai-chat-launcher-icon,
.ai-chat-brand-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5cba47, #cedc29);
  color: #001d34;
  font-size: 21px;
  font-weight: 800;
}

.ai-chat-launcher-text {
  display: grid;
  text-align: left;
  line-height: 1.1;
}

.ai-chat-launcher-text strong {
  font-size: 14px;
}

.ai-chat-launcher-text small {
  margin-top: 3px;
  opacity: 0.72;
  font-size: 11px;
}

.ai-chat-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 30px));
  height: min(610px, calc(100vh - 110px));
  overflow: hidden;
  border: 1px solid rgba(0, 29, 52, 0.12);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 29, 52, 0.25);
}

.ai-chat-panel[hidden] {
  display: none;
}

.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: #001d34;
  color: #fff;
}

.ai-chat-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.ai-chat-brand-icon {
  width: 38px;
  height: 38px;
  font-size: 18px;
}

.ai-chat-brand div {
  display: grid;
  min-width: 0;
}

.ai-chat-brand strong {
  font-size: 15px;
}

.ai-chat-brand span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}

.ai-chat-close {
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 29px;
  line-height: 1;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 10px;
  background: #f5f7f8;
  overscroll-behavior: contain;
}

.ai-chat-message {
  display: flex;
  margin-bottom: 11px;
}

.ai-chat-message.user {
  justify-content: flex-end;
}

.ai-chat-bubble {
  max-width: 84%;
  padding: 11px 13px;
  border-radius: 15px;
  background: #fff;
  color: #17222b;
  box-shadow: 0 1px 3px rgba(0, 29, 52, 0.08);
  font-size: 14px;
  line-height: 1.42;
  white-space: pre-wrap;
}

.ai-chat-message.user .ai-chat-bubble {
  border-bottom-right-radius: 5px;
  background: #001d34;
  color: #fff;
}

.ai-chat-message.assistant .ai-chat-bubble {
  border-bottom-left-radius: 5px;
}

.ai-chat-message.loading .ai-chat-bubble {
  color: #66737d;
  font-style: italic;
}

.ai-chat-quick {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 9px 12px;
  border-top: 1px solid #e7ecef;
  background: #fff;
  scrollbar-width: none;
}

.ai-chat-quick::-webkit-scrollbar {
  display: none;
}

.ai-chat-quick button {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(0, 29, 52, 0.14);
  border-radius: 999px;
  background: #fff;
  color: #001d34;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.ai-chat-quick button:hover {
  border-color: #5cba47;
}

.ai-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e7ecef;
  background: #fff;
}

.ai-chat-form textarea {
  width: 100%;
  min-height: 42px;
  max-height: 110px;
  resize: none;
  padding: 10px 12px;
  border: 1px solid #ccd5da;
  border-radius: 13px;
  outline: 0;
  color: #17222b;
  font: inherit;
  font-size: 14px;
}

.ai-chat-form textarea:focus {
  border-color: #5cba47;
  box-shadow: 0 0 0 3px rgba(92, 186, 71, 0.13);
}

.ai-chat-form button {
  align-self: end;
  min-height: 42px;
  padding: 0 15px;
  border: 0;
  border-radius: 12px;
  background: #5cba47;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.ai-chat-form button:disabled,
.ai-chat-form textarea:disabled {
  opacity: 0.55;
  cursor: wait;
}

.ai-chat-note {
  margin: 0;
  padding: 0 13px 11px;
  background: #fff;
  color: #77838b;
  font-size: 9px;
  line-height: 1.35;
}

@media (max-width: 600px) {
  .ai-chat {
    right: 12px;
    bottom: 12px;
  }

  .ai-chat-launcher {
    min-height: 54px;
    padding-right: 13px;
  }

  .ai-chat-launcher-icon {
    width: 38px;
    height: 38px;
  }

  .ai-chat-panel {
    position: fixed;
    inset: 10px;
    width: auto;
    height: auto;
    max-height: none;
    border-radius: 18px;
  }

  .ai-chat-launcher-text small {
    display: none;
  }

  body.ai-chat-open {
    overflow: hidden;
  }
}

/* Skjul launcheren mens chatvinduet er åpent */
body.ai-chat-open .ai-chat-launcher {
  display: none;
}

/* UX-justeringer chat */
.ai-chat-bubble {
  overflow-wrap: anywhere;
}

.ai-chat-message.assistant .ai-chat-bubble {
  white-space: pre-line;
}

@media (max-width: 600px) {
  .ai-chat-panel {
    inset: 6px;
    border-radius: 16px;
  }

  .ai-chat-header {
    padding: 12px 14px;
  }

  .ai-chat-messages {
    padding: 14px 12px 8px;
  }

  .ai-chat-bubble {
    max-width: 90%;
    padding: 10px 12px;
    font-size: 13.5px;
    line-height: 1.38;
  }

  .ai-chat-quick {
    padding: 7px 10px;
  }

  .ai-chat-quick button {
    padding: 6px 9px;
    font-size: 10.5px;
  }

  .ai-chat-form {
    padding: 8px 10px;
  }

  .ai-chat-note {
    padding: 0 11px 8px;
    font-size: 8.5px;
  }
}

/* Bilvask-logo i chat */
img.ai-chat-launcher-icon,
img.ai-chat-brand-icon {
  display: block;
  object-fit: cover;
  padding: 0;
  background: transparent;
}

/* Juster negativ Bilvask-logo i chat */
img.ai-chat-launcher-icon,
img.ai-chat-brand-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 50%;
  background: transparent;
}

img.ai-chat-brand-icon {
  width: 38px;
  height: 38px;
}

/* Kundeservice-overlevering */
.ai-chat-action-row {
  display: flex;
  margin: -2px 0 13px;
}

.ai-chat-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  background: #5cba47;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 29, 52, 0.12);
}

.ai-chat-action:hover {
  transform: translateY(-1px);
}

/* Kompakt layout for mindre mobiler */
@media (max-width: 430px) {
  .ai-chat-panel {
    inset: 10px 8px 12px;
    border-radius: 15px;
  }

  .ai-chat-header {
    padding: 10px 12px;
  }

  .ai-chat-brand {
    gap: 9px;
  }

  img.ai-chat-brand-icon {
    width: 34px;
    height: 34px;
  }

  .ai-chat-brand strong {
    font-size: 14px;
  }

  .ai-chat-brand span {
    font-size: 10px;
  }

  .ai-chat-close {
    font-size: 26px;
  }

  .ai-chat-messages {
    padding: 11px 9px 7px;
  }

  .ai-chat-bubble {
    max-width: 91%;
    padding: 9px 10px;
    border-radius: 13px;
    font-size: 12.5px;
    line-height: 1.34;
  }

  .ai-chat-quick {
    gap: 5px;
    padding: 6px 8px;
  }

  .ai-chat-quick button {
    padding: 5px 8px;
    font-size: 9.5px;
  }

  .ai-chat-form {
    gap: 6px;
    padding: 7px 8px;
  }

  .ai-chat-form textarea {
    min-height: 39px;
    padding: 9px 10px;
    font-size: 13px;
  }

  .ai-chat-form button {
    min-height: 39px;
    padding: 0 13px;
    font-size: 13px;
  }

  .ai-chat-note {
    padding: 0 9px 7px;
    font-size: 8px;
  }
}

/* Unngå automatisk zoom i iPhone/Safari */
@media (max-width: 600px) {
  .ai-chat-form textarea {
    font-size: 16px;
  }
}

