/* ==========================================================================
   Demo-only extras: preloader, demo notice (bottom-left), chatbot (bottom-right).
   Not part of the Elementor rebuild (see ELEMENTOR-NOTES.md section 6).
   ========================================================================== */

/* ---------- Preloader (first load per tab only) ---------- */
.preloader { display: none; }
html.show-preloader .preloader {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: var(--color-white);
  transition: opacity 400ms ease, visibility 0s linear 400ms;
}
html.show-preloader.preloader-done .preloader { opacity: 0; visibility: hidden; }
html.show-preloader:not(.preloader-done), html.show-preloader:not(.preloader-done) body { overflow: hidden; }
.preloader-inner { display: grid; justify-items: center; gap: 20px; color: var(--color-primary); }
.preloader .logo-svg { width: 188px; animation: fade-in 500ms ease both; }
.preloader-bar { width: 160px; height: 3px; border-radius: 3px; background: var(--color-accent); overflow: hidden; }
.preloader-bar span { display: block; height: 100%; background: var(--color-secondary); transform-origin: left; animation: preload-progress 900ms var(--ease-out) both; }
@keyframes preload-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Demo notice (bottom-left) ---------- */
.demo-notice {
  position: fixed; left: 16px; bottom: 16px; z-index: 300;
  width: min(360px, calc(100vw - 104px));
  padding: 18px 18px 16px; background: var(--color-white); color: var(--color-text);
  border: 1px solid var(--color-border); border-left: 4px solid var(--color-secondary);
  border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 0.9375rem;
  opacity: 0; transform: translateY(16px); visibility: hidden;
  transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out), visibility 0s linear 400ms;
}
.demo-notice.is-visible { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.demo-notice-title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-family: var(--font-heading); font-weight: 700; font-size: 1rem; color: var(--color-ink); }
.demo-notice-title .icon { width: 18px; height: 18px; color: var(--color-secondary-dark); }
.demo-notice p { margin: 0 0 14px; }
.demo-notice-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-notice .btn { min-height: 40px; padding: 8px 16px; font-size: 0.9375rem; }
@media (max-width: 767px) {
  .demo-notice { left: 12px; bottom: 12px; width: calc(100vw - 96px); padding: 14px; font-size: 0.875rem; }
  .demo-notice .btn { flex: 1 1 auto; padding: 8px 12px; }
}

/* ---------- Chatbot (bottom-right) ---------- */
.chat-launcher {
  position: fixed; right: 16px; bottom: 16px; z-index: 310;
  display: grid; place-items: center; width: 60px; height: 60px; padding: 0;
  border: 0; border-radius: 50%; background: var(--color-primary); color: var(--color-white);
  box-shadow: var(--shadow-lg); transition: transform 200ms ease, background-color 200ms ease;
}
.chat-launcher:hover { transform: translateY(-2px); background: var(--color-primary-dark); }
.chat-launcher .icon { width: 26px; height: 26px; }
.chat-launcher .icon-close { display: none; }
.chat-launcher[aria-expanded="true"] .icon-open { display: none; }
.chat-launcher[aria-expanded="true"] .icon-close { display: block; }
.chat-badge {
  position: absolute; top: -2px; right: -2px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--color-secondary); color: var(--color-ink); font-size: 0.75rem; font-weight: 700;
  border: 2px solid var(--color-white);
}
.chat-window {
  position: fixed; right: 16px; bottom: 88px; z-index: 310;
  display: flex; flex-direction: column; width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 120px));
  background: var(--color-white); border: 1px solid var(--color-border); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden;
  opacity: 0; transform: translateY(16px); visibility: hidden;
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out), visibility 0s linear 300ms;
}
.chat-window.is-open { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--color-primary); color: var(--color-white); }
.chat-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, 0.12); flex: none; }
.chat-avatar svg { width: 28px; height: 28px; }
.chat-title { margin: 0; font-family: var(--font-heading); font-size: 1rem; font-weight: 700; color: var(--color-white); line-height: 1.3; }
.chat-sub { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: rgba(255, 255, 255, 0.82); }
.chat-sub::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }
.chat-label { margin-left: auto; padding: 4px 8px; border-radius: 999px; background: var(--color-secondary); color: var(--color-ink); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.chat-close { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.1); color: var(--color-white); flex: none; }
.chat-close .icon { width: 18px; height: 18px; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--color-surface); overscroll-behavior: contain; }
.chat-msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 0.9375rem; line-height: 1.5; animation: fade-up 300ms var(--ease-out) both; overflow-wrap: anywhere; }
.chat-msg a { font-weight: 600; }
.chat-msg.bot { align-self: flex-start; background: var(--color-white); border: 1px solid var(--color-border); border-bottom-left-radius: 4px; color: var(--color-ink); }
.chat-msg.user { align-self: flex-end; background: var(--color-primary); color: var(--color-white); border-bottom-right-radius: 4px; }
.chat-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: var(--color-white); border: 1px solid var(--color-border); border-radius: 14px; }
.chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--color-muted); animation: typing 900ms ease-in-out 3 both; }
.chat-typing span:nth-child(2) { animation-delay: 150ms; }
.chat-typing span:nth-child(3) { animation-delay: 300ms; }
@keyframes typing { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
.chat-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 0; background: var(--color-white); border-top: 1px solid var(--color-border); }
.chat-chip { padding: 6px 12px; min-height: 34px; border: 1px solid var(--color-primary); border-radius: 999px; background: var(--color-white); color: var(--color-primary); font-size: 0.875rem; font-weight: 600; transition: background-color 200ms ease, color 200ms ease; }
.chat-chip:hover { background: var(--color-primary); color: var(--color-white); }
.chat-form { display: flex; gap: 8px; padding: 12px 16px 14px; background: var(--color-white); }
.chat-form input { flex: 1; min-width: 0; min-height: 44px; padding: 10px 14px; border: 1px solid #b8c4d0; border-radius: 10px; }
.chat-form input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(11, 60, 93, 0.18); }
.chat-send { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: var(--color-secondary); color: var(--color-ink); flex: none; }
.chat-send .icon { width: 20px; height: 20px; }
.chat-foot { padding: 0 16px 10px; background: var(--color-white); font-size: 0.75rem; color: var(--color-muted); }
@media (max-width: 767px) {
  .chat-launcher { right: 12px; bottom: 12px; width: 56px; height: 56px; }
  .chat-window { right: 8px; left: 8px; width: auto; bottom: 76px; height: min(560px, calc(100vh - 96px)); }
}

/* Failsafe: if JS never runs, the preloader still fades out after 4s. */
html.show-preloader:not(.preloader-done) .preloader { animation: preloader-failsafe 400ms ease 4s forwards; }
@keyframes preloader-failsafe { to { opacity: 0; visibility: hidden; } }
