/* ============================================================
   JARVIS.CSS — Floating Chat Widget
   everspice.de · 2026
   ============================================================ */

/* ── Trigger Bubble (unten rechts, fixed) ───────────────── */
.jarvis-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #111111;
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(232, 25, 44, 0.4);
  transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1),
              box-shadow 0.3s ease;
  z-index: 9000;
  animation: jarvis-trigger-pulse 3.2s ease-in-out infinite;
}

.jarvis-trigger:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 0 8px rgba(232, 25, 44, 0.08);
  border-color: var(--color-red);
}

/* Hover-Label ("Chat mit Jarvis") ─ slide-in von rechts */
.jarvis-trigger__label {
  position: absolute;
  top: 50%;
  right: calc(100% + 12px);
  transform: translateY(-50%) translateX(8px);
  white-space: nowrap;
  padding: 8px 14px;
  background: #111111;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease,
              transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.jarvis-trigger__label em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  color: var(--color-red);
  letter-spacing: -0.01em;
  margin-left: 4px;
}

.jarvis-trigger:hover .jarvis-trigger__label,
.jarvis-trigger:focus-visible .jarvis-trigger__label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 480px) {
  /* Auf Mobile Label ausblenden — Hover gibt's da eh nicht */
  .jarvis-trigger__label { display: none; }
}

/* ─── Knight Rider Scanner (KITT-Style) ──────────────────── */
.jarvis-kr {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 4px;
  background: rgba(232, 25, 44, 0.12);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(232, 25, 44, 0.18);
}

.jarvis-kr__dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    rgba(232, 25, 44, 0)   0%,
    rgba(232, 25, 44, 0.4) 30%,
    var(--color-red)       50%,
    rgba(232, 25, 44, 0.4) 70%,
    rgba(232, 25, 44, 0)   100%
  );
  box-shadow: 0 0 10px rgba(232, 25, 44, 0.7);
  animation: jarvis-kr-scan 1.8s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes jarvis-kr-scan {
  0%   { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* Small variant — für Header-Avatar */
.jarvis-kr--sm {
  width: 22px;
  height: 3px;
}

.jarvis-trigger__dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4CAF7A;
  box-shadow: 0 0 0 2px #111111, 0 0 8px rgba(76, 175, 122, 0.6);
}

@keyframes jarvis-trigger-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 0 0 rgba(232,25,44,0.3); }
  50%      { box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 0 10px rgba(232,25,44,0); }
}

.jarvis-trigger[hidden] { display: none; }

/* ── Window ─────────────────────────────────────────────── */
.jarvis-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 48px);
  background: #0f0f0f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9001;
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease,
              transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  font-family: var(--font-ui);
}

.jarvis-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Header ─────────────────────────────────────────────── */
.jarvis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, #141414 0%, #0f0f0f 100%);
}

.jarvis-header__identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jarvis-header__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #111111;
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 18px;
  color: var(--color-red);
  letter-spacing: -0.02em;
}

.jarvis-header__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.jarvis-header__name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  line-height: 1;
}

.jarvis-header__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.jarvis-header__status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4CAF7A;
  box-shadow: 0 0 6px rgba(76, 175, 122, 0.6);
  animation: jarvis-online 2s ease-in-out infinite;
}

@keyframes jarvis-online {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

.jarvis-header__close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.jarvis-header__close:hover {
  color: var(--color-text-primary);
  border-color: var(--color-red);
}

/* ── Messages ───────────────────────────────────────────── */
.jarvis-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  background: #0f0f0f;
}

.jarvis-messages::-webkit-scrollbar { width: 6px; }
.jarvis-messages::-webkit-scrollbar-track { background: transparent; }
.jarvis-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
.jarvis-messages::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); }

.jarvis-msg {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-text-primary);
  animation: jarvis-msg-in 0.35s cubic-bezier(0.19, 1, 0.22, 1);
  word-wrap: break-word;
}

@keyframes jarvis-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.jarvis-msg--bot {
  align-self: flex-start;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-top-left-radius: 4px;
}

.jarvis-msg--user {
  align-self: flex-end;
  background: var(--color-red);
  color: #fff;
  border-top-right-radius: 4px;
}

.jarvis-msg--summary {
  align-self: stretch;
  max-width: 100%;
  background: #1a1a1a;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px 18px;
}

.jarvis-summary__title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-red);
  margin-bottom: 12px;
}

.jarvis-summary__row {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.jarvis-summary__row:last-child { border-bottom: 0; }

.jarvis-summary__key {
  flex-shrink: 0;
  width: 90px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.jarvis-summary__value {
  color: var(--color-text-primary);
  word-break: break-word;
}

/* Typing Indicator */
.jarvis-typing {
  align-self: flex-start;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  border-top-left-radius: 4px;
  padding: 14px 16px;
  display: inline-flex;
  gap: 4px;
}

.jarvis-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-secondary);
  animation: jarvis-dot-pulse 1.2s ease-in-out infinite;
}

.jarvis-typing span:nth-child(2) { animation-delay: 0.15s; }
.jarvis-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes jarvis-dot-pulse {
  0%, 60%, 100% { transform: scale(0.8); opacity: 0.4; }
  30%           { transform: scale(1);   opacity: 1; }
}

/* ── Input Area ─────────────────────────────────────────── */
.jarvis-input {
  padding: 16px 20px 20px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: #0f0f0f;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.jarvis-input__hint {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

/* Button Choices */
.jarvis-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.jarvis-choice {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.jarvis-choice:hover {
  border-color: var(--color-red);
  background: rgba(232, 25, 44, 0.08);
  color: var(--color-red);
}

.jarvis-choice:active {
  transform: scale(0.97);
}

/* Primary Choice-Button (für "Absenden" nach Consent) */
.jarvis-choice--primary {
  background: var(--color-red);
  border-color: var(--color-red);
  color: #fff;
}
.jarvis-choice--primary:hover:not(:disabled) {
  background: var(--color-red-hover);
  border-color: var(--color-red-hover);
  color: #fff;
}
.jarvis-choice:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Consent-Block (Datenschutz-Checkbox) */
.jarvis-consent {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 4px;
}

.jarvis-consent__check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  position: relative;
}

.jarvis-consent__box {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.jarvis-consent__mark {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.2s ease;
  margin-top: 1px;
}

.jarvis-consent__box:checked + .jarvis-consent__mark {
  background: var(--color-red);
  border-color: var(--color-red);
  color: #fff;
}

.jarvis-consent__box:focus-visible + .jarvis-consent__mark {
  outline: 2px solid var(--color-red);
  outline-offset: 2px;
}

.jarvis-consent__text a {
  color: var(--color-red);
  text-decoration: none;
  border-bottom: 1px solid rgba(232, 25, 44, 0.3);
  transition: border-color 0.2s ease;
}
.jarvis-consent__text a:hover {
  border-color: var(--color-red);
}

/* Text Input */
.jarvis-text-wrap {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.jarvis-text {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.5;
}

.jarvis-text:focus {
  border-color: var(--color-red);
}

.jarvis-text::placeholder { color: var(--color-text-muted); }

.jarvis-send {
  background: var(--color-red);
  border: 0;
  border-radius: 10px;
  width: 44px;
  height: 44px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  align-self: flex-end;
}

.jarvis-send:hover {
  background: var(--color-red-hover);
  transform: translateY(-1px);
}

.jarvis-send:disabled {
  background: var(--color-bg-subtle);
  cursor: not-allowed;
  transform: none;
  opacity: 0.5;
}

/* Error */
.jarvis-error {
  color: var(--color-error);
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  padding-top: 4px;
}

/* Final State */
.jarvis-final {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 20px;
  text-align: center;
}

.jarvis-final__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(76, 175, 122, 0.12);
  color: #4CAF7A;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: jarvis-final-pop 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes jarvis-final-pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.jarvis-final__title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.jarvis-final__body {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* Mobile */
@media (max-width: 480px) {
  .jarvis-trigger { bottom: 16px; right: 16px; width: 54px; height: 54px; font-size: 22px; }
  .jarvis-window  {
    bottom: 0; right: 0; left: 0;
    width: 100%; max-width: 100%;
    height: 100dvh; max-height: 100dvh;
    border-radius: 16px 16px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jarvis-trigger,
  .jarvis-msg,
  .jarvis-typing span,
  .jarvis-final__icon,
  .jarvis-header__status::before,
  .jarvis-kr__dot {
    animation: none !important;
  }
  .jarvis-kr__dot { transform: translateX(50%); }
  .jarvis-window { transition: opacity 0.15s ease; }
}
