/* 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 , teljes magasságú, JOBBRÓL BEÚSZÓ slide-over panel (mint a modalok);
   nincs sötét háttér-fátyol → az app közben használható marad (referencia-panel). */
.aiw-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  border-radius: 16px 0 0 16px;
  box-shadow: -18px 0 48px rgba(16, 24, 40, 0.18);
  overflow: hidden;
  animation: aiw-slidein 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
/* a [hidden] attribútumot a class display-e felülírná → explicit elrejtés zárt állapotban */
.aiw-drawer[hidden] {
  display: none;
}
@keyframes aiw-slidein {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(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;
}
/* 🔊 felolvasás bekapcsolva , kiemelt állapot */
.aiw-speak.is-on {
  color: var(--primary);
  background: var(--bg-secondary);
}

/* 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;
  max-width: 340px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14.5px;
  padding: 8px 4px;
}
.aiw-welcome-ic {
  width: 50px;
  height: 50px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-tint);
  color: var(--primary);
}
.aiw-welcome-ic svg {
  width: 25px;
  height: 25px;
}
.aiw-welcome-lead {
  margin: 0 0 16px;
  line-height: 1.55;
}
/* „Feladat egy mondatból" tipp-kártya, bal-igazított pipás listával */
.aiw-tipcard {
  text-align: left;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.aiw-tipcard-h {
  font-family: 'Sora', system-ui, sans-serif;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 9px;
}
.aiw-tiplist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.aiw-tiplist li {
  position: relative;
  padding-left: 22px;
  font-size: 14px;
  color: var(--text-secondary);
}
.aiw-tiplist li::before {
  content: '✓';
  position: absolute;
  left: 2px;
  top: -1px;
  color: var(--primary);
  font-weight: 700;
}
.aiw-tiplist b {
  color: var(--text-primary);
}
.aiw-sample {
  font-size: 14.5px;
  color: var(--text-secondary);
  font-style: italic;
  text-align: left;
  line-height: 1.55;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 13px;
}

.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: 14.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: 14.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;
  }
}

/* „Diktálás" sáv , desktopon rejtve (ott az in-row mic marad); mobilon teljes-szélességű gomb (lásd media query) */
.aiw-dictate {
  display: none;
}

/* ===== MOBIL , a beszélgetés TELJES KÉPERNYŐS (full-screen) ===== */
@media (max-width: 768px) {
  .aiw-drawer {
    position: fixed;
    inset: 0;
    width: auto;
    max-width: none;
    height: auto;
    border: none;
    border-radius: 0;
    animation: none; /* full-screennél a felugrás-animáció zavaró */
  }
  /* nagyobb fejléc-tap-targetek + biztonságos felső térköz (notch) */
  .aiw-head {
    padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
  }
  .aiw-iconbtn {
    width: 38px;
    height: 38px;
  }
  /* a beviteli terület fölötti elválasztó a wrapre kerül (a Diktálás-gomb így „lebeg" benne) */
  .aiw-inputwrap {
    border-top: 1px solid var(--border);
  }
  .aiw-input {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    border-top: none;
  }
  /* MOBIL: az in-row mic helyett egy jól látható „Itt tudsz diktálni" GOMB az input fölött (az egész gomb).
     A küldés a megszokott helyén marad (a beviteli sorban, jobbra). */
  .aiw-mic {
    display: none;
  }
  .aiw-dictate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 15px 16px;
    border: none;
    border-radius: 0;
    background: var(--primary-tint);
    color: var(--primary-dark);
    font: inherit;
    font-size: 15.5px;
    font-weight: 700;
    cursor: pointer;
  }
  .aiw-dictate svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
    flex: 0 0 auto;
  }
  .aiw-dictate:active {
    background: color-mix(in srgb, var(--primary) 20%, transparent);
  }
  .aiw-dictate.is-recording {
    background: color-mix(in srgb, var(--error) 14%, transparent);
    border-color: color-mix(in srgb, var(--error) 40%, transparent);
    color: var(--error);
  }
  .aiw-dictate.is-recording svg {
    color: var(--error);
  }
}

/* Fejléc-indító (AI-asszisztens) , kitöltött narancs „pasztilla", hogy feltűnjön a többi
   szürke ikon közül; ugyanakkora a helye (38px), csak a háttér + nagyobb ikon emeli ki. */
.app-header-assistant {
  color: var(--primary);
  background: var(--primary-tint);
}
.app-header-assistant svg {
  width: 21px;
  height: 21px;
}
.app-header-assistant:hover {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  color: var(--primary-dark);
}
.app-header-assistant.is-open {
  background: var(--primary);
  color: #fff;
}
