/* ===== TOGGLE BUTTON ===== */
#sobi-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
  transition: transform 0.3s ease;
  z-index: 9999;
  background: linear-gradient(135deg, #7c3aed, #9f67f5);
}

#sobi-toggle:hover {
  transform: scale(1.1);
}

#sobi-toggle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#sobi-toggle.sobi-hidden {
  display: none;
}

/* ===== CHAT BOX ===== */
#sobi-box {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 360px;
  height: 500px;
  background: #0a0a0f;
  border: 1px solid #2d2640;
  border-radius: 16px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(124, 58, 237, 0.3);
  z-index: 9999;
  font-family: 'Segoe UI', sans-serif;
}

#sobi-box.sobi-open {
  display: flex;
}

/* ===== HEADER ===== */
#sobi-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #110f1a;
  border-bottom: 1px solid #2d2640;
}

#sobi-header img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #9f67f5;
}

#sobi-header div {
  flex: 1;
}

#sobi-header strong {
  display: block;
  color: #ede9fe;
  font-size: 15px;
}

#sobi-header span {
  color: #7c6fa0;
  font-size: 12px;
}

#sobi-close {
  background: none;
  border: none;
  color: #7c6fa0;
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s;
}

#sobi-close:hover {
  color: #ede9fe;
}

/* ===== MESSAGES ===== */
#sobi-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: #2d2640 transparent;
}

.sobi-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.sobi-bot {
  background: #110f1a;
  color: #ede9fe;
  border: 1px solid #2d2640;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.sobi-user {
  background: #7c3aed;
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* ===== TYPING ANIMATION ===== */
.sobi-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.sobi-typing span {
  width: 8px;
  height: 8px;
  background: #7c6fa0;
  border-radius: 50%;
  animation: sobi-bounce 1.2s infinite;
}

.sobi-typing span:nth-child(2) { animation-delay: 0.2s; }
.sobi-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes sobi-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* ===== INPUT AREA ===== */
#sobi-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #110f1a;
  border-top: 1px solid #2d2640;
}

#sobi-input {
  flex: 1;
  background: #0a0a0f;
  border: 1px solid #2d2640;
  border-radius: 8px;
  padding: 10px 14px;
  color: #ede9fe;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#sobi-input:focus {
  border-color: #7c3aed;
}

#sobi-input::placeholder {
  color: #7c6fa0;
}

#sobi-send {
  background: #7c3aed;
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sobi-send:hover {
  background: #9f67f5;
}

@media (max-width: 400px) {
  #sobi-box {
    width: 100vw;
    height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }

  #sobi-toggle {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }

  #sobi-header img {
    width: 36px;
    height: 36px;
  }

  #sobi-input {
    font-size: 16px; /* verhindert Auto-Zoom auf iPhone */
  }
}

/* ===== SUGGESTION BUTTONS ===== */
#sobi-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.sobi-suggestion {
  background: #110f1a;
  border: 1px solid #2d2640;
  border-radius: 10px;
  color: #c4b5fd;
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, border-color 0.2s;
}

.sobi-suggestion:hover {
  background: #1e1530;
  border-color: #7c3aed;
  color: #ede9fe;
}

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 480px) {
  #sobi-box {
    width: 100%;
    height: 100%;
    height: 100dvh; /* dvh = dynamic viewport height, rechnet Navbar ein */
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    border-radius: 0;
    position: fixed;
  }

  #sobi-toggle {
    bottom: 20px;
    right: 20px;
    width: 52px;
    height: 52px;
  }

  #sobi-header {
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top)); /* iPhone Notch */
  }

  #sobi-header img {
    width: 64px;
    height: 64px;
  }

  #sobi-input-area {
    padding-bottom: max(12px, env(safe-area-inset-bottom)); /* iPhone Home Bar */
  }

  #sobi-input {
    font-size: 16px; /* verhindert Auto-Zoom auf iPhone */
  }

  .sobi-msg {
    max-width: 90%;
    font-size: 13px;
  }

  .sobi-suggestion {
    font-size: 12px;
    padding: 7px 12px;
  }
}