/* ============================================
   🦈🐱 Shark-Cat Mascot Styles
   ============================================ */

/* ── Container ── */
.mascot-wrap {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9998;
  cursor: pointer;
  width: 110px;
  opacity: 0;
  transform: scale(0) translateY(40px);
  animation: mascot-entry 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s forwards;
}

@keyframes mascot-entry {
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.mascot {
  position: relative;
  width: 100%;
  aspect-ratio: 979/1071;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Base SVG ── */
.mascot-image {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.25));
  transform-origin: bottom center;
  position: relative;
  z-index: 2;
  overflow: visible;
}

/* Idle bounce */
.idle {
  animation: mascot-bounce 4s ease-in-out infinite;
}

@keyframes mascot-bounce {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-12px) scaleY(0.98); }
}

/* Jump animation (on click) */
.jump .mascot-image {
  animation: mascot-jump 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes mascot-jump {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-50px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

/* ── Speech / Thought Bubble ── */
.mascot-bubble {
  position: absolute;
  bottom: calc(100% - 10px);
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  padding: 10px 16px;
  border-radius: 18px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  font-size: 13px;
  font-weight: 500;
  color: #2C3E50;
  max-width: 280px;
  opacity: 0;
  transform: scale(0);
  transform-origin: bottom right;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  z-index: 9999;
  margin-bottom: 15px;
  line-height: 1.3;
}

.mascot-bubble.show {
  opacity: 1;
  transform: scale(1);
}

/* Speech bubble tail */
.mascot-bubble.speech::after {
  content: '';
  position: absolute;
  bottom: -10px;
  right: 20px;
  border-width: 10px 10px 0;
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.95) transparent transparent transparent;
}

/* Thought bubble (dashed border + dots) */
.mascot-bubble.thought {
  border: 2px dashed #ddd;
}
.mascot-bubble.thought::after,
.mascot-bubble.thought::before {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  border: 2px dashed #ddd;
}
.mascot-bubble.thought::after {
  width: 14px;
  height: 14px;
  bottom: -20px;
  right: 25px;
}
.mascot-bubble.thought::before {
  width: 8px;
  height: 8px;
  bottom: -32px;
  right: 15px;
}

/* ── Sparkle particles ── */
.mascot-sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #FFD700;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  z-index: 4;
}

.mascot-sparkle.active {
  animation: sparkle-pop 0.6s ease-out forwards;
}

@keyframes sparkle-pop {
  0% { transform: translate(0, 0) scale(0); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(1); opacity: 0; }
}

/* ── SVG parts: typing hand + fin ── */
#ruka, #plavnik {
  transform-box: fill-box;
}

#ruka {
  transform-origin: right bottom;
  animation: typing 0.25s infinite alternate ease-in-out;
}

#plavnik {
  transform-origin: bottom right;
  animation: fin-twitch 4s infinite;
}

@keyframes typing {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(4px) rotate(3deg); }
}

@keyframes fin-twitch {
  0%, 85%, 100% { transform: rotate(0deg); }
  90% { transform: rotate(-3deg); }
  95% { transform: rotate(2deg); }
}

/* ── Hide rect background in SVG ── */
.mascot-image > rect {
  display: none;
}

/* Eye tracking (pupil + highlight) */
#zrachek, #blik {
  transition: transform 0.08s ease-out;
}

/* ============================================
   💬 Chat Widget
   ============================================ */
#chat-widget {
  position: fixed;
  bottom: 100px;
  right: 180px;
  width: 320px;
  height: 450px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.9);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 9997;
}

#chat-widget.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-header {
  background: var(--blue, #575AFF);
  color: white;
  padding: 14px 20px;
  font-weight: bold;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.chat-close {
  cursor: pointer;
  font-size: 22px;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.chat-close:hover {
  opacity: 1;
}

.chat-body {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.4;
  animation: msg-slide-up 0.3s ease;
}

@keyframes msg-slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-ai {
  background: white;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  color: #2C3E50;
}

.typing-indicator {
  opacity: 0.7;
  font-style: italic;
  font-size: 13px;
}

.msg-user {
  background: var(--blue, #575AFF);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-input {
  padding: 12px 15px;
  background: white;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
}

.chat-input input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  outline: none;
  font-size: 14px;
  font-family: inherit;
}
.chat-input input:focus {
  border-color: var(--blue, #575AFF);
}

/* ── Lead Form ── */
.lead-form {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 16px 15px;
  background: #f8f9fa;
  border-top: 1px solid #eee;
  animation: lead-fadein 0.3s ease;
}
.lead-form.active {
  display: flex;
}

@keyframes lead-fadein {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.lead-form-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--dark, #0D0D1A);
  margin-bottom: 2px;
  text-align: center;
}

.lead-input {
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: white;
  transition: border-color 0.2s;
}
.lead-input:focus {
  border-color: var(--blue, #575AFF);
}

.lead-textarea {
  resize: none;
}

.lead-btn {
  padding: 10px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--blue, #575AFF);
  color: white;
  transition: background 0.2s, transform 0.15s;
}
.lead-btn:hover {
  background: #4244e0;
  transform: scale(1.02);
}
.lead-btn-ghost {
  background: transparent;
  color: #888;
  font-weight: 400;
  font-size: 13px;
}
.lead-btn-ghost:hover {
  background: transparent;
  color: var(--dark, #0D0D1A);
  transform: none;
}

.lead-error {
  font-size: 13px;
  color: #e74c3c;
  text-align: center;
  min-height: 18px;
}

.chat-input button {
  background: var(--blue, #575AFF);
  color: white;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s, background 0.2s;
}
.chat-input button:hover {
  transform: scale(1.1);
  background: #4244e0;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .mascot-wrap {
    width: 72px;
    bottom: 72px;
    right: 10px;
  }

  .mascot-bubble {
    max-width: 200px;
  }

  #chat-widget {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .chat-header {
    padding: 12px 16px;
    font-size: 14px;
  }
}
