/* Kipinä-esimerkkikortti (ai-chatbotit.php, osio kipina-band).
   Kortti on chat-ikkuna, jonka viestialue on kiinteän korkuinen ja vierii kuin oikeassa chatissa:
   assets/js/kipina-demo.js toistaa keskustelun, eikä kortin korkeus muutu toiston aikana.
   Ilman skriptiä ja liikettä vähentävälle kävijälle koko keskustelu näkyy valmiina.
   Hinta-arvio-, lähde- ja soittopyyntökortit lainaavat oikean widgetin ulkoasun (assets/css/kipina-widget/2-kortit.css ja 3-toiminnot.css). */

.kipina-demo-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  padding: 28px 28px 24px;
  backdrop-filter: blur(10px);
}
.kipina-demo-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.kipina-demo-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(230, 70, 68, 0.45);
}
.kipina-demo-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}
.kipina-demo-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.kipina-demo-sub::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}
.kd-replay {
  margin-left: auto;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: transparent;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  animation: kdUp 0.4s ease both;
}
.kd-replay[hidden] { display: none; }
.kd-replay:hover { background: rgba(255,255,255,0.10); color: #fff; }
.kd-replay:focus-visible { outline: 2px solid #fcb549; outline-offset: 2px; }

/* Viestialue: kiinteä korkeus, yläreuna häivytetty, vierii alas uusien viestien mukana. */
.kipina-demo-msgs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 440px;
  overflow-y: auto;
  padding: 20px 4px 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 36px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 36px);
}
.kipina-demo-msgs > * { flex-shrink: 0; }
.kipina-demo-msg {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 500;
  max-width: 88%;
}
.kipina-demo-msg.bot {
  align-self: flex-start;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.88);
  border-bottom-left-radius: 5px;
}
.kipina-demo-msg.user {
  align-self: flex-end;
  max-width: 78%;
  background: var(--grad);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 4px 14px rgba(230, 70, 68, 0.40);
}

/* Widgetin kortit: valkoinen runko ja tummansininen otsikkopalkki kuten oikeassa Kipinässä. */
.kd-card {
  align-self: flex-start;
  width: min(100%, 300px);
  background: #fff;
  color: #1a2452;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 14px 34px -16px rgba(0,0,0,0.55);
}
.kd-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #1a2452 0%, #232e66 100%);
  color: #fff;
}
.kd-card-title { font-size: 13.5px; font-weight: 800; letter-spacing: -0.01em; }
.kd-card-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.62);
  white-space: nowrap;
}
.kd-card-body { padding: 8px 14px 12px; font-size: 13px; }
.kd-est-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed #e5e9f4;
}
.kd-est-row > span { font-weight: 700; }
.kd-est-row strong { font-size: 16px; font-weight: 800; white-space: nowrap; }
.kd-est-row small { font-size: 11px; font-weight: 600; color: #6b7280; margin-left: 3px; }
.kd-est-setup { border-bottom: 0; }
.kd-est-setup > span { font-weight: 600; }
.kd-est-setup strong { font-size: 13.5px; font-weight: 700; }
.kd-card-note { font-size: 11.5px; color: #6b7280; }

.kd-sources { display: flex; margin-top: -4px; }
.kd-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.kd-source:hover { background: rgba(255,255,255,0.14); color: #fff; }
.kd-source svg { width: 11px; height: 11px; color: #fcb549; flex-shrink: 0; }

/* Tuotekortti: sama ulkoasu kuin oikean widgetin laatat (.kip-prod-* kipina-widget/5-kumppani.css:ssä), mutta
   tämä sivu ei lataa widgetin tyylejä. Laatat tulevat yksi kerrallaan näkyviin, kun lista saa kd-in-luokan.
   Demossa laatat eivät ole linkkejä eivätkä reagoi osoittimeen: ne näyttävät, miltä kortti näyttää, eivät vie pois sivulta. */
.kd-prod-list {
  align-self: flex-start;
  width: min(100%, 340px);
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #1a2452;
}
.kd-prod-list.kd-in { animation: none; }
.kd-prod-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
  border: 1.5px solid #e5e9f4;
  border-radius: 14px;
  box-shadow: 0 8px 22px -14px rgba(9,14,36,0.5);
  color: inherit;
}
.kd-prod-thumb { flex: 0 0 84px; width: 84px; height: 63px; border-radius: 10px; overflow: hidden; background: #1b2130; }
.kd-prod-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.kd-prod-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.kd-prod-name { font-size: 14.5px; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: break-word; }
.kd-prod-desc {
  font-size: 12px;
  line-height: 1.4;
  color: #6b7280;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.kd-prod-price { font-size: 14px; font-weight: 800; color: #166534; }
.kd-prod-vat { margin-left: 5px; font-size: 11px; font-weight: 600; color: #6b7280; white-space: nowrap; }
.kd-prod-shop { align-self: flex-start; margin-top: -4px; font-size: 11.5px; font-weight: 600; color: rgba(255,255,255,0.55); }
.kd-prod-list.kd-in .kd-prod-item { animation: kdUp 0.4s cubic-bezier(0.22,1,0.36,1) both; }
.kd-prod-list.kd-in .kd-prod-item:nth-child(2) { animation-delay: 0.14s; }
.kd-prod-list.kd-in .kd-prod-item:nth-child(3) { animation-delay: 0.28s; }

.kd-callback { width: min(100%, 340px); }
.kd-callback .kd-card-body { padding-top: 12px; }
.kd-field {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 11px;
  margin-bottom: 6px;
  border: 1px solid #e5e9f4;
  border-radius: 10px;
}
.kd-field > span:first-child { font-size: 12px; font-weight: 600; color: #6b7280; }
.kd-field-value { font-weight: 700; min-height: 1.4em; white-space: nowrap; }
.kd-field-value.kd-caret::after {
  content: '';
  display: inline-block;
  width: 1.5px;
  height: 1em;
  margin-left: 1px;
  vertical-align: -2px;
  background: #f58024;
  animation: kdBlink 0.9s steps(1) infinite;
}
.kd-times { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.kd-time {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e5e9f4;
  font-size: 11.5px;
  font-weight: 600;
  color: #4b5563;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.kd-time.is-on { background: #1a2452; border-color: #1a2452; color: #fff; }

/* Lähetysnappi ja kuittaus ovat samassa ruudussa, joten vaihto ei muuta kortin korkeutta.
   Oletustila (ilman skriptiä) on lähetetty; toisto lisää kd-filling-luokan täytön ajaksi. */
.kd-cb-foot { display: grid; margin-top: 10px; }
.kd-cb-foot > * { grid-area: 1 / 1; }
.kd-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  visibility: hidden;
  transition: transform 0.15s;
}
.kd-done {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 10px;
  background: #ecfdf3;
  color: #166534;
  font-size: 13px;
  font-weight: 700;
}
.kd-done svg { width: 16px; height: 16px; flex-shrink: 0; }
.kd-callback.kd-filling .kd-submit { visibility: visible; }
.kd-callback.kd-filling .kd-done { visibility: hidden; }
.kd-submit.kd-press { transform: scale(0.96); }
.kd-done.kd-pop { animation: kdPop 0.45s cubic-bezier(0.22,1,0.36,1) both; }

/* Toiston tilat (kipina-demo.js). */
.kd-pending { display: none !important; }
.kd-in { animation: kdUp 0.4s cubic-bezier(0.22,1,0.36,1) both; }
.kd-hold .kd-w:not(.kd-w-in) { opacity: 0; }
.kd-w { transition: opacity 0.22s ease; }
.kd-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 15px 16px;
}
.kd-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.75);
  animation: kdDots 1.2s ease-in-out infinite;
}
.kd-typing span:nth-child(2) { animation-delay: 0.15s; }
.kd-typing span:nth-child(3) { animation-delay: 0.3s; }

/* Kirjoituskenttä: lähetys avaa oikean Kipinän tällä kysymyksellä. */
.kipina-demo-compose {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 6px 6px 6px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.16);
  transition: border-color 0.2s, background 0.2s;
}
.kipina-demo-compose:focus-within {
  border-color: rgba(252,181,73,0.65);
  background: rgba(255,255,255,0.09);
}
.kipina-demo-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 0;
}
.kipina-demo-input::placeholder { color: rgba(255,255,255,0.45); }
.kipina-demo-send {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grad);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(230, 70, 68, 0.40);
  transition: transform 0.15s;
}
.kipina-demo-send:hover { transform: translateX(2px); }
.kipina-demo-send:focus-visible { outline: 2px solid #fcb549; outline-offset: 2px; }
.kipina-demo-send.kd-press { transform: scale(0.88); }
.kipina-demo-send.kd-nudge { animation: kdNudge 1.8s ease-out 2; }

/* Tekstipalstan Kipinä-kehote tummalla taustalla: vain muuttuvat arvot (components/ai-hi.css). */
.kipina-band-text .ai-hi {
  margin-top: 8px;
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.25);
  color: #fff;
}
.kipina-band-text .ai-hi:hover,
.kipina-band-text .ai-hi:focus-within { border-color: rgba(252,181,73,0.65); color: #fff; }
.kipina-band-text .ai-hi-input { color: #fff; }
.kipina-band-text .ai-hi-input::placeholder { color: rgba(255,255,255,0.55); }
.kipina-band-text .ai-hi:hover .ai-hi-input,
.kipina-band-text .ai-hi:focus-within .ai-hi-input { border-left-color: rgba(255,255,255,0.25); }
.kipina-band-text .ai-hi-send { color: #fff; }
.kipina-band-text .ai-hi-send:hover,
.kipina-band-text .ai-hi-send:focus-visible { color: #fcb549; }

@keyframes kdUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes kdPop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: none; }
}
@keyframes kdBlink { 50% { opacity: 0; } }
@keyframes kdDots {
  0%, 60%, 100% { opacity: 0.3; transform: none; }
  30% { opacity: 1; transform: translateY(-3px); }
}
@keyframes kdNudge {
  0% { box-shadow: 0 4px 14px rgba(230,70,68,0.40), 0 0 0 0 rgba(252,181,73,0.55); }
  70% { box-shadow: 0 4px 14px rgba(230,70,68,0.40), 0 0 0 12px rgba(252,181,73,0); }
  100% { box-shadow: 0 4px 14px rgba(230,70,68,0.40), 0 0 0 0 rgba(252,181,73,0); }
}

@media (max-width: 600px) {
  .kipina-band-text .ai-hi:hover .ai-hi-input,
  .kipina-band-text .ai-hi:focus-within .ai-hi-input { width: 120px; }
  .kipina-band-text .ai-hi { max-width: 100%; padding-left: 20px; padding-right: 20px; }
  .kipina-demo-card { padding: 20px 16px 16px; border-radius: 20px; }
  .kipina-demo-msgs { height: 420px; }
  .kipina-demo-msg { font-size: 13.5px; }
}
