/* Nirogyam AI assistant (n8n) — launcher, chat panel, teaser band */
.ai-spark { display: inline-block; color: var(--gold); animation: sparkle 2.4s ease-in-out infinite; }
@keyframes sparkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.25) rotate(20deg); } }
.btn-gold { background: var(--gold); color: var(--ink); box-shadow: 0 12px 30px -12px rgba(242,183,31,.8); }
.btn-gold:hover { transform: translateY(-2px); background: #ffc93a; }
.btn-gold .ai-spark { color: var(--navy); }

/* desktop launcher */
.ai-fab { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px 12px 14px; border-radius: 99px; background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 14px 30px -10px rgba(22,51,122,.7); transition: transform .3s var(--ease); position: relative; }
.ai-fab:hover { transform: translateY(-2px) scale(1.03); }
.ai-fab .ai-spark { font-size: 18px; }
.ai-fab::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; border: 2px solid rgba(63,163,224,.5); animation: ripple 2.6s ease-out infinite; pointer-events: none; }

/* mobile bar gets a 4th slot */
.mobile-bar a.ai { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; }
.mobile-bar a.ai svg { color: var(--gold); }
.mobile-bar a.wa { background: var(--sky-soft); color: var(--navy); }

/* panel */
.ai-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(14,27,61,.35); opacity: 0; pointer-events: none; transition: opacity .35s; }
.ai-backdrop.show { opacity: 1; pointer-events: auto; }
.ai-panel {
  position: fixed; z-index: 90; right: 22px; bottom: 22px; width: min(400px, calc(100vw - 32px)); height: min(640px, calc(100vh - 44px));
  background: #fff; border-radius: 24px; box-shadow: 0 30px 80px -20px rgba(14,27,61,.55); display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(20px) scale(.96); transform-origin: bottom right; pointer-events: none; visibility: hidden;
  transition: opacity .3s, transform .45s var(--ease), visibility .45s;
}
.ai-panel.show { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }
body.ai-open .float-stack, body.ai-open .mobile-bar { opacity: 0; pointer-events: none; }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px; background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; }
.ai-avatar { position: relative; width: 42px; height: 42px; flex: none; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.ai-avatar img { width: 32px; height: auto; }
.ai-online { position: absolute; right: 0; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: #5ff59a; border: 2px solid var(--navy); }
.ai-title { flex: 1; line-height: 1.25; min-width: 0; }
.ai-title b { display: block; font-size: 16px; }
.ai-title small { font-size: 12.5px; opacity: .8; }
.ai-close, .ai-reset { width: 38px; height: 38px; border-radius: 50%; font-size: 22px; line-height: 1; color: #fff; background: rgba(255,255,255,.12); flex: none; transition: background .25s; }
.ai-reset { font-size: 18px; }
.ai-close:hover, .ai-reset:hover { background: rgba(255,255,255,.24); }
.ai-msgs { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-alt); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.ai-msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.5; white-space: pre-line; word-break: break-word; animation: msgIn .35s var(--ease); }
.ai-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-top-left-radius: 6px; }
.ai-msg.me { align-self: flex-end; background: var(--navy); color: #fff; border-top-right-radius: 6px; }
.ai-msgs { position: relative; }

/* structured answers */
.ai-msg.rich { white-space: normal; max-width: 92%; padding: 12px 14px; }
.ai-msg.rich p { margin: 0 0 8px; }
.ai-msg.rich p:last-child, .ai-msg.rich ul:last-child, .ai-msg.rich ol:last-child, .ai-msg.rich .ai-table:last-child { margin-bottom: 0; }
.ai-msg.rich strong { color: var(--navy); font-weight: 800; }
.ai-msg.rich ul, .ai-msg.rich ol { margin: 4px 0 10px; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: n; }
.ai-msg.rich li { position: relative; padding: 8px 10px 8px 34px; background: var(--bg-alt); border-radius: 12px; line-height: 1.45; }
.ai-msg.rich ul li::before { content: ""; position: absolute; left: 11px; top: 12px; width: 14px; height: 14px; border-radius: 50%; background: var(--sky-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f4aa8' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center/9px no-repeat; }
.ai-msg.rich ol li { counter-increment: n; }
.ai-msg.rich ol li::before { content: counter(n); position: absolute; left: 9px; top: 8px; width: 18px; height: 18px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.ai-msg.rich a { color: var(--navy-2); font-weight: 700; text-decoration: underline; text-decoration-color: rgba(31,74,168,.3); text-underline-offset: 3px; }
.ai-table { margin: 4px 0 10px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.ai-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ai-table th { background: var(--navy); color: #fff; text-align: left; font-weight: 700; padding: 8px 10px; white-space: nowrap; }
.ai-table td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.ai-table td:first-child { font-weight: 700; color: var(--navy); width: 34%; background: var(--bg-alt); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ai-typing { display: flex; gap: 5px; padding: 14px 16px; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa6c0; animation: typing 1.2s infinite; }
.ai-typing i:nth-child(2) { animation-delay: .15s; }
.ai-typing i:nth-child(3) { animation-delay: .3s; }
.ai-actions { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; animation: msgIn .35s var(--ease); }
.ai-act { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 12px; font-weight: 700; font-size: 14px; background: #fff; border: 1.5px solid var(--line); color: var(--navy); min-height: 44px; }
.ai-act.wa { background: var(--green); border-color: var(--green); color: #fff; }
.ai-act.danger { background: #e5484d; border-color: #e5484d; color: #fff; }
.ai-act.primary { background: var(--navy); border-color: var(--navy); color: #fff; justify-content: center; width: 100%; }
.ai-act[disabled] { opacity: .6; }
.ai-chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 14px; background: var(--bg-alt); scrollbar-width: none; flex: none; }
.ai-chips::-webkit-scrollbar { display: none; }
.ai-chips.hide { display: none; }
.ai-chip { flex: none; padding: 8px 13px; border-radius: 99px; background: #fff; border: 1.5px solid var(--line); font-weight: 700; font-size: 13.5px; color: var(--navy); transition: border-color .2s, background .2s; }
.ai-chip:hover { border-color: var(--navy-2); background: var(--sky-soft); }
.ai-input { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; flex: none; }
.ai-input textarea { flex: 1; resize: none; font: inherit; font-size: 16px; line-height: 1.4; border: 1.5px solid var(--line); border-radius: 16px; padding: 11px 14px; max-height: 110px; outline: none; transition: border-color .2s, box-shadow .2s; }
.ai-input textarea:focus { border-color: var(--navy-2); box-shadow: 0 0 0 4px rgba(63,163,224,.15); }
.ai-input button { width: 46px; height: 46px; flex: none; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; transition: transform .25s var(--ease), opacity .2s; }
.ai-input button:hover { transform: scale(1.06); }
.ai-input button[disabled] { opacity: .45; }
.ai-input button svg { width: 20px; height: 20px; margin-left: 2px; }
.ai-foot { margin: 0; padding: 0 14px 10px; font-size: 11.5px; color: var(--muted); text-align: center; background: #fff; flex: none; }
.ai-foot a { color: #c2361b; font-weight: 700; }

.ai-book { align-self: stretch; background: #fff; border: 1.5px solid var(--line); border-radius: 18px; padding: 14px; display: grid; gap: 10px; animation: msgIn .35s var(--ease); }
.ai-book.done { border-color: #bfe8cf; background: #f1fbf5; gap: 4px; font-size: 14.5px; }
.ai-book-t { font-size: 15px; color: var(--navy); }
.ai-book label { display: grid; gap: 4px; }
.ai-book label > span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.ai-book label small { font-weight: 600; }
.ai-book input, .ai-book select { font: inherit; font-size: 16px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; width: 100%; min-width: 0; outline: none; }
.ai-book input:focus, .ai-book select:focus { border-color: var(--navy-2); }
.ai-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.ai-err { margin: 0; color: #c2361b; font-weight: 700; font-size: 13px; }
.ai-err:empty { display: none; }

/* booking form additions */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.book-form .btn-wa { background: #fff; color: #157a43; border: 1.5px solid #bfe8cf; box-shadow: none; }
.book-form .btn-wa:hover { background: #f1fbf5; }
.form-success { background: #f1fbf5; border: 1.5px solid #bfe8cf; color: #157a43; border-radius: 14px; padding: 14px 16px; font-weight: 700; font-size: 15px; animation: msgIn .4s var(--ease); }
.btn.loading { opacity: .7; pointer-events: none; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--muted); line-height: 1.45; cursor: pointer; padding: 10px 12px; border-radius: 12px; border: 1.5px solid transparent; transition: border-color .25s, background .25s; }
.consent input, .ai-consent input { width: 20px; height: 20px; flex: none; margin: 1px 0 0; accent-color: var(--navy); cursor: pointer; }
.consent a, .ai-consent a, .form-hint a, .ai-foot a + a { color: var(--navy-2); font-weight: 700; }
.consent.invalid { border-color: #e5484d; background: #fff4f4; animation: shake .4s; }
.ai-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); line-height: 1.4; cursor: pointer; }

/* teaser band */
.ai-band { padding: 0 0 clamp(64px, 9vw, 110px); background: linear-gradient(180deg, #fff, var(--bg-alt)); }
.ai-band-box { position: relative; overflow: hidden; border-radius: 32px; padding: clamp(28px, 5vw, 56px); background: radial-gradient(600px 300px at 90% 0%, rgba(63,163,224,.45), transparent 60%), linear-gradient(135deg, #0e1b3d, var(--navy) 60%, var(--navy-2)); color: #fff; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.ai-band .eyebrow { background: rgba(255,255,255,.1); color: #fff; }
.ai-band .eyebrow::before { display: none; }
.ai-band h2 { font-size: clamp(28px, 4vw, 44px); line-height: 1.1; letter-spacing: -.03em; margin: 16px 0 12px; }
.ai-band h2 em { font-style: normal; color: var(--gold); }
.ai-band p { color: rgba(255,255,255,.78); margin: 0 0 20px; max-width: 520px; }
.ai-band-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.ai-band-chips button { padding: 9px 14px; border-radius: 99px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.22); color: #fff; font-weight: 700; font-size: 14px; transition: background .25s; }
.ai-band-chips button:hover { background: rgba(255,255,255,.18); }
.ai-band-demo { display: grid; gap: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: 22px; padding: 18px; }
.demo-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.45; opacity: 0; transform: translateY(10px); }
.demo-msg.me { justify-self: end; background: var(--gold); color: var(--ink); border-top-right-radius: 5px; font-weight: 600; }
.demo-msg.bot { justify-self: start; background: #fff; color: var(--ink); border-top-left-radius: 5px; }
.demo-card { justify-self: start; background: #e8f9ef; color: #157a43; font-weight: 700; font-size: 14px; padding: 10px 14px; border-radius: 14px; opacity: 0; transform: translateY(10px); }
.is-in .demo-msg, .is-in .demo-card { animation: demoIn .5s var(--ease) forwards; }
.is-in .demo-msg:nth-child(1) { animation-delay: .3s; }
.is-in .demo-msg:nth-child(2) { animation-delay: 1.1s; }
.is-in .demo-msg:nth-child(3) { animation-delay: 1.9s; }
.is-in .demo-card { animation-delay: 2.6s; }
@keyframes demoIn { to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .mobile-bar { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .mobile-bar a { font-size: 12px; padding: 9px 2px; }
  .ai-panel { inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; transform: translateY(40px); transform-origin: bottom center; }
  .ai-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  .ai-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  body.ai-open { overflow: hidden; }
  .ai-band-box { grid-template-columns: 1fr; gap: 28px; border-radius: 24px; }
  .ai-band .btn-gold { width: 100%; }
}
@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .ai-band-demo { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-msg, .demo-card { opacity: 1; transform: none; }
}
