/* ============================================================
   Zetova AI — chat widget + dedicated page
   Uses the site's shared design tokens from style.css.
   ============================================================ */

:root {
  --za-user: var(--accent-grad);
  --za-radius: 18px;
}

/* Dedicated page hero — keep icon + title centered as one unit */
.za-hero-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 auto;
  max-width: 920px;
  text-align: left;
}
.za-hero-icon {
  flex: 0 0 auto;
  width: clamp(52px, 6vw, 68px);
  height: auto;
  border-radius: 18px;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
  display: block;
}
.za-hero-title h1 {
  font-size: clamp(26px, 4.4vw, 44px);
  font-weight: 800;
  margin: 0;
  line-height: 1.2;
  text-align: left;
  flex: 1 1 220px;
  max-width: 100%;
}
.za-hero-tag {
  font-weight: 700;
  color: var(--text);
  white-space: normal;
}
@media (max-width: 640px) {
  .za-hero-title {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  .za-hero-title h1 {
    text-align: center;
    flex-basis: auto;
  }
}

/* ---------- Shared chat shell ---------- */
.za-chat {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.za-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.za-scroll::-webkit-scrollbar { width: 9px; }
.za-scroll::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 8px; }

/* ---------- Messages ---------- */
.za-msg {
  max-width: 86%;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: za-pop .22s ease;
}
.za-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.za-avatar {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
  color: #fff;
  background: var(--accent-grad);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
}
.za-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.za-msg.user .za-avatar { background: linear-gradient(135deg, #34c759, #0a84ff); }
.za-bubble {
  padding: 11px 14px;
  border-radius: var(--za-radius);
  line-height: 1.55;
  font-size: 14.5px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.za-msg.bot .za-bubble {
  background: var(--glass-fill-strong);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-top-left-radius: 6px;
  color: var(--text);
}
.za-msg.user .za-bubble {
  background: var(--accent-grad);
  color: #fff;
  border-top-right-radius: 6px;
  box-shadow: 0 8px 22px rgba(10, 132, 255, .32);
}

/* Markdown bits inside bubbles */
.za-bubble p { margin: 0 0 8px; }
.za-bubble p:last-child { margin-bottom: 0; }
.za-bubble ul, .za-bubble ol { margin: 6px 0 8px; padding-left: 20px; }
.za-bubble li { margin: 2px 0; }
.za-bubble h3, .za-bubble h4 { margin: 10px 0 4px; font-size: 15px; font-weight: 700; }
.za-bubble h3:first-child, .za-bubble h4:first-child { margin-top: 0; }
.za-bubble strong { font-weight: 700; }
.za-bubble a { color: var(--accent); text-decoration: underline; }
.za-msg.user .za-bubble a { color: #fff; }
.za-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: rgba(120,120,140,.16);
  padding: 1px 5px; border-radius: 6px;
}

/* ---------- Flight cards ---------- */
.za-flights { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.za-flight {
  border: 1px solid var(--glass-border);
  background: var(--glass-fill-soft);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.za-flight-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.za-flight-price { font-weight: 800; font-size: 15px; color: var(--accent); }
.za-flight-tag { font-size: 11.5px; color: var(--text-soft); }
.za-flight-leg { font-size: 12.5px; color: var(--text-soft); margin-top: 3px; }
.za-flight-leg strong { color: var(--text); font-weight: 600; }

/* ---------- Itinerary builder CTA ---------- */
.za-itinerary-cta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.za-itinerary-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--glass-bg) 70%, transparent);
  border: 1px solid var(--glass-border);
}
.za-itinerary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.za-itinerary-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text);
  background: var(--accent-grad-soft);
}
.za-itinerary-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.za-itinerary-rows li {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  font-size: 12px;
  line-height: 1.35;
}
.za-itinerary-row-label {
  color: var(--text-soft);
  font-weight: 600;
}
.za-itinerary-row-value { color: var(--text); word-break: break-word; }
.za-itinerary-preview-note {
  margin: 0;
  font-size: 11px;
  color: var(--text-soft);
  line-height: 1.4;
}
.za-itinerary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  background: var(--accent-grad);
  cursor: pointer;
  box-shadow: var(--glass-shadow);
  transition: transform .15s ease, filter .15s ease;
}
.za-itinerary-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.za-itinerary-btn svg { width: 16px; height: 16px; flex: none; }
.za-itinerary-note {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-soft);
  line-height: 1.4;
}
.za-chip-template {
  border-style: dashed;
  font-weight: 650;
}
.za-template-btn {
  flex: none;
  align-self: flex-end;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-soft);
  border-radius: 999px;
  padding: 8px 10px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.za-template-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-grad-soft);
}

/* ---------- Owner unlock dialog ---------- */
.za-owner-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 12, 24, .45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: za-pop .18s ease both;
}
.za-owner-card {
  width: min(360px, 100%);
  padding: 20px 20px 16px;
  border-radius: 18px;
  background: var(--glass-fill-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  color: var(--text);
}
.za-owner-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 750;
}
.za-owner-lead {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-soft);
}
.za-owner-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-soft);
}
.za-owner-field input {
  border: 1px solid var(--glass-border);
  background: var(--glass-fill);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
}
.za-owner-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10,132,255,.18);
}
.za-owner-err {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: #c0392b;
}
.za-owner-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.za-owner-btn {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--accent-grad);
  cursor: pointer;
}
.za-owner-btn:disabled { opacity: .55; cursor: not-allowed; }
.za-owner-btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--glass-border);
}
.za-owner-btn-ghost:hover { color: var(--text); }

/* ---------- Typing indicator ---------- */
.za-typing { display: inline-flex; gap: 5px; padding: 4px 2px; }
.za-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-soft);
  animation: za-blink 1.2s infinite ease-in-out both;
}
.za-typing span:nth-child(2) { animation-delay: .18s; }
.za-typing span:nth-child(3) { animation-delay: .36s; }

/* ---------- Suggestions ---------- */
.za-suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 12px; }
.za-chip {
  border: 1px solid var(--glass-border);
  background: var(--glass-fill-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
  transition: transform .15s, background .2s, box-shadow .2s;
  font-family: inherit;
}
.za-chip:hover { transform: translateY(-1px); background: var(--accent-grad-soft); box-shadow: var(--glass-shadow); }

/* ---------- Composer ---------- */
.za-composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 14px;
  border-top: 1px solid var(--divider);
  background: var(--glass-fill);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
}
.za-input {
  flex: 1 1 auto;
  resize: none;
  max-height: 140px;
  min-height: 24px;
  border: 1px solid var(--glass-border);
  background: var(--glass-fill-strong);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 13px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.za-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10,132,255,.18); }
.za-input::placeholder { color: var(--text-soft); }
.za-send {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border: none;
  border-radius: 13px;
  background: var(--accent-grad);
  color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .15s, box-shadow .2s, opacity .2s;
  box-shadow: 0 8px 22px rgba(10,132,255,.32);
}
.za-send:hover { transform: translateY(-2px) scale(1.04); }
.za-send:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.za-send svg { width: 20px; height: 20px; }

.za-foot-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-soft);
  padding: 0 14px 10px;
}

/* ---------- Floating bubble (all pages) ---------- */
.za-launcher {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 900;
  width: 60px; height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--accent-grad);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 12px 34px rgba(10,132,255,.45);
  transition: transform .2s, box-shadow .2s;
  animation: za-rise .4s ease;
}
.za-launcher:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 16px 40px rgba(10,132,255,.55); }
.za-launcher svg { width: 27px; height: 27px; }
.za-launcher img.za-open-icon {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid rgba(255,255,255,.55);
  box-sizing: border-box;
}
.za-launcher .za-close-icon { display: none; }
.za-launcher.open .za-open-icon { display: none; }
.za-launcher.open .za-close-icon { display: block; }
.za-launcher-badge {
  position: absolute;
  top: -3px; right: -3px;
  background: #d70040; color: #fff; /* 5.3:1 on white text (WCAG AA) */
  font-size: 9px; font-weight: 800;
  letter-spacing: .3px;
  padding: 2px 6px; border-radius: 999px;
  border: 2px solid var(--page-bg);
}

.za-panel {
  position: fixed;
  right: 20px; bottom: 92px;
  z-index: 900;
  width: min(400px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 130px));
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--glass-fill);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-hover);
  display: none;
  flex-direction: column;
  transform-origin: bottom right;
}
.za-panel.open { display: flex; animation: za-panel-in .24s cubic-bezier(.2,.8,.3,1); }

.za-head {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--divider);
  background: var(--glass-fill-strong);
}
.za-head-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent-grad);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 4px 14px rgba(10,132,255,.4);
  overflow: hidden;
}
.za-head-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.za-head-txt { display: flex; flex-direction: column; line-height: 1.25; }
.za-head-title { font-weight: 800; font-size: 15px; }
.za-head-sub { font-size: 11.5px; color: var(--text-soft); }
.za-head-sub .za-dot { color: #34c759; }
.za-head-actions { margin-left: auto; display: flex; gap: 4px; }
.za-icon-btn {
  width: 32px; height: 32px; border-radius: 9px;
  border: none; background: transparent; color: var(--text-soft);
  cursor: pointer; display: grid; place-items: center;
  transition: background .2s, color .2s;
  text-decoration: none; /* also used as <a> for the full-page link */
}
.za-icon-btn:hover { background: var(--glass-fill-soft); color: var(--text); }
.za-icon-btn svg { width: 17px; height: 17px; }

.za-panel .za-chat { flex: 1 1 auto; }

/* ---------- Dedicated page layout ---------- */
.za-page-shell {
  height: min(72vh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.za-page-shell .za-scroll { padding: 22px clamp(16px, 4vw, 30px); }
.za-page-shell .za-msg { max-width: 78%; }
.za-page-shell .za-composer { padding: 14px clamp(16px, 4vw, 30px); }

/* ---------- Animations ---------- */
@keyframes za-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes za-rise { from { opacity: 0; transform: translateY(14px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes za-panel-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes za-blink { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .za-msg, .za-launcher, .za-panel.open { animation: none; }
}

@media (max-width: 520px) {
  .za-panel {
    right: 12px; left: 12px;
    width: auto;
    bottom: 84px;
    height: min(70vh, calc(100vh - 120px));
  }
  .za-launcher { right: 16px; bottom: 16px; }
}
