/* core/assistant-widget.css , globális AI-asszisztens widget (FAB + drawer).
   Globálisan töltődik (index.html), nem modul-CSS. Mobil-finomhangolás a végén media query-vel. */

.aiw-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
}

/* lebegő gomb */
.aiw-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 20px rgba(16, 24, 40, 0.22);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.14s,
    box-shadow 0.14s,
    background 0.14s;
}
.aiw-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(16, 24, 40, 0.28);
  background: var(--primary-dark);
}
.aiw-fab svg {
  width: 24px;
  height: 24px;
}
.aiw-fab.is-open {
  transform: scale(0.92);
}

/* drawer , a gomb fölött */
.aiw-drawer {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: min(72vh, 620px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(16, 24, 40, 0.24);
  overflow: hidden;
  animation: aiw-pop 0.14s ease-out;
}
/* a [hidden] attribútumot a class display-e felülírná → explicit elrejtés zárt állapotban */
.aiw-drawer[hidden] {
  display: none;
}
@keyframes aiw-pop {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.aiw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.aiw-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 14.5px;
}
.aiw-title svg {
  width: 17px;
  height: 17px;
  color: var(--primary);
}
.aiw-head-actions {
  display: flex;
  gap: 4px;
}
.aiw-iconbtn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.aiw-iconbtn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.aiw-iconbtn svg {
  width: 16px;
  height: 16px;
}

/* chat-terület */
.aiw-chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--bg-secondary);
}
.aiw-welcome {
  margin: auto;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}
.aiw-welcome-ic {
  width: 42px;
  height: 42px;
  margin: 0 auto 10px;
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-tint);
  color: var(--primary);
}
.aiw-welcome p {
  margin: 0 0 12px;
}
.aiw-example {
  display: block;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  margin-bottom: 7px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
}
.aiw-example:hover {
  border-color: var(--primary);
  color: var(--text-primary);
}

.aiw-msg {
  display: flex;
  max-width: 85%;
}
.aiw-msg.is-user {
  align-self: flex-end;
}
.aiw-msg.is-assistant {
  align-self: flex-start;
}
.aiw-bubble {
  padding: 9px 13px;
  border-radius: 13px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}
.aiw-msg.is-user .aiw-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.aiw-msg.is-assistant .aiw-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.aiw-note {
  align-self: center;
  font-size: 12px;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 10%, transparent);
  border-radius: 999px;
  padding: 4px 11px;
}
.aiw-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.aiw-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: aiw-blink 1.2s infinite ease-in-out both;
}
.aiw-typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.aiw-typing span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes aiw-blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

/* bevitel */
.aiw-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
}
.aiw-text {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.4;
  background: var(--bg-card);
  color: var(--text-primary);
  max-height: 120px;
}
.aiw-text:focus {
  outline: none;
  border-color: var(--primary);
}
.aiw-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.aiw-send:hover {
  background: var(--primary-dark);
}
.aiw-send:disabled {
  opacity: 0.5;
  cursor: default;
}
.aiw-send svg {
  width: 18px;
  height: 18px;
}

/* mikrofon-gomb */
.aiw-mic {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.aiw-mic:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.aiw-mic svg {
  width: 18px;
  height: 18px;
}
.aiw-mic.is-recording {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
  animation: aiw-rec 1.1s infinite;
}
@keyframes aiw-rec {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--error) 55%, transparent);
  }
  50% {
    box-shadow: 0 0 0 6px transparent;
  }
}

/* ===== MOBIL , a drawer szinte teljes képernyő ===== */
@media (max-width: 768px) {
  .aiw-root {
    right: 16px;
    bottom: 16px;
  }
  .aiw-drawer {
    width: calc(100vw - 24px);
    height: min(78vh, 600px);
    bottom: 70px;
  }
}
