/* ============================================================
   Kiosk — exhibition-booth screen. Touch-first, big type (18px+),
   deep red primary on warm surfaces (Stitch design language).
   ============================================================ */

.kiosk {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--surface);
  font-size: 18px;
}

/* ---------- Centered utility (loading / error) ---------- */

.kiosk-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.kiosk-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 5px solid var(--surface-highest);
  border-top-color: var(--primary);
  animation: kiosk-spin 0.9s linear infinite;
}

@keyframes kiosk-spin {
  to {
    transform: rotate(360deg);
  }
}

.kiosk-error-card {
  background: #fff;
  border: 1px solid var(--surface-highest);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 36px 44px;
  text-align: center;
  max-width: 520px;
  font-size: 20px;
}

.kiosk-error-card .btn {
  min-height: 56px;
  font-size: 18px;
  padding-inline: 32px;
}

/* ---------- Welcome ---------- */

.kiosk-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  background: linear-gradient(120deg, var(--primary), var(--primary-container));
  color: var(--on-primary);
  flex-shrink: 0;
}

.kiosk-topbar-brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.kiosk-topbar-event {
  font-size: 18px;
  font-weight: 600;
  opacity: 0.92;
  text-align: end;
}

.kiosk-welcome {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(24px, 5vh, 64px) 32px 32px;
  text-align: center;
}

.kiosk-welcome-title {
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 12px;
}

.kiosk-welcome-sub {
  font-size: clamp(19px, 2vw, 24px);
  color: var(--on-surface-variant);
  max-width: 780px;
  margin-bottom: clamp(20px, 4vh, 44px);
}

.kiosk-choose {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 18px;
}

.kiosk-lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  width: min(1040px, 100%);
  margin-bottom: 22px;
}

.kiosk-lang-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 96px;
  padding: 16px 12px;
  background: #fff;
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 120ms ease, background-color 120ms ease,
    transform 80ms ease;
}

.kiosk-lang-tile:hover {
  border-color: var(--primary-tint);
  background: var(--surface-low);
}

.kiosk-lang-tile:active {
  transform: scale(0.97);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.kiosk-lang-native {
  font-size: 24px;
  font-weight: 700;
  color: var(--on-surface);
  line-height: 1.25;
}

.kiosk-lang-name {
  font-size: 16px;
  color: var(--on-surface-variant);
}

.kiosk-lang-grid-small .kiosk-lang-tile {
  min-height: 76px;
}

.kiosk-lang-grid-small .kiosk-lang-native {
  font-size: 20px;
}

.kiosk-more-langs {
  font-size: 18px;
  padding: 12px 26px;
  margin-bottom: 22px;
}

/* ---------- Chat header ---------- */

.kiosk-chathead {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: linear-gradient(120deg, var(--primary), var(--primary-container));
  color: var(--on-primary);
  flex-shrink: 0;
}

.kiosk-chathead-title {
  flex: 1;
  font-size: 21px;
  font-weight: 800;
  margin: 0;
  color: var(--on-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kiosk-head-btn {
  min-height: 56px;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  color: var(--on-primary);
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms ease;
}

.kiosk-head-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.kiosk-lang-select {
  min-height: 56px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: #fff;
  color: var(--on-surface);
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  max-width: 220px;
}

/* .btn is 16px globally (shared with admin); the kiosk is read at a distance. */
.kiosk .btn {
  font-size: 18px;
}

/* ---------- Chat body ---------- */

.kiosk-chat {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  min-height: 0;
}

.kiosk-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.kiosk-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 24px clamp(20px, 4vw, 48px);
  scroll-behavior: smooth;
}

.kiosk .bubble {
  font-size: 19px;
  padding: 14px 18px;
}

.kiosk .bubble-row {
  margin-block: 8px;
}

.msg-content {
  white-space: pre-wrap;
}

/* Sources under an assistant answer */

.msg-sources {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(27, 28, 28, 0.14);
  font-size: 14px;
  color: var(--on-surface-variant);
}

.msg-sources-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 12px;
}

.msg-sources ul {
  margin: 6px 0 0;
  padding-inline-start: 20px;
}

.msg-sources li {
  margin-block: 2px;
}

/* Escalation card */

.escalate-card {
  max-width: 78%;
  margin: 2px 0 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border-inline-start: 5px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 17px;
  font-weight: 600;
  margin-inline-end: auto;
}

/* Guided topics */

.kiosk-topics {
  margin-top: 18px;
}

.kiosk-topics-label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.kiosk-topics-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-block: 10px;
}

.kiosk .chip {
  font-size: 17px;
  padding: 12px 22px;
  min-height: 52px;
}

/* Typing indicator */

.kiosk-typing {
  color: var(--on-surface-variant);
  font-style: italic;
}

.dots span {
  animation: kiosk-blink 1.2s infinite;
}

.dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes kiosk-blink {
  0%,
  80%,
  100% {
    opacity: 0.2;
  }
  40% {
    opacity: 1;
  }
}

/* Send error + retry */

.chat-error {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-block: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: #ffe1e1;
  color: var(--error);
  font-size: 18px;
  max-width: 78%;
}

/* Input bar */

.kiosk-inputbar {
  display: flex;
  gap: 12px;
  padding: 16px clamp(20px, 4vw, 48px) 8px;
  border-top: 1px solid var(--surface-highest);
  background: var(--surface-low);
  flex-shrink: 0;
}

.kiosk-input {
  flex: 1;
  min-height: 60px;
  padding: 12px 20px;
  border: 2px solid var(--outline);
  border-radius: var(--radius);
  background: #fff;
  color: var(--on-surface);
  font-family: inherit;
  font-size: 20px;
}

.kiosk-input::placeholder {
  color: var(--outline);
}

.kiosk-input:focus {
  border-color: var(--primary);
  outline: 3px solid var(--primary-soft);
}

/* Same specificity as the .kiosk .btn override above, so 19px still wins. */
.kiosk .kiosk-send {
  min-height: 60px;
  min-width: 120px;
  font-size: 19px;
}

/* Disclaimer footer */

.kiosk-foot {
  padding: 8px 24px 14px;
  background: var(--surface-low);
  color: var(--on-surface-variant);
  font-size: 16px;
  text-align: center;
  flex-shrink: 0;
}

.kiosk-welcome ~ .kiosk-foot {
  background: var(--surface);
}

/* ---------- QR side panel ---------- */

.kiosk-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px 24px;
  background: #fff;
  border-inline-start: 1px solid var(--surface-highest);
  text-align: center;
  overflow-y: auto;
}

.kiosk-qr-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--primary);
  margin: 0;
}

.kiosk-qr-img {
  width: min(240px, 80%);
  aspect-ratio: 1;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
}

.kiosk-qr-hint {
  font-size: 18px;
  color: var(--on-surface-variant);
  margin: 0;
  max-width: 260px;
}

/* ---------- Narrow screens: QR panel drops to the bottom ---------- */

@media (max-width: 920px) {
  .kiosk-chat {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .kiosk-qr {
    flex-direction: row;
    justify-content: flex-start;
    text-align: start;
    gap: 18px;
    padding: 14px 20px;
    border-inline-start: none;
    border-top: 1px solid var(--surface-highest);
  }

  .kiosk-qr-img {
    width: 108px;
    flex-shrink: 0;
    padding: 5px;
  }

  .kiosk-qr-title {
    font-size: 18px;
  }

  .kiosk-qr-hint {
    font-size: 16px;
  }

  .kiosk-topbar-event {
    font-size: 15px;
  }

  .kiosk-chathead {
    flex-wrap: wrap;
  }

  .kiosk-chathead-title {
    order: -1;
    flex-basis: 100%;
    white-space: normal;
  }
}

