/* MEMBRANE - Custom Styles */

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #1f2937;
}
::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* Bubble animations */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-bubble {
  animation: slideIn 0.2s ease-out;
  max-width: 80%;
  word-wrap: break-word;
}

.message-bubble.own {
  margin-left: auto;
}

.message-bubble.other {
  margin-right: auto;
}

/* Flame animation for Fiamma badge */
@keyframes flicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

.badge-fiamma {
  animation: flicker 1.5s ease-in-out infinite;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* Typing animation */
@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.typing-dot {
  display: inline-block;
  animation: typingDot 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* File upload button hover */
input[type="file"]::file-selector-button {
  transition: all 0.2s;
}

/* Responsive bubbles */
@media (max-width: 640px) {
  .message-bubble {
    max-width: 90%;
  }
}

/* Smooth transitions */
* {
  transition: background-color 0.2s, border-color 0.2s;
}

/* Avatar styling */
.avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* Loading spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  animation: spin 1s linear infinite;
}

/* Message content styling */
.message-content a {
  color: #f97316;
  text-decoration: underline;
}
.message-content a:hover {
  color: #fb923c;
}

/* Dark mode base */
.dark body {
  background-color: #111827;
}

/* Toast notifications */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
  max-width: 300px;
}
.toast.error {
  background: #7f1d1d;
  border: 1px solid #dc2626;
}
.toast.success {
  background: #14532d;
  border: 1px solid #22c55e;
}
/* Streaming bubble */
.stream-active {
  animation: none;
}

.stream-bubble {
  border: 1px solid #f97316;
  border-color: rgba(249, 115, 22, 0.3);
}

.stream-text {
  color: #e0e0e0;
  white-space: pre-wrap;
}

.stream-cursor {
  color: #f97316;
  font-weight: bold;
  margin-left: 2px;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Fix scroll chat - header/footer sempre visibili */
body.chat-page {
  overflow: hidden;
  height: 100dvh;
}
#messages {
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  max-height: calc(100dvh - 130px);
}
