/* Tavaraperille Jenna – Chatbot. Eraldatud style.css-ist parseriga (ainult chatbot). */
:root {
  --tpl-teal:#00B4A6; --tpl-dark:#1A2332; --tpl-light:#F0F9F8; --tpl-white:#fff;
  --tpl-gray:#6B7280; --tpl-gray-light:#F3F4F6; --tpl-border:#E5E7EB; --tpl-red:#DC2626;
}

/* Chat overlay */
#tpl-chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99999;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 24px;
}

@media (max-width: 600px) {
#tpl-chat-overlay {
    overflow: hidden;
    padding: 0;
    align-items: flex-end;
  }
}

/* Chat aken */
#tpl-chat-window {
  width: 380px;
  max-width: calc(100vw - 0px);
  max-width: 100%;
  height: 560px;
  max-height: 90vh;
  background: white;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
}

@media (max-width: 600px) {
#tpl-chat-overlay {
    overflow: hidden;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    align-items: flex-end !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
#tpl-chat-window {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0;
    height: 90vh;
    max-height: 90vh;
    box-sizing: border-box;
    overflow: hidden;
  }
#tpl-chat-input-area {
    padding: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    width: 100%;
  }
#tpl-chat-input {
    font-size: 16px !important; /* iOS zoom fix */
    min-width: 0;
    flex: 1;
  }
#tpl-chat-send {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }
#tpl-float-btn {
    bottom: 16px;
    right: 16px;
    font-size: 14px;
    height: 44px;
    padding: 0 16px;
  }
}

/* Header */
#tpl-chat-header {
  background: var(--tpl-dark);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

#tpl-chat-avatar {
  width: 40px;
  height: 40px;
  background: var(--tpl-teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  flex-shrink: 0;
}

#tpl-chat-name {
  font-weight: 700;
  font-size: 15px;
}

#tpl-chat-status {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

#tpl-chat-close {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s;
}

#tpl-chat-close:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

/* Sõnumid */
#tpl-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F9FAFB;
}

.tpl-chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.tpl-chat-msg--bot {
  background: white;
  color: var(--tpl-dark);
  border: 1px solid var(--tpl-border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.tpl-chat-msg--user {
  background: var(--tpl-teal);
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Trükkimise animatsioon */
.tpl-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px 18px;
}

.tpl-typing span {
  width: 7px;
  height: 7px;
  background: #CBD5E1;
  border-radius: 50%;
  animation: tpl-bounce 1.2s infinite;
}

.tpl-typing span:nth-child(2) { animation-delay: 0.2s; }

.tpl-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes tpl-bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* Sisend */
#tpl-chat-input-area {
  padding: 16px;
  border-top: 1px solid var(--tpl-border);
  display: flex;
  gap: 8px;
  background: white;
}

#tpl-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--tpl-border);
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#tpl-chat-input:focus {
  border-color: var(--tpl-teal);
}

#tpl-chat-send {
  width: 42px;
  height: 42px;
  background: var(--tpl-teal);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

#tpl-chat-send:hover {
  background: var(--tpl-dark);
}

/* Broneerimise nupud */
.tpl-chat-booking-btn-wrap,
.tpl-chat-confirm-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: flex-start;
  max-width: 85%;
}

.tpl-booking-start-btn {
  padding: 12px 20px;
  background: var(--tpl-teal);
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.tpl-booking-start-btn:hover {
  background: var(--tpl-dark);
}

.tpl-confirm-yes {
  padding: 12px 20px;
  background: var(--tpl-teal);
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.tpl-confirm-yes:hover { background: var(--tpl-dark); }

.tpl-confirm-no {
  padding: 10px 20px;
  background: white;
  color: #9CA3AF;
  border: 1px solid var(--tpl-border);
  border-radius: 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.tpl-confirm-no:hover { background: #F3F4F6; }

.tpl-offer-btn {
  padding: 12px 20px;
  background: white;
  color: var(--tpl-teal);
  border: 2px solid var(--tpl-teal);
  border-radius: 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
}

.tpl-offer-btn:hover {
  background: var(--tpl-teal);
  color: white;
}

/* ============================================================
   UJUV CHATBOT NUPP (kogu saidil)
   ============================================================ */
#tpl-float-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  height: 48px;
  padding: 0 20px;
  border-radius: 24px;
  background: #3aa6b9;
  color: white;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(58,166,185,0.4);
  z-index: 99998;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

#tpl-float-btn:hover {
  background: #2d8a9b;
  transform: scale(1.03);
}

/* Pulse animatsioon float nupule */
@keyframes tpl-pulse-anim {
  0%   { box-shadow: 0 0 0 0 rgba(58,166,185,0.6); }
  70%  { box-shadow: 0 0 0 14px rgba(58,166,185,0); }
  100% { box-shadow: 0 0 0 0 rgba(58,166,185,0); }
}

#tpl-float-btn.tpl-pulse {
  animation: tpl-pulse-anim 1.2s ease-out infinite;
}

@media (max-width: 600px) {
#tpl-float-tip {
    right: 8px !important;
    max-width: calc(100vw - 80px) !important;
  }
}
