#aip-root {
  --aip-color: #1f6feb;
  /* Položaj nastavi chat.js (-d računalnik, -m telefon); spodnji media query izbere pravega. */
  --aip-right: var(--aip-right-d, 20px);
  --aip-bottom: var(--aip-bottom-d, 20px);
  position: fixed;
  right: var(--aip-right);
  bottom: var(--aip-bottom);
  /* Pod drugimi plavajočimi gradniki (npr. kontaktnim oknom), da jih zaprt gumb ne prekrije. */
  z-index: 99980;
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1c1c1e;
}
#aip-root *, #aip-root *::before, #aip-root *::after { box-sizing: border-box; }

/* Tema (npr. Elementor) oblikuje vse gumbe in polja na strani. Tu to ponastavimo;
   pravila spodaj imajo zaradi #aip-root prednost pred temo in pred to ponastavitvijo. */
#aip-root button,
#aip-root input,
#aip-root textarea {
  margin: 0;
  padding: 0;
  min-width: 0;
  min-height: 0;
  width: auto;
  height: auto;
  background-image: none;
  box-shadow: none;
  text-transform: none;
  letter-spacing: normal;
  text-shadow: none;
  font: inherit;
  line-height: 1.3;
  border-radius: 0;
  transition: none;
}

#aip-root .aip-launcher {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 0;
  background: var(--aip-launcher, var(--aip-color));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--aip-launcher, var(--aip-color)) 38%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  transition: transform .15s ease;
}
#aip-root .aip-launcher:hover { transform: scale(1.06); }
#aip-root .aip-launcher.aip-open { transform: scale(.92); }

#aip-root .aip-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 370px;
  height: 540px;
  max-height: calc(100vh - var(--aip-bottom) - 100px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#aip-root .aip-panel[hidden] { display: none; }

#aip-root .aip-header {
  background: var(--aip-color);
  color: #fff;
  padding: 12px 10px 12px 16px;
  display: flex;
  align-items: center;
  gap: 4px;
}
#aip-root .aip-titles { flex: 1; display: flex; flex-direction: column; min-width: 0; margin-left: 6px; }
#aip-root .aip-title { font-weight: 700; font-size: 16px; }
#aip-root .aip-subtitle { font-size: 12px; opacity: .85; }

#aip-root .aip-avatar {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e3e5e8;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--aip-color);
}
#aip-root .aip-avatar img { width: 100%; height: 100%; object-fit: cover; }
#aip-root .aip-avatar-lg { width: 40px; height: 40px; border: 2px solid rgba(255, 255, 255, .7); }

#aip-root .aip-intro {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  margin-bottom: 6px;
}
#aip-root .aip-logo { max-width: 160px; max-height: 46px; display: block; margin: 0 auto 8px; }
#aip-root .aip-intro-text { font-size: 12px; color: #6b7076; }

#aip-root .aip-row { display: flex; align-items: flex-end; gap: 8px; }
#aip-root .aip-row-user { justify-content: flex-end; }
#aip-root .aip-icon-btn {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
}
#aip-root .aip-icon-btn:hover { background: rgba(255, 255, 255, .18); }

#aip-root .aip-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f6f7f9;
}
#aip-root .aip-msg {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 14px;
  white-space: normal;
  overflow-wrap: anywhere;
}
#aip-root .aip-msg.aip-user {
  align-self: flex-end;
  background: var(--aip-color);
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
#aip-root .aip-msg.aip-assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e3e5e8;
  border-bottom-left-radius: 4px;
}
#aip-root .aip-msg a { color: var(--aip-color); text-decoration: underline; }
#aip-root .aip-msg ul { margin: 4px 0; padding-left: 18px; }
#aip-root .aip-msg.aip-error { border-color: #f1b4b4; background: #fdf0f0; color: #8a1f1f; }

#aip-root .aip-typing { display: flex; gap: 4px; padding: 13px; }
#aip-root .aip-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa0a6;
  animation: aip-blink 1.2s infinite ease-in-out;
}
#aip-root .aip-typing span:nth-child(2) { animation-delay: .2s; }
#aip-root .aip-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes aip-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

#aip-root .aip-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e3e5e8;
  background: #fff;
}
#aip-root .aip-input {
  flex: 1;
  resize: none;
  border: 1px solid #d0d4d9;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  color: inherit;
  max-height: 120px;
  background: #fff;
}
#aip-root .aip-input:focus { outline: 2px solid var(--aip-color); outline-offset: -1px; border-color: transparent; }
#aip-root .aip-send {
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--aip-color);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
#aip-root .aip-send:disabled { opacity: .5; cursor: default; }

#aip-root .aip-note {
  font-size: 11px;
  color: #80868b;
  text-align: center;
  padding: 0 10px 8px;
  background: #fff;
}

#aip-root .aip-quick { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 36px; }
#aip-root .aip-quick-btn {
  border: 1px solid var(--aip-color);
  background: #fff;
  color: var(--aip-color);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
#aip-root .aip-quick-btn:hover { background: var(--aip-color); color: #fff; }

#aip-root .aip-note .aip-link,
#aip-root .aip-handoff-privacy a { color: var(--aip-color); text-decoration: underline; cursor: pointer; }

#aip-root .aip-handoff {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-left: 3px solid var(--aip-color);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#aip-root .aip-handoff-title { font-weight: 600; }
#aip-root .aip-handoff .aip-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#aip-root .aip-handoff input,
#aip-root .aip-handoff textarea {
  width: 100%;
  border: 1px solid #d0d4d9;
  border-radius: 8px;
  padding: 7px 9px;
  font: inherit;
  color: inherit;
  background: #fff;
  resize: vertical;
}
#aip-root .aip-handoff input:focus,
#aip-root .aip-handoff textarea:focus { outline: 2px solid var(--aip-color); outline-offset: -1px; border-color: transparent; }
#aip-root .aip-handoff-privacy { font-size: 11px; color: #80868b; }
#aip-root .aip-handoff-error { font-size: 13px; color: #b32d2e; }
#aip-root .aip-handoff-error:empty { display: none; }
#aip-root .aip-handoff-actions { display: flex; justify-content: flex-end; gap: 8px; }
#aip-root .aip-handoff-actions .aip-send { padding: 8px 14px; }
#aip-root .aip-btn-secondary {
  border: 1px solid #d0d4d9;
  border-radius: 10px;
  padding: 8px 12px;
  background: #fff;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

@media (max-width: 767px) {
  #aip-root {
    --aip-right: var(--aip-right-m, var(--aip-right-d, 20px));
    --aip-bottom: var(--aip-bottom-m, var(--aip-bottom-d, 20px));
  }
}

@media (max-width: 480px) {
  /* Odprt klepet čez cel zaslon mora biti nad vsem, tudi nad drugimi plavajočimi gumbi. */
  #aip-root.aip-is-open { z-index: 2147483000; }
  #aip-root .aip-panel {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    max-height: none;
    border-radius: 0;
  }
  #aip-root .aip-launcher.aip-open { display: none; }
}
