/* Gettoolora Chat Widget — Frontend */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

#gtc-widget * { box-sizing: border-box; font-family: 'Inter', sans-serif; }

/* ── Bubble Button ───────────────────────────────────── */
#gtc-bubble {
  position: fixed;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--gtc-color, #6C63FF);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  box-shadow: 0 6px 24px rgba(0,0,0,.3);
  z-index: 999998;
  transition: transform .2s, box-shadow .2s;
  outline: none;
}
#gtc-bubble:hover { transform: scale(1.1); box-shadow: 0 10px 32px rgba(0,0,0,.4); }
#gtc-bubble.bottom-right { bottom: 24px; right: 24px; }
#gtc-bubble.bottom-left  { bottom: 24px; left: 24px; }

#gtc-bubble-badge {
  position: absolute;
  top: 0; right: 0;
  width: 20px; height: 20px;
  background: #e53e3e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  display: none;
}

/* ── Chat Window ─────────────────────────────────────── */
#gtc-window {
  position: fixed;
  width: 360px;
  height: 520px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  z-index: 999999;
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: scale(0) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
#gtc-window.bottom-right { bottom: 96px; right: 24px; transform-origin: bottom right; }
#gtc-window.bottom-left  { bottom: 96px; left: 24px;  transform-origin: bottom left;  }
#gtc-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Header */
#gtc-header {
  background: var(--gtc-color, #6C63FF);
  padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between;
  color: #fff;
}
.gtc-header-info { display: flex; align-items: center; gap: 10px; }
.gtc-agent-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  overflow: hidden;
  flex-shrink: 0;
}
.gtc-agent-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gtc-agent-name { font-size: 14px; font-weight: 600; }
.gtc-agent-status { font-size: 11px; opacity: .8; margin-top: 1px; }
.gtc-agent-status.online::before {
  content: '●';
  color: #68d391;
  margin-right: 4px;
}
#gtc-close-btn {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
#gtc-close-btn:hover { background: rgba(255,255,255,.35); }

/* Start form */
#gtc-start-form {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
  gap: 12px;
}
#gtc-start-form h3 { font-size: 15px; font-weight: 600; color: #1a202c; text-align: center; margin-bottom: 4px; }
#gtc-start-form p  { font-size: 12px; color: #718096; text-align: center; margin-bottom: 8px; }
.gtc-input {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  color: #1a202c;
  transition: border-color .2s;
}
.gtc-input:focus { border-color: var(--gtc-color, #6C63FF); }
.gtc-start-btn {
  width: 100%;
  background: var(--gtc-color, #6C63FF);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
  font-family: inherit;
  margin-top: 4px;
}
.gtc-start-btn:hover { opacity: .9; transform: translateY(-1px); }

/* Messages area */
#gtc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  display: none;
}
#gtc-messages::-webkit-scrollbar { width: 3px; }
#gtc-messages::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 3px; }

/* Message bubbles */
.gtc-msg { display: flex; gap: 8px; align-items: flex-end; }
.gtc-msg.from-admin { flex-direction: row; }
.gtc-msg.from-user  { flex-direction: row-reverse; }

.gtc-msg-av {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  overflow: hidden;
}
.gtc-msg.from-admin .gtc-msg-av { background: var(--gtc-color, #6C63FF); color: #fff; }
.gtc-msg.from-user  .gtc-msg-av { background: #e2e8f0; color: #4a5568; }
.gtc-msg.from-admin .gtc-msg-av img { width:100%; height:100%; object-fit:cover; }

.gtc-bbl {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.gtc-msg.from-admin .gtc-bbl { background: #fff; color: #1a202c; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-bottom-left-radius: 4px; }
.gtc-msg.from-user  .gtc-bbl { background: var(--gtc-color, #6C63FF); color: #fff; border-bottom-right-radius: 4px; }
.gtc-msg-ts { font-size: 10px; color: #a0aec0; margin-top: 3px; }
.gtc-msg.from-user .gtc-msg-ts { text-align: right; }

/* Typing indicator */
.gtc-typing .gtc-bbl {
  display: flex; gap: 4px; align-items: center;
  padding: 12px 16px;
}
.gtc-typing .gtc-bbl span {
  width: 6px; height: 6px;
  background: #a0aec0;
  border-radius: 50%;
  animation: typing .8s infinite;
}
.gtc-typing .gtc-bbl span:nth-child(2) { animation-delay: .15s; }
.gtc-typing .gtc-bbl span:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

/* Input box */
#gtc-input-box {
  border-top: 1px solid #e2e8f0;
  padding: 12px 14px;
  display: flex; gap: 8px; align-items: flex-end;
  background: #fff;
  display: none;
}
#gtc-input-box textarea {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  min-height: 42px; max-height: 100px;
  outline: none;
  color: #1a202c;
  transition: border-color .2s;
}
#gtc-input-box textarea:focus { border-color: var(--gtc-color, #6C63FF); }
#gtc-send {
  background: var(--gtc-color, #6C63FF);
  border: none;
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity .2s, transform .15s;
}
#gtc-send:hover { opacity: .9; transform: scale(1.05); }

@media (max-width: 420px) {
  #gtc-window { width: calc(100vw - 16px); height: 70vh; right: 8px !important; left: 8px !important; bottom: 90px !important; }
}
