/* ==========================================================================
   Pływający Widget AI (#aiFloatingContainer)
   ========================================================================== */
.ai-floating-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 110;
}

.ai-floating-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  font-weight: 850;
  font-size: 0.88rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 12px 35px rgba(59, 130, 246, 0.4);
  cursor: pointer;
  transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-floating-trigger:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 16px 45px rgba(139, 92, 246, 0.5);
}

.ai-sparkle {
  font-size: 1.1rem;
  color: #fde047;
}

.ai-widget-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: min(440px, calc(100vw - 32px));
  height: 560px;
  max-height: calc(100dvh - 100px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: var(--panel, #111821);
  border: 1px solid var(--line);
  box-shadow: 0 24px 75px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(20px);
  overflow: hidden;
  animation: slideUpAi 0.22s ease-out;
}

.ai-widget-panel[hidden] {
  display: none !important;
}

@keyframes slideUpAi {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ai-widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.ai-widget-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-sparkle-icon {
  color: #fde047;
  font-size: 1.1rem;
}

.ai-widget-title-wrap h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 850;
}

.ai-badge-beta {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(232, 197, 106, 0.15);
  color: var(--accent);
  border: 1px solid rgba(232, 197, 106, 0.3);
  font-weight: 800;
}

.ai-widget-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-widget-btn-icon {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: 0.15s;
}

.ai-widget-btn-icon:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.ai-widget-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--line);
  font-size: 0.74rem;
}

.ai-model-pill {
  color: var(--muted);
  font-weight: 700;
}

.ai-fallback-banner {
  padding: 8px 12px;
  font-size: 0.74rem;
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  line-height: 1.35;
}

.ai-widget-body-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.ai-widget-messages {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-msg {
  display: block;
  max-width: 88%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 0.82rem;
  line-height: 1.45;
  word-break: break-word;
}

.ai-msg strong {
  font-weight: 700;
  color: inherit;
}

.ai-msg code {
  font-family: var(--font-mono, monospace);
  font-size: 0.88em;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
}

.ai-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-msg.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.ai-msg.error {
  align-self: center;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 0.78rem;
}

.ai-widget-suggestions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--control-bg, rgba(0, 0, 0, 0.15));
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

.ai-widget-suggestions::-webkit-scrollbar {
  height: 6px;
}

.ai-widget-suggestions::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 3px;
}

.ai-widget-suggestions::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 3px;
}

.ai-widget-suggestions::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

.ai-widget-suggestions:empty {
  display: none;
  padding: 0;
  border-top: none;
}

.ai-sugg-chip {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  white-space: nowrap;
  word-break: normal;
  min-height: 36px;
  height: 36px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel2, rgba(255, 255, 255, 0.04));
  color: var(--muted);
  font-size: 0.72rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-sugg-chip:hover {
  color: var(--control-active-text, var(--text));
  border-color: var(--control-active-border, var(--accent));
  background: var(--control-active-bg, rgba(232, 197, 106, 0.14));
}

.ai-widget-form {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}

.ai-widget-input {
  flex: 1;
  resize: none;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  line-height: 1.35;
}

.ai-widget-input:focus {
  border-color: var(--accent);
}

.ai-widget-send {
  padding: 0 14px;
  border-radius: 10px;
  border: 0;
  background: var(--accent);
  color: var(--control-active-text, #080c12);
  font-weight: 900;
  cursor: pointer;
  transition: 0.15s;
}

.ai-widget-send:hover {
  transform: scale(1.04);
}
