/* ========== WD Smart Chat — Sucuri Style ========== */

/* Floating Button */
#wd-chat-button{
  position:fixed;bottom:22px;right:22px;z-index:2147483647;
  width:60px;height:60px;border-radius:50%;
  background:linear-gradient(145deg,var(--wd-primary),var(--wd-accent));
  color:#fff;border:0;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  font-size:24px;box-shadow:0 8px 24px rgba(0,0,0,.18);
  transition:transform .25s ease, box-shadow .25s ease, filter .2s ease, background .2s ease;
}
#wd-chat-button:hover{transform:translateY(-2px);box-shadow:0 10px 28px rgba(0,0,0,.22);}
#wd-chat-button.open{ background: var(--wd-danger,#ff6b6b); } /* when box is visible */

/* Panel */
#wd-chat-box{
  position:fixed;bottom:95px;right:22px;z-index:2147483646;
  display:none;                       /* <-- works with jQuery .toggle() */
  width:380px;max-width:95vw;
  background:var(--wd-panel,#fff);
  border-radius:18px;overflow:hidden;
  box-shadow:0 12px 40px rgba(0,0,0,.22);
}
/* Limit chat box height & allow scroll */
#wd-chat-box {
  max-height: calc(100vh - 100px); /* leaves ~50px top/bottom margin */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wd-chat-body {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 220px); /* inside space for header/footer */
  scroll-behavior: smooth;
}

#wd-chat-box,
#wd-chat-box * {
  font-family: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}


#wd-chat-box.active{transform:translateY(0) scale(1);opacity:1;visibility:visible;}

/* --- Header --- */
.wd-chat-header{
  background:linear-gradient(145deg,var(--wd-primary),var(--wd-accent));
  color:#fff;padding:16px 18px;
  display:flex;align-items:center;justify-content:space-between;
}
.wd-chat-header .wd-chat-title{display:flex;align-items:center;gap:10px;font-weight:600;}
.wd-chat-header .wd-chat-avatar{
  width:34px;height:34px;border-radius:50%;
  background:rgba(255,255,255,.15);
  display:flex;align-items:center;justify-content:center;font-size:18px;
}
#wd-chat-close{background:none;border:0;color:#fff;font-size:26px;cursor:pointer;line-height:1;}

/* --- Body --- */
.wd-chat-body{padding:16px;background:var(--wd-bg,#f8fafc);font-family:var(--wd-font);}

/* --- Bubbles --- */
.wd-msg{margin:10px 0;max-width:85%;}
.wd-msg .wd-bubble{
  padding:10px 14px;border-radius:16px;
  box-shadow:0 1px 3px rgba(0,0,0,.05);
}
.wd-msg.wd-user{margin-left:auto;text-align:right;}
.wd-msg.wd-user .wd-bubble{
  background:var(--wd-primary);color:#fff;
}
.wd-msg.wd-agent .wd-bubble{
  background:#fff;border:1px solid var(--wd-line,#e4e4e4);
  color:var(--wd-text,#3E435D);
}
/* Message timestamp styling */
.wd-time {
  display: block;
  font-size: 10px;
  color: #aaa;
  margin-top: 3px;
}



/* --- Form Fields --- */
/* --- Modern Pre-chat Inputs --- */
.wd-chat-body form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}
/* --- Conversation / Options Buttons --- */
.wd-chat-body p {
  font-size: 15px;
  margin: 6px 0;
  color: var(--wd-text,#3E435D);
}

.wd-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.wd-options button {
  border: 1px solid var(--wd-border,#e6e8ea);
  border-radius: 12px;
  padding: 10px 14px;
  background: #fff;
  cursor: pointer;
  transition: all .2s ease;
}

.wd-options button:hover {
  background: var(--wd-primary);
  color: #fff;
}


.wd-field input {
  width: 100%;
  font-size: 15px;
  padding: 14px 16px;
  border: 1px solid var(--wd-border,#e6e8ea);
  border-radius: 14px;
  background: #f9fafb;
  color: var(--wd-text,#3E435D);
  transition: all .2s ease;
  box-sizing: border-box;
}

.wd-field input::placeholder {
  color: var(--wd-dim,#8a8f9a);
  opacity: .8;
}

.wd-field input:focus {
  background: #fff;
  border-color: var(--wd-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb,var(--wd-primary) 20%,transparent);
  outline: none;
}

/* --- Start Chat Button --- */
#wd-chat-start,
.wd-btn-primary {
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(145deg,var(--wd-primary),var(--wd-accent));
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  transition: transform .15s ease, filter .2s ease;
}

#wd-chat-start:hover {
  filter: brightness(1.08);
}

#wd-chat-start:active {
  transform: translateY(1px);
}


/* --- Buttons --- */
.wd-btn{
  border:0;border-radius:999px;padding:10px 18px;
  cursor:pointer;font-weight:600;
  transition:all .2s ease;
}
.wd-btn-primary{
  background:linear-gradient(145deg,var(--wd-primary),var(--wd-accent));
  color:#fff;
}
.wd-btn-primary:hover{filter:brightness(1.05);}
.wd-btn-outline{
  background:transparent;border:2px solid var(--wd-primary);color:var(--wd-primary);
}
.wd-btn-outline:hover{background:var(--wd-primary);color:#fff;}

/* --- Composer --- */
.wd-composer{display:flex;gap:8px;margin-top:12px;}
.wd-composer input{
  flex:1;border:1px solid var(--wd-border,#e6e8ea);
  border-radius:12px;padding:12px;
}
.wd-composer button{
  background:linear-gradient(145deg,var(--wd-primary),var(--wd-accent));
  color:#fff;border:0;border-radius:12px;padding:12px 14px;cursor:pointer;
}

/* --- Animations --- */
@keyframes wdSlideIn{from{transform:translateY(40px);opacity:0;}to{transform:translateY(0);opacity:1;}}
.wd-animate-in{animation:wdSlideIn .3s ease both;}

/* === Enhancements: gradient header + morphing FAB === */

/* === Style Enhancements (Sucuri polish, safe with good layout) === */

/* Gradient header like Sucuri */
.wd-chat-header {
  background: linear-gradient(145deg, var(--wd-primary), var(--wd-accent));
  color: #fff;
  border-bottom: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
  position: relative;
  overflow: hidden;
}
.wd-chat-header::after {
  /* subtle pattern overlay for depth */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(255,255,255,.08), transparent 60%),
              radial-gradient(circle at 80% 70%, rgba(255,255,255,.06), transparent 70%);
  pointer-events: none;
}

/* Optional avatar bubble in header */
.wd-chat-header .wd-chat-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-right: 8px;
}

/* Floating Action Button: gradient + morph to close */
#wd-chat-button {
  background: linear-gradient(145deg, var(--wd-primary), var(--wd-accent)) !important;
  transition: all .25s ease;
}
#wd-chat-button.open {
  background: var(--wd-danger,#ff6b6b) !important;
  transform: rotate(90deg);
}

/* Slight lift effect when opening */
#wd-chat-box {
  transition: transform .25s ease, opacity .25s ease;
}
#wd-chat-box.wd-fade-in {
  transform: translateY(0);
  opacity: 1;
}

.wd-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: wd-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes wd-spin {
  to { transform: rotate(360deg); }
}

/* --- Follow-up textarea + submit styling (dynamic UI) --- */
.wd-chat-body textarea {
  width: 100%;
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--wd-border,#e6e8ea);
  border-radius: 14px;
  background: #f9fafb;
  color: var(--wd-text,#3E435D);
  transition: all .2s ease;
  box-sizing: border-box;
  resize: vertical;
  min-height: 60px;
}

.wd-chat-body textarea:focus {
  background: #fff;
  border-color: var(--wd-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb,var(--wd-primary) 20%,transparent);
  outline: none;
}

/* Submit button inside chat body */
.wd-chat-body #wd-final-submit {
  width: 100%;
  margin-top: 8px;
  padding: 12px 18px;
  border: 0;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(145deg,var(--wd-primary),var(--wd-accent));
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  transition: transform .15s ease, filter .2s ease;
}

.wd-chat-body #wd-final-submit:hover {
  filter: brightness(1.08);
}

.wd-chat-body #wd-final-submit:active {
  transform: translateY(1px);
}
.wd-chat-body {
  padding: 16px 18px;
}

body.logged-in #wd-chat-form { display:none; }