/**
 * SAIS.GE — Chatbot Widget Styles
 * Smart AI System LLC
 * Navy + Gold theme
 */

#sais-chatbot {
  --navy-900: #0e1117;
  --navy-800: #161b22;
  --navy-700: #1c2129;
  --navy-600: #242a33;
  --line: rgba(255, 255, 255, 0.1);
  --gold: #00a879;
  --gold-soft: #36d0aa;
  --gold-deep: #007e66;
  --text: #f0f2f5;
  --text-mut: #8b949e;
  --radius: 20px;
  --radius-sm: 12px;
  --sans: 'Noto Sans Georgian', system-ui, sans-serif;
}

/* ========= Toggle Button ========= */
.chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  box-shadow:
    0 4px 20px rgba(212, 175, 106, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: chatbot-pulse 2.5s infinite;
}

.chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow:
    0 6px 28px rgba(212, 175, 106, 0.5),
    0 2px 10px rgba(0, 0, 0, 0.35);
}

.chatbot-toggle:active {
  transform: scale(0.96);
}

.chatbot-toggle svg {
  width: 26px;
  height: 26px;
  fill: var(--navy-900);
}

.chatbot-toggle[aria-expanded="true"] {
  animation: none;
}

@keyframes chatbot-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(212, 175, 106, 0.35), 0 2px 8px rgba(0, 0, 0, 0.3); }
  50%      { box-shadow: 0 4px 30px rgba(212, 175, 106, 0.55), 0 2px 14px rgba(0, 0, 0, 0.35); }
}

/* ========= Window ========= */
.chatbot-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9999;
  width: 380px;
  height: 520px;
  max-height: calc(100vh - 120px);
  border-radius: var(--radius);
  background: var(--navy-800);
  border: 1px solid var(--line);
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(30, 44, 82, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--sans);
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.25s ease;
}

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

/* ========= Header ========= */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--navy-900);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.chatbot-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.chatbot-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green, #34d399);
  flex-shrink: 0;
}

.chatbot-close {
  background: none;
  border: none;
  color: var(--text-mut);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.chatbot-close:hover {
  background: var(--navy-700);
  color: var(--text);
}

/* ========= Messages ========= */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
  width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

/* Bot bubble */
.chatbot-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) var(--radius-sm) 4px;
  background: var(--navy-700);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  animation: chatbot-fadeUp 0.3s ease;
}

/* User bubble */
.chatbot-bubble--user {
  align-self: flex-end;
  background: var(--navy-600);
  border-radius: var(--radius-sm) var(--radius-sm) 4px var(--radius-sm);
  color: var(--gold-soft);
}

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

/* ========= Quick Replies ========= */
.chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 0 0;
  animation: chatbot-fadeUp 0.3s ease;
}

.chatbot-qr-btn {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold-soft);
  font-size: 13px;
  font-family: var(--sans);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.chatbot-qr-btn:hover {
  background: var(--gold);
  color: var(--navy-900);
  border-color: var(--gold);
}

.chatbot-qr-btn:active {
  background: var(--gold-deep);
  border-color: var(--gold-deep);
}

/* ========= Typing Indicator ========= */
.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  max-width: 70px;
  border-radius: var(--radius-sm) var(--radius-sm) var(--radius-sm) 4px;
  background: var(--navy-700);
  animation: chatbot-fadeUp 0.25s ease;
}

.chatbot-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-mut);
  animation: chatbot-typingBounce 1.4s infinite ease-in-out;
}

.chatbot-typing-dot:nth-child(2) { animation-delay: 0.16s; }
.chatbot-typing-dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes chatbot-typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ========= Input Area ========= */
.chatbot-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--navy-900);
  flex-shrink: 0;
}

/* Contact form inside input area */
.chatbot-contact-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chatbot-contact-form input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--navy-900);
  color: var(--text);
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.chatbot-contact-form input::placeholder {
  color: var(--text-mut);
}

.chatbot-contact-form input:focus {
  border-color: var(--gold);
}

.chatbot-contact-submit {
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: var(--navy-900);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: opacity 0.2s;
  align-self: flex-end;
}

.chatbot-contact-submit:hover {
  opacity: 0.88;
}

.chatbot-contact-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chatbot-contact-error {
  color: var(--error, #f87171);
  font-size: 12px;
}

/* ========= Mobile ========= */
@media (max-width: 480px) {
  .chatbot-window {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    bottom: 0;
    right: 0;
    border-radius: 0;
    max-height: none;
  }

  .chatbot-toggle {
    bottom: 16px;
    right: 16px;
  }
}
