/* ============================================================
   Bruno – KI-Begleiter (Floating-Widget)
   ============================================================ */

/* ═══ PŁYWAJĄCY PRZYCISK ═══ */
#bruno-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1050;
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.5rem 0.75rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 4px 20px rgba(13,71,161,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  font-size: 1.1rem;
  font-weight: bold;
}

#bruno-toggle:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 25px rgba(13,71,161,0.5);
}

#bruno-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

#bruno-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#bruno-label-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

#bruno-label {
  font-size: 1.2rem;
  font-weight: bold;
}

/* Untertitel "Twój przewodnik" / "Dein Begleiter" — nur bei Hover/Fokus
   ausklappen. Auf Touch-Geräten gibt es kein Hover, dort öffnet ein
   Tap direkt den Chat, dessen Kopfzeile denselben Text zeigt. */
#bruno-sub {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: .01em;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

@media (hover: hover) {
  #bruno-toggle:hover #bruno-sub,
  #bruno-toggle:focus-visible #bruno-sub {
    max-height: 20px;
    opacity: 0.95;
  }
}

#bruno-badge {
  background: #e53935;
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

/* ═══ OKIENKO CZATU ═══ */
#bruno-chat {
  position: fixed;
  bottom: 108px;
  right: 24px;
  z-index: 1049;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 70vh;
}

#bruno-header {
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  color: white;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#bruno-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#bruno-header-info img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  object-fit: cover;
}

#bruno-header-info strong {
  display: block;
  font-size: 1rem;
}

#bruno-header-info small {
  font-size: 0.75rem;
  opacity: 0.85;
}

#bruno-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

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

/* Wiadomości */
#bruno-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 200px;
  max-height: 300px;
}

.bruno-msg {
  max-width: 85%;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.bruno-msg.bruno {
  background: #e3f2fd;
  color: #0d47a1;
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}

.bruno-msg.user {
  background: #1565c0;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}

.bruno-msg.typing {
  background: #e3f2fd;
  color: #999;
  align-self: flex-start;
  font-style: italic;
}

/* Szybkie pytania */
#bruno-quick {
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-top: 1px solid #eee;
}

.bruno-quick-btn {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
  border-radius: 20px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.bruno-quick-btn:hover {
  background: #bbdefb;
}

/* Input */
#bruno-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #eee;
  align-items: flex-end;
}

#bruno-input {
  flex: 1;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  resize: none;
  outline: none;
  font-family: inherit;
  line-height: 1.4;
}

#bruno-input:focus {
  border-color: #1565c0;
}

#bruno-send {
  background: #1565c0;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

#bruno-send:hover { background: #0d47a1; }
#bruno-send:disabled {
  background: #90caf9;
  cursor: not-allowed;
}

/* Mobile */
@media (max-width: 576px) {
  #bruno-toggle {
    bottom: 12px;
    right: 12px;
    max-width: calc(100vw - 24px);
    padding: 0.5rem 0.9rem 0.5rem 0.5rem;
    font-size: 0.9rem;
  }

  #bruno-avatar {
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
  }

  #bruno-label {
    font-size: 0.9rem;
  }

  #bruno-chat {
    bottom: 70px;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: 80vh;
  }

  #bruno-messages {
    max-height: 45vh;
  }

  #bruno-input-area {
    padding: 0.5rem;
  }

  #bruno-input {
    font-size: 0.95rem;
  }

  #bruno-send {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }

  #bruno-quick {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0.4rem 0.5rem;
    -webkit-overflow-scrolling: touch;
  }

  .bruno-quick-btn {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
  }
}
