:root {
  --navy: #212D60;
  --navy-soft: #34427f;
  --red: #C8102E;
  --gold: #D4AF37;
  --white: #ffffff;
  --sky-top: #dcebfa;
  --sky-bottom: #f5f9fe;
  --paper: #ffffff;
  --line: #d6dfee;
  --text: #1b2340;
  --muted: #5d6789;
  --shadow: 0 4px 14px rgba(33, 45, 96, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--sky-bottom);
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  background: var(--white);
  box-shadow: 0 0 40px rgba(33, 45, 96, 0.08);
}

/* ---------- Zaglavlje ---------- */
.header {
  position: relative;
  background: var(--navy);
  color: var(--white);
  padding: 14px 16px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--gold);
  transform: rotate(45deg);
}

.header-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.flight-path {
  display: block;
  width: 100%;
  height: 28px;
  margin-top: 6px;
}

.flight-path-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 1.6;
  stroke-dasharray: 5 6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  animation: dash-move 1.6s linear infinite;
}

.flight-path-dot { fill: var(--gold); }
.flight-path-plane { fill: var(--gold); }

@keyframes dash-move {
  to { stroke-dashoffset: -22; }
}

.accent-line {
  height: 3px;
  margin: 0 -16px;
  background: linear-gradient(90deg, var(--red) 0 38%, var(--gold) 38% 100%);
}

/* ---------- Nebo i oblaci ---------- */
.sky {
  position: relative;
  flex: 1;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%);
  scroll-behavior: smooth;
}

.clouds {
  position: sticky;
  top: 0;
  height: 0;
  pointer-events: none;
  z-index: 0;
}

.cloud {
  position: absolute;
  display: block;
  width: 120px; height: 36px;
  border-radius: 40px;
  background: rgba(255, 255, 255, 0.75);
  filter: blur(0.3px);
  animation: drift 40s linear infinite alternate;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}

.cloud::before { width: 54px; height: 54px; left: 16px; top: -26px; }
.cloud::after  { width: 40px; height: 40px; left: 60px; top: -18px; }

.cloud-1 { top: 36px; left: 6%; }
.cloud-2 { top: 150px; right: 4%; transform: scale(0.7); opacity: 0.8; animation-duration: 55s; }
.cloud-3 { top: 300px; left: 38%; transform: scale(0.5); opacity: 0.6; animation-duration: 70s; }

@keyframes drift {
  from { translate: -12px 0; }
  to   { translate: 18px 0; }
}

/* ---------- Poruke ---------- */
.messages {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 16px 20px;
}

.msg {
  max-width: 86%;
  line-height: 1.45;
  font-size: 0.97rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: msg-in 220ms ease-out;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.msg-user {
  align-self: flex-end;
  background: var(--navy);
  color: var(--white);
  padding: 10px 14px;
  border-radius: var(--radius) var(--radius) 6px var(--radius);
  box-shadow: var(--shadow);
}

/* Poruka asistenta kao karta za ukrcavanje */
.msg-bot {
  align-self: flex-start;
  display: grid;
  grid-template-columns: 38px 1fr;
  background: var(--paper);
  border-radius: 14px;
  box-shadow: var(--shadow);
  -webkit-mask:
    radial-gradient(circle 7px at 38px 0, #0000 98%, #000) top / 100% 51% no-repeat,
    radial-gradient(circle 7px at 38px 100%, #0000 98%, #000) bottom / 100% 51% no-repeat;
  mask:
    radial-gradient(circle 7px at 38px 0, #0000 98%, #000) top / 100% 51% no-repeat,
    radial-gradient(circle 7px at 38px 100%, #0000 98%, #000) bottom / 100% 51% no-repeat;
}

.ticket-stub {
  display: grid;
  place-items: center;
  border-right: 2px dashed var(--line);
  color: var(--navy);
  background: linear-gradient(180deg, #f3f6fc, #e9eef8);
  border-radius: 14px 0 0 14px;
}

.ticket-stub svg { transform: rotate(90deg); opacity: 0.85; }

.ticket-body {
  padding: 10px 14px 12px;
  min-width: 0;
}

.ticket-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
}

.ticket-text { display: block; color: var(--text); }

.msg-welcome .ticket-label { color: var(--gold); }
.msg-welcome .ticket-title {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 2px;
}

.msg-demo .ticket-label { color: var(--muted); }

.typing .ticket-text { color: var(--muted); font-style: italic; }

.typing-dots { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: middle; }
.typing-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--navy-soft);
  animation: blink 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* ---------- Unos i brza pitanja ---------- */
.composer {
  border-top: 1px solid var(--line);
  background: var(--white);
  padding: 10px 12px 12px;
}

.quick {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
}

.quick-btn {
  flex: none;
  font: inherit;
  font-size: 0.85rem;
  color: var(--navy);
  background: #eef3fb;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.quick-btn:hover:not(:disabled) { background: #e2eaf8; border-color: var(--gold); }

.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #f8fafe;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(33, 45, 96, 0.12);
  background: var(--white);
}

.send-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(200, 16, 46, 0.3);
  transition: background 0.15s, transform 0.15s;
}

.send-btn:hover:not(:disabled) { background: #a90d26; }
.send-btn:active:not(:disabled) { transform: scale(0.95); }

.send-plane { transform: rotate(-45deg) translate(1px, 1px); }

.send-btn.is-flying .send-plane {
  animation: plane-takeoff 600ms cubic-bezier(0.5, 0, 0.75, 0) forwards;
}

.send-btn.is-landing .send-plane {
  animation: plane-land 350ms ease-out;
}

@keyframes plane-takeoff {
  0%   { transform: rotate(-45deg) translate(1px, 1px); opacity: 1; }
  100% { transform: translate(14px, -44px) rotate(-45deg); opacity: 0; }
}

@keyframes plane-land {
  0%   { transform: translate(-14px, 30px) rotate(-45deg); opacity: 0; }
  100% { transform: rotate(-45deg) translate(1px, 1px); opacity: 1; }
}

button:disabled,
.input:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.send-btn.is-flying:disabled { opacity: 1; }

button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Podnožje ---------- */
.footer {
  flex: none;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: center;
  color: var(--muted);
  background: #f3f6fc;
  border-top: 1px solid var(--line);
}

@media (min-width: 640px) {
  .header-title { font-size: 1.2rem; }
  .messages { padding: 24px 24px; }
  .msg { max-width: 75%; }
  .quick { flex-wrap: wrap; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
