/* ============================================
   Seyfor Chatbot Widget - Styly
   Barvy: primary #021931 (Takstav dark), accent #89E103, text #023444
   ============================================ */

/* ===================== OPENER BUTTON ===================== */

#seyfor-chatbot-opener {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  z-index: 999998;
  padding: 0;
  overflow: visible;
  box-shadow: 0 4px 20px rgba(2, 25, 49, 0.35);
  transition: transform 0.3s cubic-bezier(0.75, -0.5, 0, 1.5), box-shadow 0.3s ease;
  /* Solid green with a circular cutout at bottom-left where the status dot sits */
  background: radial-gradient(circle at 8px 56px, transparent 9px, #89E103 9.5px);
}

#seyfor-chatbot-opener:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(2, 25, 49, 0.5);
}

#seyfor-chatbot-opener img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  /* Matching cutout so the lady image is also "bitten" at the dot position */
  -webkit-mask-image: radial-gradient(circle at 8px 56px, transparent 9px, black 9.5px);
  mask-image: radial-gradient(circle at 8px 56px, transparent 9px, black 9.5px);
}

#seyfor-chatbot-opener.is-open {
  transform: scale(0);
  pointer-events: none;
}

/* Blinking green availability dot — bottom-left, "bitten out" of the icon */
#seyfor-chatbot-opener::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #22C55E;
  border: none;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: seyfor-opener-pulse 2.2s ease-out infinite;
  z-index: 1;
}

#seyfor-chatbot-opener.is-open::after { display: none; }

@keyframes seyfor-opener-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Opener bubble */
#seyfor-chatbot-opener-bubble {
  position: fixed;
  bottom: 96px;
  right: 24px;
  background: #FFFFFF;
  color: #023444;
  padding: 10px 16px;
  border-radius: 12px 12px 0 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  z-index: 999997;
  max-width: 220px;
  white-space: pre-line;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

#seyfor-chatbot-opener-bubble.visible {
  opacity: 1;
  transform: translateY(0);
}

#seyfor-chatbot-opener-bubble.hidden {
  display: none;
}

/* ===================== CHAT WINDOW ===================== */

#seyfor-chatbot-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 48px);
  max-width: calc(100vw - 32px);
  background: #FFFFFF;
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.75, -0.5, 0, 1.5);
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#seyfor-chatbot-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ===================== HEADER ===================== */

.seyfor-chat-header {
  background: #023444;
  color: #FFFFFF;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.seyfor-chat-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.seyfor-chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.seyfor-chat-header-info { flex: 1; }

.seyfor-chat-header-name {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.seyfor-chat-header-status {
  font-size: 12px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.seyfor-chat-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #89E103;
  border-radius: 50%;
  display: inline-block;
}

.seyfor-chat-header-close {
  background: none;
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seyfor-chat-header-close:hover { background: rgba(255, 255, 255, 0.15); }
.seyfor-chat-header-close svg { width: 20px; height: 20px; }

/* ===================== MESSAGES ===================== */

.seyfor-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F7F7FA;
}

.seyfor-chat-messages::-webkit-scrollbar { width: 5px; }
.seyfor-chat-messages::-webkit-scrollbar-track { background: transparent; }
.seyfor-chat-messages::-webkit-scrollbar-thumb { background: #EBEBEB; border-radius: 3px; }

.seyfor-msg {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  animation: seyfor-msg-in 0.3s ease;
}

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

.seyfor-msg.bot { align-self: flex-start; }
.seyfor-msg.user { align-self: flex-end; }

.seyfor-msg-bubble {
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.seyfor-msg.bot .seyfor-msg-bubble {
  background: #FFFFFF;
  color: #023444;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.seyfor-msg.user .seyfor-msg-bubble {
  background: #021931;
  color: #FFFFFF;
  border-radius: 16px 16px 4px 16px;
}

.seyfor-msg-time {
  font-size: 11px;
  color: #8c919b;
  margin-top: 4px;
  padding: 0 4px;
}

.seyfor-msg.user .seyfor-msg-time { text-align: right; }

/* Typing */
.seyfor-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: #FFFFFF;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  align-self: flex-start;
  max-width: 80px;
}

.seyfor-typing-dot {
  width: 7px;
  height: 7px;
  background: #8c919b;
  border-radius: 50%;
  animation: seyfor-typing 1.4s infinite ease-in-out;
}

.seyfor-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.seyfor-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes seyfor-typing {
  0%, 60%, 100% { transform: scale(0.6); opacity: 0.4; }
  30% { transform: scale(1); opacity: 1; }
}

/* Rate limit */
.seyfor-msg-limit {
  background: #FFF3CD;
  color: #856404;
  border: 1px solid #FFEAA7;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  align-self: center;
  max-width: 90%;
}

.seyfor-msg-limit a { color: #021931; font-weight: 600; text-decoration: none; }
.seyfor-msg-limit a:hover { text-decoration: underline; }

/* ===================== INPUT ===================== */

.seyfor-chat-input {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid #EBEBEB;
  background: #FFFFFF;
  gap: 10px;
  flex-shrink: 0;
}

.seyfor-chat-input input {
  flex: 1;
  border: 1px solid #EBEBEB;
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  color: #023444;
  background: #F7F7FA;
}

.seyfor-chat-input input:focus { border-color: #021931; }
.seyfor-chat-input input::placeholder { color: #8c919b; }
.seyfor-chat-input input:disabled { opacity: 0.5; cursor: not-allowed; }

.seyfor-chat-input-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #89E103;
  color: #021931;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.seyfor-chat-input-send:hover { background: #7bc903; transform: scale(1.05); }
.seyfor-chat-input-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.seyfor-chat-input-send svg { width: 18px; height: 18px; }

/* ===================== FOOTER ===================== */

.seyfor-chat-footer {
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: #8c919b;
  background: #FFFFFF;
  flex-shrink: 0;
}

.seyfor-chat-footer a { color: #884DFF; text-decoration: none; }

/* ===================== RESPONSIVE ===================== */

@media (max-width: 480px) {
  #seyfor-chatbot-window {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    max-width: 100vw;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }

  #seyfor-chatbot-opener {
    bottom: 16px; right: 16px; width: 56px; height: 56px;
    background: radial-gradient(circle at 8px 48px, transparent 9px, #89E103 9.5px);
  }
  #seyfor-chatbot-opener img {
    -webkit-mask-image: radial-gradient(circle at 8px 48px, transparent 9px, black 9.5px);
    mask-image: radial-gradient(circle at 8px 48px, transparent 9px, black 9.5px);
  }
  #seyfor-chatbot-opener-bubble { bottom: 80px; right: 16px; }
}
