/* „Mit olvassak?” AI könyvajánló + „Kérdezz a könyvről”. */

.cser-ai-spark {
  width: 18px;
  height: 18px;
  fill: #c7861b;
  flex: 0 0 auto;
}

/* ---------- Desktop header pill ---------- */
.cser-ai-header-btn {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 12px;
  border: 1.5px solid var(--brand-teal);
  border-radius: 999px;
  background: #fff;
  color: var(--text-main);
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.cser-ai-header-btn:hover {
  background: var(--brand-teal-subtle);
}

.cser-ai-header-btn:focus-visible {
  outline: 2px solid var(--brand-teal);
  outline-offset: 2px;
}

.cser-ai-header-btn__label {
  color: var(--brand-teal);
  font-family: var(--font-title);
  font-weight: 700;
  white-space: nowrap;
}

.cser-ai-header-btn__hint {
  min-width: 0;
  overflow: hidden;
  color: rgba(25, 35, 33, 0.6);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .cser-ai-header-btn {
    display: none;
  }

  /* No tab bar: keep a compact entry in the header. */
  body:not(.cser-has-tabbar) .cser-ai-header-btn {
    display: flex;
    grid-row: 3;
    grid-column: 1 / -1;
    margin-top: 6px;
  }
}

/* ---------- Tab bar centre item ---------- */
.cser-tabbar__item--ai {
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
  color: var(--app-teal, #14777a) !important;
}

.cser-tabbar__ai {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--app-teal, #14777a);
}

.cser-tabbar__ai .cser-ai-spark {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ---------- Panel ---------- */
.cser-ai-scrim {
  position: fixed;
  inset: 0;
  z-index: 9997;
  background: rgba(16, 28, 27, 0.38);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.cser-ai-scrim.is-visible {
  opacity: 1;
}

.cser-ai-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9998;
  display: flex;
  width: min(460px, 100%);
  flex-direction: column;
  background: #fff;
  box-shadow: var(--app-shadow-float, 0 18px 50px -12px rgba(25, 35, 33, 0.32));
  color: var(--text-main);
  transform: translateX(104%);
  transition: transform 0.28s var(--app-ease, ease);
}

.cser-ai-panel.is-open {
  transform: none;
}

body.is-ajanlo-open {
  overflow: hidden;
}

.cser-ai-panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 18px;
  border-bottom: 1px solid var(--app-line, rgba(25, 35, 33, 0.12));
}

.cser-ai-panel__head h2 {
  flex: 1 1 auto;
  margin: 0;
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 600;
}

.cser-ai-reset {
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--brand-teal);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.cser-ai-chat {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cser-ai-bot {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cser-ai-bubble {
  max-width: 94%;
  margin: 0;
  padding: 10px 14px;
  border-radius: 16px 16px 16px 4px;
  background: var(--brand-teal-subtle);
  font-size: 0.92rem;
  line-height: 1.5;
}

.cser-ai-me {
  align-self: flex-end;
  max-width: 85%;
  margin: 0;
  padding: 9px 14px;
  border-radius: 16px 16px 4px 16px;
  background: var(--brand-teal);
  color: #fff;
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cser-ai-question {
  margin: 0;
  color: rgba(25, 35, 33, 0.72);
  font-size: 0.88rem;
}

.cser-ai-note {
  margin: 0;
  color: rgba(25, 35, 33, 0.62);
  font-size: 0.8rem;
}

.cser-ai-note--error {
  padding: 8px 12px;
  border-radius: 10px;
  background: #fbefec;
  color: #8a3b2c;
}

.cser-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cser-ai-chip {
  padding: 7px 12px;
  border: 1px solid var(--brand-teal);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-teal);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.cser-ai-chip:hover,
.cser-ai-chip--solid {
  background: var(--brand-teal);
  color: #fff;
}

.cser-ai-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--app-line, rgba(25, 35, 33, 0.12));
  border-radius: 12px;
  background: #fff;
}

.cser-ai-card__cover img {
  display: block;
  width: 68px;
  height: 100px;
  border-radius: 3px;
  background: #f1efe9;
  object-fit: cover;
}

.cser-ai-card__body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.cser-ai-card__title {
  color: var(--text-main);
  font-family: var(--font-title);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

.cser-ai-card__title:hover {
  color: var(--brand-teal);
}

.cser-ai-card__author {
  color: rgba(25, 35, 33, 0.6);
  font-size: 0.78rem;
}

.cser-ai-card__why {
  margin: 2px 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
}

.cser-ai-card__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.cser-ai-card__price {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cser-ai-card__price s {
  margin-left: 4px;
  color: rgba(25, 35, 33, 0.5);
  font-size: 0.78rem;
  font-weight: 400;
}

.cser-ai-card__badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-teal-light);
  color: var(--brand-teal);
  font-size: 0.72rem;
  font-weight: 700;
}

.cser-ai-add {
  margin-left: auto;
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-teal);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.cser-ai-add.is-busy {
  opacity: 0.6;
  cursor: progress;
}

.cser-ai-add.is-done {
  background: var(--brand-teal-light);
  color: var(--brand-teal);
}

.cser-ai-typing {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(25, 35, 33, 0.6);
  font-size: 0.85rem;
}

.cser-ai-dots {
  display: inline-flex;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--brand-teal-subtle);
}

.cser-ai-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-teal);
  animation: cser-ai-blink 1s infinite;
}

.cser-ai-dots i:nth-child(2) { animation-delay: 0.15s; }
.cser-ai-dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes cser-ai-blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.cser-ai-compose,
.cser-ai-book__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.cser-ai-compose {
  padding: 12px 18px 6px;
  border-top: 1px solid var(--app-line, rgba(25, 35, 33, 0.12));
}

.cser-ai-compose textarea,
.cser-ai-book__form input {
  min-width: 0;
  flex: 1 1 auto;
  min-height: 44px;
  padding: 10px 14px;
  border: 1.5px solid rgba(25, 35, 33, 0.18);
  border-radius: 22px;
  background: #fff;
  color: var(--text-main);
  font: inherit;
  font-size: 1rem;
  line-height: 1.35;
  resize: none;
}

.cser-ai-compose textarea {
  height: 44px;
  overflow: hidden;
}

.cser-ai-compose textarea::placeholder {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cser-ai-compose textarea:focus,
.cser-ai-book__form input:focus {
  border-color: var(--brand-teal);
  outline: 0;
}

.cser-ai-send {
  flex: 0 0 auto;
  letter-spacing: normal;
  text-transform: none;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 22px;
  background: var(--brand-teal);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.is-busy .cser-ai-send {
  opacity: 0.55;
  pointer-events: none;
}

.cser-ai-foot {
  margin: 0;
  padding: 4px 18px 12px;
  color: rgba(25, 35, 33, 0.55);
  font-size: 0.72rem;
  line-height: 1.4;
}

.cser-ai-foot a {
  color: inherit;
}

@media (max-width: 900px) {
  .cser-ai-panel {
    top: auto;
    left: 0;
    width: 100%;
    height: min(88vh, 88dvh);
    border-radius: var(--app-sheet-radius, 16px) var(--app-sheet-radius, 16px) 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(104%);
  }

  .cser-ai-panel .cser-sheet-handle {
    position: absolute;
    top: 6px;
    left: 50%;
    display: block;
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: rgba(25, 35, 33, 0.18);
    transform: translateX(-50%);
  }

  .cser-ai-panel__head {
    position: relative;
    padding-top: 16px;
  }
}

/* ---------- „Kérdezz a könyvről” ---------- */
.cser-ai-book {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid rgba(25, 35, 33, 0.16);
  border-radius: 12px;
  background: #fbf7f1; /* same as the purchase panel */
}

.cser-ai-book__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 600;
}

.cser-ai-book__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cser-ai-book__chips .cser-ai-chip {
  font-weight: 500;
}

.cser-ai-book__log {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cser-ai-book__log:empty {
  display: none;
}

.cser-ai-book .cser-ai-bubble {
  background: #fff;
}

.cser-ai-book .cser-ai-foot {
  padding: 0;
}

@media (prefers-reduced-motion: reduce) {
  .cser-ai-panel,
  .cser-ai-scrim {
    transition: none;
  }

  .cser-ai-dots i {
    animation: none;
    opacity: 0.6;
  }
}

/* Theme-wide button and icon rules win otherwise. */
.cser-ai-panel .cser-ai-send,
.cser-ai-book .cser-ai-send {
  border-radius: 22px !important;
  font-family: var(--font-body) !important;
  font-size: 0.9rem !important;
  letter-spacing: normal !important;
  text-transform: none !important;
}

svg.cser-ai-spark,
.cser-tabbar__item .cser-tabbar__ai svg.cser-ai-spark {
  width: 18px;
  height: 18px;
  stroke: none;
  transform: none;
}

.cser-tabbar__item .cser-tabbar__ai svg.cser-ai-spark {
  fill: #fff;
}

/* WooCommerce adds a "View cart" link next to the button after an AJAX add. */
.cser-ai-card .added_to_cart {
  display: none !important;
}

/* Desktop: compact pill in one row with the search field (Andras 2026-11-20). */
@media (min-width: 1001px) {
  .header-utilities:has(.cser-ai-header-btn) {
    width: 430px;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
  }

  .header-utilities:has(.cser-ai-header-btn) .cser-ai-header-btn {
    grid-row: 1;
    grid-column: 1;
    width: auto;
    height: 32px;
    min-height: 0;
    padding: 0 12px;
    gap: 6px;
  }

  .header-utilities .cser-ai-header-btn .cser-ai-spark {
    width: 15px;
    height: 15px;
  }

  .header-utilities:has(.cser-ai-header-btn) .editorial-header-search {
    grid-row: 1;
    grid-column: 2;
  }

  .header-utilities:has(.cser-ai-header-btn) .header-actions {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  .header-utilities .cser-ai-header-btn__hint {
    display: none;
  }
}
