/* Oak Build Chatbot - Frontend Styles */
:root {
  --ob-primary:   #2d5a35;
  --ob-dark:      #1c2b1e;
  --ob-accent:    #c8a45a;
  --ob-light:     #e8f0e9;
  --ob-surface:   #f5f7f5;
  --ob-border:    #dde5de;
  --ob-text:      #1c2b1e;
  --ob-muted:     #6b7c6d;
  --ob-shadow:    0 12px 48px rgba(28,43,30,0.18), 0 2px 10px rgba(28,43,30,0.08);
  --ob-radius:    20px;
}

/* ── Launcher ── */
#obchat-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 62px;
  height: 62px;
  background: var(--ob-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 28px rgba(45,90,53,0.45);
  z-index: 99999;
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), background 0.2s;
  user-select: none;
}
#obchat-launcher:hover { background: #3d7a47; transform: scale(1.08); }
#obchat-launcher svg   { width: 27px; height: 27px; }
.obchat-icon-chat,
.obchat-icon-close { display: flex; align-items: center; justify-content: center; }

.obchat-badge {
  position: absolute;
  top: 1px; right: 1px;
  width: 19px; height: 19px;
  background: var(--ob-accent);
  border-radius: 50%;
  border: 2px solid white;
  font-size: 10px;
  font-weight: 700;
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: Arial, sans-serif;
}

#obchat-launcher::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--ob-primary);
  opacity: 0;
  animation: ob-ring 3s ease-out infinite;
}
@keyframes ob-ring {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.65); opacity: 0; }
}

/* ── Window ── */
#obchat-window {
  position: fixed;
  bottom: 102px;
  right: 28px;
  width: 368px;
  max-height: 620px;
  background: #fff;
  border-radius: var(--ob-radius);
  box-shadow: var(--ob-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  animation: ob-open 0.32s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes ob-open {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── Header ── */
.obchat-header {
  background: var(--ob-dark);
  padding: 15px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}
.obchat-header-logo {
  width: 40px; height: 40px;
  background: var(--ob-primary);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.obchat-header-info h3 {
  font-size: 14px;
  font-weight: 600;
  color: white;
  margin: 0;
  font-family: Georgia, serif;
}
.obchat-header-info p {
  font-size: 11.5px;
  color: rgba(255,255,255,0.6);
  margin: 2px 0 0;
  display: flex; align-items: center; gap: 5px;
}
.obchat-online-dot {
  width: 7px; height: 7px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 5px #4ade80;
  display: inline-block;
}
.obchat-header-actions { margin-left: auto; }
.obchat-hbtn {
  width: 29px; height: 29px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 7px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.18s;
}
.obchat-hbtn:hover { background: rgba(255,255,255,0.2); }
.obchat-hbtn svg { width: 14px; height: 14px; }

/* ── Messages ── */
.obchat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scroll-behavior: smooth;
  min-height: 0;
}
.obchat-messages::-webkit-scrollbar { width: 3px; }
.obchat-messages::-webkit-scrollbar-thumb { background: var(--ob-border); border-radius: 3px; }

.obchat-msg {
  display: flex;
  flex-direction: column;
  max-width: 84%;
  animation: ob-msg 0.22s ease;
}
@keyframes ob-msg {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.obchat-msg.user  { align-self: flex-end;   align-items: flex-end; }
.obchat-msg.bot   { align-self: flex-start; align-items: flex-start; }

.obchat-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}
.obchat-msg.user .obchat-bubble {
  background: var(--ob-primary);
  color: white;
  border-bottom-right-radius: 4px;
}
.obchat-msg.bot .obchat-bubble {
  background: var(--ob-surface);
  color: var(--ob-text);
  border: 1px solid var(--ob-border);
  border-bottom-left-radius: 4px;
}

.obchat-meta {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--ob-muted);
  display: flex; align-items: center; gap: 6px;
}
.obchat-copy {
  background: none; border: none; cursor: pointer;
  font-size: 10.5px; color: var(--ob-muted);
  padding: 1px 4px; border-radius: 4px;
  opacity: 0; transition: opacity 0.18s, color 0.18s;
}
.obchat-msg:hover .obchat-copy { opacity: 1; }
.obchat-copy:hover { color: var(--ob-primary); }

/* typing */
.obchat-typing {
  align-self: flex-start;
  background: var(--ob-surface);
  border: 1px solid var(--ob-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  animation: ob-msg 0.22s ease;
}
.ob-dots { display: flex; gap: 4px; align-items: center; }
.ob-dots span {
  width: 6px; height: 6px;
  background: var(--ob-muted);
  border-radius: 50%;
  animation: ob-dot 1.1s infinite ease-in-out;
}
.ob-dots span:nth-child(2) { animation-delay: 0.18s; }
.ob-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes ob-dot {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

/* CTA Card */
.obchat-cta {
  align-self: flex-start;
  max-width: 92%;
  background: linear-gradient(135deg, var(--ob-dark) 0%, var(--ob-primary) 100%);
  border-radius: 13px;
  padding: 12px 14px;
  color: white;
  font-size: 13px;
  animation: ob-msg 0.22s ease;
}
.obchat-cta p { opacity: 0.8; font-size: 12px; margin-top: 3px; }
.obchat-cta-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.obchat-cta-btns a {
  background: var(--ob-accent);
  color: white;
  text-decoration: none;
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  transition: opacity 0.18s;
}
.obchat-cta-btns a:hover { opacity: 0.85; }
.obchat-cta-btns a.outline {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.3);
}

/* ── Lead Form ── */
.obchat-lead-form {
  background: var(--ob-surface);
  border-top: 1px solid var(--ob-border);
  padding: 13px 13px 10px;
  flex-shrink: 0;
  animation: ob-msg 0.25s ease;
}
.obchat-form-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ob-text);
  margin-bottom: 9px;
}
.obchat-lead-form input {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  color: var(--ob-text);
  background: white;
  border: 1.5px solid var(--ob-border);
  border-radius: 9px;
  padding: 8px 11px;
  margin-bottom: 7px;
  outline: none;
  transition: border 0.18s;
  box-sizing: border-box;
}
.obchat-lead-form input:focus { border-color: var(--ob-primary); }
.obchat-lead-form input::placeholder { color: var(--ob-muted); }
.obchat-lead-form button#obchat-lead-submit {
  width: 100%;
  background: var(--ob-primary);
  color: white;
  border: none;
  border-radius: 9px;
  padding: 9px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s;
  font-family: inherit;
}
.obchat-lead-form button#obchat-lead-submit:hover { background: #3d7a47; }
.obchat-lead-form button.skip {
  background: none; border: none;
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: var(--ob-muted);
  cursor: pointer;
  margin-top: 5px;
  font-family: inherit;
  transition: color 0.18s;
}
.obchat-lead-form button.skip:hover { color: var(--ob-primary); }

/* ── Quick Replies ── */
.obchat-quick-replies {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 13px 0;
  flex-shrink: 0;
}
.obchat-qr {
  background: var(--ob-light);
  border: 1px solid var(--ob-border);
  border-radius: 20px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 12px;
  color: var(--ob-primary);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.obchat-qr:hover { background: var(--ob-primary); color: white; border-color: var(--ob-primary); }

/* ── Input ── */
.obchat-input-area {
  padding: 9px 11px 10px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  background: white;
  border-top: 1px solid var(--ob-border);
  flex-shrink: 0;
}
#obchat-input {
  flex: 1;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ob-text);
  background: var(--ob-surface);
  border: 1.5px solid var(--ob-border);
  border-radius: 12px;
  padding: 8px 12px;
  outline: none;
  resize: none;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.5;
  transition: border 0.18s, background 0.18s;
}
#obchat-input:focus { border-color: var(--ob-primary); background: white; }
#obchat-input::placeholder { color: var(--ob-muted); }
#obchat-send {
  width: 37px; height: 37px;
  background: var(--ob-primary);
  border: none; border-radius: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.18s, transform 0.14s;
}
#obchat-send:hover   { background: #3d7a47; }
#obchat-send:active  { transform: scale(0.91); }
#obchat-send:disabled { opacity: 0.38; cursor: not-allowed; }
#obchat-send svg { width: 17px; height: 17px; }

.obchat-branding {
  text-align: center;
  font-size: 10.5px;
  color: var(--ob-muted);
  padding: 3px 0 7px;
  flex-shrink: 0;
  font-family: inherit;
}
.obchat-branding a { color: var(--ob-primary); text-decoration: none; }

/* ── Bottom-left position ── */
.obchat-pos-bottom-left #obchat-launcher,
.obchat-pos-bottom-left #obchat-window { right: auto; left: 28px; }

/* ── Mobile ── */
@media (max-width: 480px) {
  #obchat-window {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 88px;
    max-height: 75vh;
  }
  #obchat-launcher { right: 14px; bottom: 18px; }
  .obchat-pos-bottom-left #obchat-launcher { left: 14px; right: auto; }
  .obchat-pos-bottom-left #obchat-window  { left: 10px; right: auto; }
}
