/* =============================================
   INDEX-SPECIFIC STYLES
   Snow Effect, Animations, Chat Widget
   ============================================= */

/* Snow Effect */
#hero-snow { position: relative; overflow: hidden; }
.snow-container {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 5; overflow: hidden;
}
.snowflake {
  position: absolute; top: -10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);
  animation: snowfall linear infinite;
  will-change: transform;
}
@keyframes snowfall {
  0% { transform: translateY(0) translateX(0); }
  100% { transform: translateY(calc(100vh + 20px)) translateX(var(--drift, 0px)); }
}

/* Text Reveal Animation */
.text-reveal {
  display: block;
  animation: text-reveal 0.8s ease-out both;
}
.text-reveal.delay-1 { animation-delay: 0.2s; }
@keyframes text-reveal {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Floating Animation */
.animate-float {
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Glow Button */
.btn-glow {
  position: relative;
  overflow: hidden;
}
.btn-glow::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}
.btn-glow:hover::before {
  left: 100%;
}

/* Glass Button */
.btn-glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--color-white);
}
.btn-glass:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-white);
}

/* Scroll Reveal Animation */
.reveal-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  transition-delay: calc(var(--delay, 0) * 0.1s);
}
.reveal-up.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Price Card Highlight */
.price-card-highlight {
  border: 2px solid var(--color-primary);
  position: relative;
}
.price-badge-deal {
  background: #ef4444;
}
.price-savings {
  text-align: center;
  color: var(--color-success);
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* Link Arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--color-primary);
  transition: gap 0.3s ease;
}
.link-arrow:hover {
  gap: 1rem;
}

/* CTA Section */
.section-cta {
  position: relative;
  padding: 6rem 0;
  overflow: hidden;
}
.cta-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--color-gray-900) 0%, #0c4a6e 50%, var(--color-primary-dark) 100%);
}
.cta-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(14, 165, 233, 0.3) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(6, 182, 212, 0.2) 0%, transparent 40%);
}
.cta-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}
.cta-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 100px;
  color: var(--color-primary-light);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.cta-title {
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--color-white);
  margin-bottom: 1rem;
}
.cta-text {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 2rem;
  line-height: 1.7;
}
.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.cta-note {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

/* Area Link with icon */
.area-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.area-link svg {
  transition: transform 0.3s ease;
}
.area-card:hover .area-link svg {
  transform: translateX(5px);
}

/* === SECTION INLINE CTA (Benefits) === */
.section-inline-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 4rem;
  padding: 2rem 2.5rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-2xl);
}
.inline-cta-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.inline-cta-eyebrow {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.inline-cta-text {
  font-size: 1.0625rem;
  color: var(--color-gray-700);
  margin: 0;
}
.inline-cta-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.btn-outline-dark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 1.5px solid var(--color-gray-300);
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-gray-700);
  background: var(--color-white);
  transition: var(--transition);
}
.btn-outline-dark:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* === PROCESS BOTTOM CTA === */
.process-cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-ghost-white {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.75rem;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.8);
  background: transparent;
  transition: var(--transition);
}
.btn-ghost-white:hover {
  border-color: rgba(255, 255, 255, 0.6);
  color: var(--color-white);
}

/* === MOBILE INLINE CTAs === */
@media (max-width: 767px) {
  .section-inline-cta {
    flex-direction: column;
    padding: 1.5rem;
    margin-top: 2.5rem;
    gap: 1.25rem;
    text-align: center;
  }
  .inline-cta-eyebrow {
    font-size: 0.75rem;
  }
  .inline-cta-text {
    font-size: 0.9375rem;
  }
  .inline-cta-actions {
    width: 100%;
    flex-direction: column;
  }
  .inline-cta-actions .btn,
  .inline-cta-actions .btn-outline-dark {
    width: 100%;
    justify-content: center;
    text-align: center;
    min-height: 48px;
  }
  .process-cta-row {
    flex-direction: column;
    gap: 0.75rem;
  }
  .process-cta-row .btn,
  .process-cta-row .btn-ghost-white {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .snowflake, .animate-float, .scroll-wheel { animation: none; }
  .reveal-up { opacity: 1; transform: none; }
  .btn-glow::before { display: none; }
}

/* =============================================
   CHAT WIDGET
   ============================================= */

/* --- Chat Button --- */
#chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(14,165,233,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s ease, box-shadow .25s ease;
}
#chat-btn:hover { transform: scale(1.08); box-shadow: 0 10px 30px rgba(14,165,233,.65); }
#chat-btn svg { transition: opacity .2s, transform .2s; }
#chat-btn .icon-close { display: none; }

#chat-btn::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(14,165,233,.45);
  animation: chat-pulse 2s ease-out infinite;
}
@keyframes chat-pulse {
  0%   { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.55); opacity: 0; }
}

#chat-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 0 rgba(34,197,94,.6);
  animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  50%       { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

/* --- Chat Window --- */
#chat-window {
  position: fixed;
  bottom: 106px;
  right: 28px;
  z-index: 9998;
  width: 360px;
  max-height: 540px;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  transform: scale(.85) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .25s ease;
}
#chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.chat-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5);
  object-fit: cover;
  background: linear-gradient(135deg,#bae6fd,#0369a1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  font-weight: 700;
}
.chat-avatar-online {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #0284c7;
}
.chat-header-info { flex: 1; }
.chat-header-name {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}
.chat-header-status {
  color: rgba(255,255,255,.8);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.chat-header-status span.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  animation: badge-pulse 2s ease-in-out infinite;
}
.chat-close-btn {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  flex-shrink: 0;
}
.chat-close-btn:hover { background: rgba(255,255,255,.35); }

.chat-team-strip {
  background: #f0f9ff;
  padding: 10px 20px;
  font-size: 12px;
  color: #0369a1;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #e0f2fe;
  flex-shrink: 0;
}
.chat-team-avatars { display: flex; }
.chat-team-avatars .ta {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #f0f9ff;
  margin-left: -6px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
}
.chat-team-avatars .ta:first-child { margin-left: 0; }
.ta-1 { background: #0ea5e9; }
.ta-2 { background: #7c3aed; }
.ta-3 { background: #059669; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.chat-time-label {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  margin: 4px 0;
}

.msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: msg-in .3s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.agent { align-self: flex-start; }
.msg.user  { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg,#0ea5e9,#0369a1);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  font-weight: 700;
  margin-top: 2px;
}
.msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
  max-width: 100%;
}
.msg.agent .msg-bubble {
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}
.msg.user .msg-bubble {
  background: linear-gradient(135deg,#0ea5e9,#0284c7);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  text-align: right;
}
.msg.agent .msg-time { text-align: left; }

#typing-indicator {
  display: none;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
}
#typing-indicator .msg-avatar { background: linear-gradient(135deg,#0ea5e9,#0369a1); }
.typing-dots {
  background: #f1f5f9;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.typing-dots span {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  display: inline-block;
  animation: bounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%            { transform: translateY(-6px); }
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}
#chat-input {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 24px;
  padding: 9px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
  color: #1e293b;
  transition: border-color .2s;
  background: #f8fafc;
}
#chat-input:focus { border-color: #0ea5e9; background: #fff; }
#chat-input::placeholder { color: #94a3b8; }
#chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg,#0ea5e9,#0284c7);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 2px 10px rgba(14,165,233,.35);
}
#chat-send:hover { transform: scale(1.08); }
#chat-send:disabled { opacity: .5; cursor: default; transform: none; }

.chat-footer-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  color: #94a3b8;
  padding: 6px 14px 10px;
  background: #fff;
  flex-shrink: 0;
}
.chat-footer-note a { color: #0ea5e9; text-decoration: none; }
.chat-wa-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #25d366;
  font-weight: 600;
  font-size: 10.5px;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.chat-wa-link:hover { opacity: 1; }

@media (max-width: 1023px) {
  #chat-btn  { bottom: 96px; }
  #chat-window {
    bottom: 174px;
    max-height: min(540px, calc(100dvh - 200px));
    max-height: min(540px, calc(100vh  - 200px)); /* fallback */
  }
}

/* Bottom-Sheet auf kleinen Screens – Tastatur verschiebt nichts mehr */
@media (max-width: 600px) {
  #chat-window {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 88dvh;
    max-height: 88vh; /* fallback */
    transform-origin: bottom center;
  }
  .chat-messages { overscroll-behavior-y: contain; }

  /* --- Mobile Chat-Button: schlankes Edge-Peek-Tab statt FAB --- */
  /* Sitzt mittig-rechts, flush an der Kante, halb-rund nach links – kompakt
     und außerhalb der Daumen-/CTA-Zone unten. Versteckt sich beim Scrollen
     nach unten und kommt beim Scrollen nach oben wieder. */
  #chat-btn {
    right: 0;
    top: auto;
    bottom: 18vh;                   /* nahe am Bottom-Sheet-Aufploppen, aber nicht in der Daumen-Zone */
    width: 44px;
    height: 52px;
    border-radius: 26px 0 0 26px;   /* nur links rund, rechts flush an Kante */
    box-shadow: -6px 6px 18px rgba(14, 165, 233, .45);
    transform-origin: right center;
    transition: transform .35s cubic-bezier(.34, 1.56, .64, 1),
                box-shadow .25s ease,
                opacity .25s ease;
  }
  /* Hover/Active wird auf Touch zu „angetippt" – wir reagieren statt auf hover. */
  #chat-btn:hover { transform: none; }
  #chat-btn:active {
    transform: translateX(-4px);
    box-shadow: -10px 8px 22px rgba(14, 165, 233, .55);
  }

  /* Pulsring sieht an der Bildschirmkante abgeschnitten aus – auf Mobile aus. */
  #chat-btn::before { display: none; }

  /* Icon kleiner für die schlankere Pille. */
  #chat-btn .icon-chat { width: 22px; height: 22px; }
  #chat-btn .icon-close { width: 18px; height: 18px; }

  /* Kompakteres Online-Badge, sitzt am abgerundeten Rand. */
  #chat-badge {
    width: 10px;
    height: 10px;
    top: 6px;
    right: 8px;
    border-width: 1.5px;
  }

  /* Versteckt beim Runterscrollen – Klasse wird per JS gesetzt. */
  #chat-btn.is-hidden {
    transform: translateX(120%);
    opacity: 0;
    pointer-events: none;
  }

  /* Wenn das Chat-Fenster offen ist: Tab schiebt sich raus, damit der
     Bottom-Sheet ungestört wirkt – Schließen läuft über den ✕ im Header. */
  #chat-btn.is-open {
    transform: translateX(120%);
    opacity: 0;
    pointer-events: none;
  }
}
