
/* Grundinställningar */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Chat Widget */
#chat-widget {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 380px;
  max-height: 80vh;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  min-width: 300px;
  min-height: 350px;
}

#chat-widget.hidden {
  display: none;
}

.chat-header {
  background-color: #2b456c;
  color: white;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  user-select: none;
  cursor: move;
}

.chat-logo {
  height: 35px;
  max-width: 150px;
  object-fit: contain;
  filter: invert(1) brightness(50);
  margin-top: 10px;
}

#chat-close {
  cursor: pointer;
  font-size: 18px;
}

#chat-close:hover {
  opacity: 1;
}

/* Chat-box (med scroll) */
#chat-box {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 8px; /* mellanrum mellan meddelanden */
}

/* Användarens meddelandebubbla */
.user-wrapper {
  display: flex;
  justify-content: flex-end;
}

.user {
  background: #e4e7ec;
  color: #333;
  padding: 12px 18px;
  border-radius: 18px 18px 4px 18px;
  max-width: 75%;
  word-wrap: break-word;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.4;
}

/* Botens meddelandebubbla */
.bot-wrapper {
  display: flex;
  justify-content: flex-start;
}

.bot {
  background: #e1f3ff;
  color: #0c2c50;
  padding: 12px 18px;
  border-radius: 18px 18px 18px 4px;
  max-width: 75%;
  word-wrap: break-word;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.4;
}

/* Skrivindikator */
.typing-indicator {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding-left: 8px;
  height: 20px;
}

.typing-indicator span {
  display: block;
  width: 6px;
  height: 6px;
  background: #aaa;
  border-radius: 50%;
  animation: blink 1.2s infinite ease-in-out both;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input-område */
.chat-input-area {
  display: flex;
  padding: 10px 12px;
  border-top: 1px solid #dcdcdc;
  background: #fff;
  align-items: center;
  
}

.chat-input-area input {
  flex: 1;
  border: 1px solid #d2d6dc;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  background-color: #f9f9f9;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  height: 40px;
  box-sizing: border-box;
}

.chat-input-area input:focus {
  background-color: #fff;
  border-color: #2b456c;
}



.chat-input-area button:hover {
  background-color: #1f3250;
  transform: scale(1.1);
}

.chat-input-area button {
  margin-left: 8px;
  background: #2b456c;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 1px 1px; /* lite bredare padding */
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0 4px 10px rgba(43, 69, 108, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;  /* så inget sticker ut */
  width: 42px; /* gör knappen kvadratisk och tillräckligt stor */
  height: 42px;
  min-width: 42px;
}

.chat-input-area button svg {
  stroke: white;
  width: 25px;
  height: 25px;

}





/* Chat toggle knapp */
#chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: linear-gradient(135deg, #2b456c, #203554);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow:
    0 4px 12px rgba(43, 69, 108, 0.4),
    0 8px 24px rgba(32, 53, 84, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  z-index: 9998;
  user-select: none;
}

#chat-toggle:hover {
  box-shadow:
    0 6px 18px rgba(43, 69, 108, 0.6),
    0 12px 36px rgba(32, 53, 84, 0.5);
  transform: scale(1.1);
}

#chat-toggle:focus {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(43, 69, 108, 0.6),
    0 6px 18px rgba(43, 69, 108, 0.6),
    0 12px 36px rgba(32, 53, 84, 0.5);
  transform: scale(1.1);
}

#chat-toggle svg {
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
  transition: filter 0.3s ease;
}

   
  
  

#chat-toggle:hover svg {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Responsive */
@media (max-width: 480px) {
    #chat-widget {
      width: 92%;
      max-height: 70vh; /* lite mindre för att få plats bättre */
      right: 4%;
      bottom: 70px;
      min-width: unset; /* ta bort min-width så den kan bli smalare */
      border-radius: 12px; /* lite mindre rundade hörn */
    }
  
    #chat-box {
      padding: 12px 8px; /* mindre padding på mobilen */
    }
  
    .chat-input-area {
      padding: 8px 8px; /* mindre padding */
    }
  
    .chat-input-area input {
      font-size: 16px;
      height: 36px;
    }
  
    .chat-input-area button {
      width: 38px;
      height: 38px;
      padding: 0;
    }
  
    #chat-toggle {
      bottom: 16px;
      right: 16px;
      width: 48px;
      height: 48px;
    }
  }
  


