/**
 * myAXON — custom chat widget (Make.com webhook)
 * Matches site teal accent #0f766e
 */

:root {
  --axon-chat-accent: #0f766e;
  --axon-chat-bg: #141418;
  --axon-chat-surface: #1c1c21;
  --axon-chat-border: rgba(255, 255, 255, 0.1);
  --axon-chat-text: #f4f4f5;
  --axon-chat-muted: #a1a1aa;
}

[data-theme="light"] {
  --axon-chat-bg: #f4f4f5;
  --axon-chat-surface: #ffffff;
  --axon-chat-border: rgba(0, 0, 0, 0.12);
  --axon-chat-text: #0a0a0c;
  --axon-chat-muted: #52525b;
}

#axon-chat-root {
  position: relative;
  z-index: 10050;
  font-family: 'Lexend', system-ui, sans-serif;
}

.axon-chat-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 999px;
  border: 1px solid var(--axon-chat-border);
  /* Svetlobni pas se premika L→D (zelena → bela → zelena), kot „lak“ na avtu */
  background: linear-gradient(
    92deg,
    #0f766e 0%,
    #0f766e 32%,
    #2dd4bf 44%,
    #ecfdf5 50%,
    #2dd4bf 56%,
    #0f766e 68%,
    #0f766e 100%
  );
  background-size: 260% 100%;
  background-position: 0% 50%;
  color: #f8fafc;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.45),
    0 0 12px rgba(15, 118, 110, 0.35);
  box-shadow:
    0 12px 40px rgba(15, 118, 110, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: axon-chat-fab-sweep 3.2s ease-in-out infinite alternate;
  max-width: min(100vw - 32px, 420px);
}

@keyframes axon-chat-fab-sweep {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: -100% 50%;
  }
}

[data-theme="light"] .axon-chat-fab {
  background: linear-gradient(
    92deg,
    #0f766e 0%,
    #0d9488 32%,
    #5eead4 44%,
    #ffffff 50%,
    #5eead4 56%,
    #0d9488 68%,
    #0f766e 100%
  );
  background-size: 260% 100%;
  color: #f8fafc;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.35),
    0 0 10px rgba(15, 118, 110, 0.4);
}

.axon-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 48px rgba(15, 118, 110, 0.45);
}

.axon-chat-fab:focus-visible {
  outline: 2px solid var(--axon-chat-accent);
  outline-offset: 3px;
}

.axon-chat-fab-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

#axon-chat-fab-label {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

@media (max-width: 520px) {
  .axon-chat-fab {
    gap: 8px;
    padding: 10px 12px;
    max-width: min(calc(100vw - 24px), 240px);
    font-size: 11px;
    letter-spacing: 0.01em;
  }

  #axon-chat-fab-label {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: left;
    hyphens: auto;
    word-break: break-word;
  }

  .axon-chat-fab-icon {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 380px) {
  .axon-chat-fab {
    max-width: min(calc(100vw - 20px), 220px);
    padding: 9px 10px;
    font-size: 10.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .axon-chat-fab {
    animation: none;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.95), rgba(15, 118, 110, 0.78));
    background-size: 100% 100%;
  }
}

body.axon-chat-open .axon-chat-fab {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

.axon-chat-panel {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 24px));
  height: min(560px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  background: var(--axon-chat-surface);
  color: var(--axon-chat-text);
  border-radius: 20px;
  border: 1px solid var(--axon-chat-border);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(15, 118, 110, 0.12);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.axon-chat-panel.axon-chat-panel--open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.axon-chat-head {
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.18), transparent);
  border-bottom: 1px solid var(--axon-chat-border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.axon-chat-head-text h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 4px;
}

.axon-chat-head-text p {
  margin: 0;
  font-size: 12px;
  color: var(--axon-chat-muted);
  line-height: 1.45;
}

.axon-chat-close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--axon-chat-border);
  background: color-mix(in srgb, var(--axon-chat-surface) 70%, transparent);
  color: var(--axon-chat-text);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.axon-chat-close:hover {
  border-color: var(--axon-chat-accent);
}

.axon-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.axon-chat-msg {
  max-width: 92%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.axon-chat-msg--user {
  align-self: flex-end;
  background: rgba(15, 118, 110, 0.22);
  border: 1px solid rgba(15, 118, 110, 0.35);
}

.axon-chat-msg--bot {
  align-self: flex-start;
  background: color-mix(in srgb, var(--axon-chat-bg) 55%, var(--axon-chat-surface));
  border: 1px solid var(--axon-chat-border);
}

.axon-chat-msg--system {
  align-self: center;
  max-width: 100%;
  font-size: 12px;
  color: var(--axon-chat-muted);
  background: transparent;
  border: 1px dashed var(--axon-chat-border);
  text-align: center;
}

.axon-chat-msg--error {
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}

.axon-chat-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.axon-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--axon-chat-accent);
  animation: axon-chat-dot 1.2s infinite ease-in-out both;
}

.axon-chat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.axon-chat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes axon-chat-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: scale(0.85);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.axon-chat-email-row {
  padding: 12px 14px 0;
  border-top: 1px solid var(--axon-chat-border);
  background: color-mix(in srgb, var(--axon-chat-bg) 40%, var(--axon-chat-surface));
}

.axon-chat-email {
  width: 100%;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--axon-chat-border);
  background: var(--axon-chat-bg);
  color: var(--axon-chat-text);
  font-family: inherit;
  font-size: 13px;
}

.axon-chat-email:focus {
  outline: none;
  border-color: var(--axon-chat-accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}

.axon-chat-input-row {
  padding: 10px 14px 16px;
  border-top: none;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: color-mix(in srgb, var(--axon-chat-bg) 40%, var(--axon-chat-surface));
}

.axon-chat-input {
  flex: 1;
  min-height: 46px;
  max-height: 120px;
  resize: none;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--axon-chat-border);
  background: var(--axon-chat-bg);
  color: var(--axon-chat-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
}

.axon-chat-input:focus {
  outline: none;
  border-color: var(--axon-chat-accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}

.axon-chat-send {
  flex-shrink: 0;
  min-width: 96px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  border: none;
  background: var(--axon-chat-accent);
  color: #f8fafc;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.axon-chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .axon-chat-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }

  .axon-chat-fab {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }
}

body.axon-chat-open {
  overflow: hidden;
}

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