@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700&display=swap');

/* ===================================================================
   DEMO PAGE (tylko dla index.html podglądowego – na produkcji możesz
   to spokojnie wywalić lub zostawić, bo jest w pełni odseparowane)
   =================================================================== */

body {
  margin: 0;
  font-family: "Golos Text", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: #f3f4f6;
}

.demo-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.demo-card {
  max-width: 640px;
  width: 100%;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.15);
  padding: 28px 32px;
}

.demo-card h1 {
  margin: 0 0 8px;
  font-size: 26px;
  color: #0f172a;
}

.demo-card p,
.demo-card ul {
  font-size: 14px;
  color: #334155;
}

/* ===================================================================
   WIDGET – GLOBAL
   =================================================================== */

:root {
  --m-header-from: #2e5bdf;
  --m-header-to: #6921a9;
  --m-primary: #3f5fbe;
  --m-border: #d4d4d8;
  --m-gray-bg: #f9fafb;
  --m-text-main: #111827;
  --m-text-muted: #6b7280;
}

#matur-ai-chat,
#matur-ai-bubble {
  font-family: "Golos Text", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

/* ===================================================================
   FLOATING BUTTON (dymek otwierający)
   =================================================================== */

#matur-ai-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--m-header-from) 0%, var(--m-header-to) 100%);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99999;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#matur-ai-bubble:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.6);
}

#matur-ai-bubble img {
  width: 40px;
  height: 40px;
  display: block;
}

/* ===================================================================
   OKNO CZATU
   =================================================================== */

#matur-ai-chat {
  position: fixed;
  bottom: 104px;
  right: 24px;
  width: 420px;
  max-width: calc(100vw - 24px);
  height: 640px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.35);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
}

/* ===================================================================
   HEADER
   =================================================================== */

#matur-ai-header {
  padding: 12px 24px;
  background: linear-gradient(180deg, var(--m-header-from) 0%, var(--m-header-to) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #ffffff;
}

.matur-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.matur-header-avatar {
  width: 35px;
  height: 35px;
  border-radius: 999px;
  padding: 6px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(180deg, var(--m-header-from) 0%, var(--m-header-to) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.matur-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.matur-header-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.matur-header-logo {
  height: 20px;
  width: auto;
  display: block;
}

.matur-header-name {
  font-size: 14px;
  font-weight: 500;
}

.matur-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.9;
}

.matur-header-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.35);
}

#matur-ai-header-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

#matur-ai-header-close:hover {
  background: rgba(15, 23, 42, 0.2);
  transform: scale(1.03);
}

/* ===================================================================
   MESSAGES AREA
   =================================================================== */

#matur-ai-messages {
  flex: 1;
  padding: 16px 24px 12px 24px;
  overflow-y: auto;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* scrollbar lekkie */
#matur-ai-messages::-webkit-scrollbar {
  width: 6px;
}
#matur-ai-messages::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 999px;
}

/* ===================================================================
   WIERSZE WIADOMOŚCI
   =================================================================== */

.matur-msg-row {
  width: 100%;
  display: flex;
  gap: 8px;
}

.matur-msg-row.assistant {
  justify-content: flex-start;
}

.matur-msg-row.user {
  justify-content: flex-end;
}

/* avatar bota przy wiadomościach */
.matur-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  padding: 6px;
  background: linear-gradient(180deg, var(--m-header-from) 0%, var(--m-header-to) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 4px;
}

.matur-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* kontener na dymek + czas */
.matur-msg-content {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

/* BAŃKI */
.matur-msg-bubble {
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.matur-msg-bubble.assistant {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: var(--m-text-main);
}

.matur-msg-bubble.user {
  background: var(--m-primary);
  color: #ffffff;
}

/* prosty markdown */
.matur-msg-bubble strong {
  font-weight: 600;
}

/* czas */
.matur-msg-time {
  margin-top: 4px;
  font-size: 12px;
  color: var(--m-text-muted);
}

/* ===================================================================
   TOOL CALLS (NEW)
   =================================================================== */

.matur-tool-call {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(63, 95, 190, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(63, 95, 190, 0.2);
}

.matur-tool-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.matur-tool-info {
  flex: 1;
  min-width: 0;
}

.matur-tool-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--m-primary);
  margin-bottom: 2px;
}

.matur-tool-args {
  font-size: 11px;
  color: var(--m-text-muted);
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===================================================================
   TYPING INDICATOR
   =================================================================== */

#matur-ai-typing {
  padding: 0 24px 12px 24px;
  display: none;
  align-items: center;
  gap: 8px;
  color: var(--m-text-muted);
  font-size: 13px;
}

.matur-typing-dots {
  display: inline-flex;
  gap: 4px;
}

.matur-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #d1d5db;
  animation: matur-bounce 1s infinite ease-in-out;
}

.matur-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}
.matur-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes matur-bounce {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* ===================================================================
   FOOTER / INPUT
   =================================================================== */

#matur-ai-footer {
  border-top: 1px solid var(--m-border);
  background: #ffffff;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.matur-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.matur-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--m-border);
  background: var(--m-gray-bg);
}

.matur-input-icon {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.matur-input-icon:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.matur-input-icon img {
  width: 20px;
  height: 20px;
  display: block;
}

#matur-ai-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--m-text-main);
}

#matur-ai-input::placeholder {
  color: #9ca3af;
}

/* SEND BUTTON */

#matur-ai-send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--m-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(63, 95, 190, 0.45);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

#matur-ai-send img {
  width: 20px;
  height: 20px;
  display: block;
}

#matur-ai-send:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 14px 36px rgba(63, 95, 190, 0.7);
}

#matur-ai-send:disabled {
  background: #e5e7eb;
  cursor: default;
  box-shadow: none;
  filter: none;
}

/* Powered by */

.matur-footer-meta {
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
}

.matur-footer-meta span {
  font-weight: 500;
  color: #4b5563;
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */

@media (max-width: 640px) {
  #matur-ai-chat {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 92px;
    max-height: calc(100vh - 110px);
  }

  #matur-ai-bubble {
    bottom: 18px;
    right: 18px;
  }
}
