/* =========================================================
   AKWARIUM CHATBOT – Widget Styles
   ========================================================= */

:root {
  --akw-primary:      #E8622A;
  --akw-primary-dark: #C04A1A;
  --akw-bg:           #FFFFFF;
  --akw-bg-bot:       #FFF4EE;
  --akw-bg-user:      #E8622A;
  --akw-text:         #2D1200;
  --akw-text-light:   #FFF8F0;
  --akw-border:       #F0D0C0;
  --akw-shadow:       0 8px 32px rgba(0,0,0,0.18);
  --akw-radius:       20px;
  --akw-radius-msg:   14px;
  --akw-font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --akw-z:            99999;
}

/* =========================================================
   FLOATING BUTTON
   ========================================================= */

#akwchat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: var(--akw-z);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  user-select: none;
}

#akwchat-bubble-icon {
  width: 64px;
  height: 64px;
  background: var(--akw-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(232, 98, 42, 0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

#akwchat-bubble-icon:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(232, 98, 42, 0.65);
}

#akwchat-bubble-icon svg {
  width: 44px;
  height: 44px;
}

#akwchat-bubble-label {
  background: var(--akw-primary);
  color: white;
  font-family: var(--akw-font);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  animation: akwchat-label-bounce 2.5s ease-in-out 1.5s 3;
  opacity: 1;
  transition: opacity 0.4s ease;
}

#akwchat-bubble-label.hidden {
  opacity: 0;
  pointer-events: none;
}

@keyframes akwchat-label-bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-4px); }
}

/* Indicator: nowa wiadomosc -->
#akwchat-unread-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #FF3B30;
  border-radius: 50%;
  border: 2px solid white;
  display: none;
  animation: akwchat-dot-pulse 1.5s ease-in-out infinite;
}

@keyframes akwchat-dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.3); opacity: 0.7; }
}

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

#akwchat-window {
  position: fixed;
  bottom: 110px;
  right: 28px;
  z-index: var(--akw-z);
  width: 370px;
  max-width: calc(100vw - 40px);
  background: var(--akw-bg);
  border-radius: var(--akw-radius);
  box-shadow: var(--akw-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--akw-font);
  border: 1px solid var(--akw-border);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#akwchat-window.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.97);
}

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

#akwchat-header {
  background: linear-gradient(135deg, var(--akw-primary) 0%, var(--akw-primary-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  position: relative;
}

#akwchat-header-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#akwchat-header-avatar svg {
  width: 36px;
  height: 36px;
}

#akwchat-header-info {
  flex: 1;
}

#akwchat-header-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

#akwchat-header-status {
  font-size: 11px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 4px;
}

#akwchat-status-dot {
  width: 7px;
  height: 7px;
  background: #4CD964;
  border-radius: 50%;
  display: inline-block;
}

#akwchat-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 20px;
  opacity: 0.8;
  padding: 4px;
  line-height: 1;
  transition: opacity 0.2s;
}
#akwchat-close:hover { opacity: 1; }

/* =========================================================
   FOX MASCOT STAGE
   ========================================================= */

#akwchat-fox-stage {
  background: linear-gradient(180deg, #FFF4EE 0%, #FFE8D8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px 8px;
  gap: 12px;
  border-bottom: 1px solid var(--akw-border);
  height: 100px;
  min-height: 100px;
  max-height: 100px;
  overflow: hidden;
  flex-shrink: 0;
}

#akwchat-fox-wrapper {
  flex-shrink: 0;
  width: 80px;
  height: 100px;
  position: relative;
  align-self: center;
}

#akwchat-fox-wrapper svg {
  width: 100%;
  height: 100%;
}

#akwchat-fox-state-label {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--akw-primary-dark);
  font-family: var(--akw-font);
  opacity: 0.6;
  white-space: nowrap;
}

#akwchat-fox-speech {
  flex: 1;
  background: white;
  border: 1.5px solid var(--akw-border);
  border-radius: 14px 14px 14px 4px;
  padding: 9px 13px;
  font-size: 13px;
  font-style: italic;
  color: var(--akw-primary-dark);
  line-height: 1.4;
  max-height: 60px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  align-self: center;
}

#akwchat-fox-speech.typing::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--akw-primary);
  border-radius: 50%;
  margin-left: 3px;
  animation: akwchat-typing-dot 0.7s ease-in-out infinite alternate;
  vertical-align: middle;
}

@keyframes akwchat-typing-dot {
  from { opacity: 0.3; transform: translateY(0); }
  to   { opacity: 1;   transform: translateY(-3px); }
}

/* Typing indicator (3 dots) */
.akwchat-typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 2px 0;
}
.akwchat-typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--akw-primary);
  border-radius: 50%;
  animation: akwchat-dots 1.2s ease-in-out infinite;
}
.akwchat-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.akwchat-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes akwchat-dots {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* =========================================================
   VOICE BUTTON
   ========================================================= */

#akwchat-voice-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--akw-primary);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}
#akwchat-voice-btn:hover { transform: scale(1.15); }
#akwchat-voice-btn.playing {
  color: #FF3B30;
  animation: akwchat-dot-pulse 0.8s ease-in-out infinite;
}

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

#akwchat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 220px;
  scroll-behavior: smooth;
}

#akwchat-messages::-webkit-scrollbar {
  width: 4px;
}
#akwchat-messages::-webkit-scrollbar-track {
  background: transparent;
}
#akwchat-messages::-webkit-scrollbar-thumb {
  background: var(--akw-border);
  border-radius: 4px;
}

.akwchat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: akwchat-msg-appear 0.2s ease-out;
}

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

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

.akwchat-msg-bubble {
  padding: 9px 13px;
  border-radius: var(--akw-radius-msg);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.akwchat-msg.user .akwchat-msg-bubble {
  background: var(--akw-bg-user);
  color: white;
  border-bottom-right-radius: 4px;
}

.akwchat-msg.bot .akwchat-msg-bubble {
  background: var(--akw-bg-bot);
  color: var(--akw-text);
  border: 1px solid var(--akw-border);
  border-bottom-left-radius: 4px;
}

.akwchat-msg-time {
  font-size: 10px;
  color: #999;
  margin-top: 3px;
  padding: 0 4px;
}

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

#akwchat-input-area {
  padding: 12px 14px;
  border-top: 1px solid var(--akw-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: white;
}

#akwchat-input {
  flex: 1;
  border: 1.5px solid var(--akw-border);
  border-radius: 22px;
  padding: 10px 16px;
  font-family: var(--akw-font);
  font-size: 14px;
  color: var(--akw-text);
  background: #FAFAFA;
  outline: none;
  resize: none;
  max-height: 90px;
  overflow-y: auto;
  line-height: 1.4;
  transition: border-color 0.2s;
}

#akwchat-input:focus {
  border-color: var(--akw-primary);
  background: white;
}

#akwchat-input::placeholder {
  color: #BBB;
}

#akwchat-send {
  width: 42px;
  height: 42px;
  background: var(--akw-primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

#akwchat-send:hover {
  background: var(--akw-primary-dark);
  transform: scale(1.05);
}

#akwchat-send:disabled {
  background: #DDD;
  cursor: not-allowed;
  transform: none;
}

#akwchat-send svg {
  width: 18px;
  height: 18px;
  fill: white;
}

#akwchat-voice-toggle {
  width: 36px;
  height: 36px;
  background: none;
  border: 1.5px solid var(--akw-border);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s, background 0.2s;
  color: #999;
}

#akwchat-voice-toggle.active {
  border-color: var(--akw-primary);
  color: var(--akw-primary);
  background: #FFF4EE;
}

#akwchat-voice-toggle svg {
  width: 16px;
  height: 16px;
}

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

#akwchat-footer {
  padding: 6px 14px 8px;
  text-align: center;
  font-size: 10px;
  color: #BBB;
  border-top: 1px solid #F5F5F5;
  font-family: var(--akw-font);
}

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

@media (max-width: 480px) {
  #akwchat-window {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    border-radius: var(--akw-radius) var(--akw-radius) 0 0;
    bottom: 0;
  }

  #akwchat-bubble {
    bottom: 20px;
    right: 20px;
  }
}
