/* =================================================================
   Chat Conversation Widget — Frontend CSS
   Namespace: .ccw-*  (avoid conflicts with theme/Elementor)
   ================================================================= */

.ccw-wrapper{
  --ccw-anim-duration: 600ms;
  --ccw-anim-stagger: 120ms;
  position: relative;
}

.ccw-list{
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin: 0 auto;
  max-width: 1040px;
}

/* === Row layout =============================================== */
.ccw-row{
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.ccw-row--paired{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.ccw-row--paired::before{
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-start: calc(50% - 30px);
  width: 60px;
  height: 0;
  border-top: 2px dashed #fbd0de;
  transform: translateY(-50%);
  pointer-events: none;
}

.ccw-row--solo.ccw-row--user  { justify-content: flex-end;  flex-direction: row-reverse; }
.ccw-row--solo.ccw-row--reply { justify-content: flex-start; }

/* === Side container (avatar + bubble) ========================== */
.ccw-side{
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.ccw-side.ccw-row--user  { justify-content: flex-end;  flex-direction: row-reverse; }
.ccw-side.ccw-row--reply { justify-content: flex-start; }

/* === Avatar =================================================== */
.ccw-avatar{
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #fde4ec 60%, #fbd0de 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(233,30,99,.12);
}
/* default sizing — overridden by the Inner Size control */
.ccw-avatar{
  font-size: var(--ccw-avatar-fs, 60px);   /* base for % calculations */
}

/* IMAGE */
.ccw-avatar img{
  width: 55%;
  height: 55%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

/* ICON — the span sets font-size; <i> and <svg> inherit through 1em */
.ccw-avatar .ccw-avatar__icon{
  font-size: 55%;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ccw-avatar .ccw-avatar__icon i{ font-size: 1em; line-height: 1; }
.ccw-avatar .ccw-avatar__icon svg{
  width: 1em; height: 1em;
  display: block;
  fill: currentColor;
}

/* TEXT */
.ccw-avatar__text{
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, 'Heebo', serif;
  color: #e91e63;
  line-height: 1;
  font-size: 55%;
}

/* BUILT-IN ILLUSTRATION (preset SVG) — always fills the circle */
.ccw-avatar--preset{
  background: transparent !important;
  padding: 0 !important;
}
.ccw-avatar .ccw-avatar__svg{
  width: 100% !important;
  height: 100% !important;
  display: block;
}
.ccw-avatar__icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  color: #e91e63;
}
.ccw-avatar__icon svg{
  width: 1em;
  height: 1em;
  fill: currentColor;
}

/* === Bubble base ============================================== */
.ccw-bubble{
  position: relative;
  padding: 18px 26px;
  font-size: 18px;
  line-height: 1.45;
  max-width: 100%;
  word-break: break-word;
  background: #fff;
  color: #1a1a1a;
  border-radius: 26px;
}
.ccw-bubble strong,
.ccw-bubble b{ color: inherit; font-weight: 700; }

.ccw-bubble--user{
  background: #fff;
  border-bottom-right-radius: 8px;
}
.ccw-bubble--reply{
  background: linear-gradient(180deg, #fde4ec 0%, #fbd0de 100%);
  border-bottom-left-radius: 8px;
}
.ccw-bubble--reply strong{ color: #e91e63; }

/* === Bubble style variants (set via prefix_class on wrapper) === */
/* rounded — already the default */

/* pill */
.ccw-user-style-pill  .ccw-bubble--user,
.ccw-reply-style-pill .ccw-bubble--reply{
  border-radius: 999px !important;
  padding: 14px 28px;
}

/* sharp — light radius, no tail-corner */
.ccw-user-style-sharp  .ccw-bubble--user,
.ccw-reply-style-sharp .ccw-bubble--reply{
  border-radius: 6px !important;
}

/* minimal — outlined, less padding */
.ccw-user-style-minimal .ccw-bubble--user{
  background: transparent;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 12px !important;
  padding: 14px 20px;
  box-shadow: none !important;
}
.ccw-reply-style-minimal .ccw-bubble--reply{
  background: transparent !important;
  border: 1px solid rgba(233,30,99,.25);
  border-radius: 12px !important;
  padding: 14px 20px;
  box-shadow: none !important;
}

/* glass */
.ccw-user-style-glass .ccw-bubble--user{
  background: rgba(255,255,255,.55) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 22px !important;
}
.ccw-reply-style-glass .ccw-bubble--reply{
  background: rgba(251,208,222,.55) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 22px !important;
}

/* === Tails (only render on rounded; other styles look better without) === */
.ccw-user-tail-yes  .ccw-bubble--user::after,
.ccw-reply-tail-yes .ccw-bubble--reply::after{
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  bottom: -2px;
}
.ccw-user-tail-yes .ccw-bubble--user::after{
  background: #fff;
  inset-inline-end: -6px;
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}
.ccw-reply-tail-yes .ccw-bubble--reply::after{
  background: #fbd0de;
  inset-inline-start: -6px;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.ccw-user-tail-no  .ccw-bubble--user::after,
.ccw-reply-tail-no .ccw-bubble--reply::after{ display: none !important; }

/* tails don't fit with pill/glass/sharp/minimal */
.ccw-user-style-pill   .ccw-bubble--user::after,
.ccw-user-style-sharp  .ccw-bubble--user::after,
.ccw-user-style-glass  .ccw-bubble--user::after,
.ccw-user-style-minimal .ccw-bubble--user::after,
.ccw-reply-style-pill  .ccw-bubble--reply::after,
.ccw-reply-style-sharp .ccw-bubble--reply::after,
.ccw-reply-style-glass .ccw-bubble--reply::after,
.ccw-reply-style-minimal .ccw-bubble--reply::after{ display: none !important; }

/* === Animations ============================================== */
.ccw-anim-yes .ccw-row{
  opacity: 0;
  transition:
    opacity var(--ccw-anim-duration) ease,
    transform var(--ccw-anim-duration) ease;
  transition-delay: calc(var(--ccw-i, 0) * var(--ccw-anim-stagger, 120ms));
}
.ccw-anim-yes.ccw-anim-type-fade        .ccw-row{ transform: none; }
.ccw-anim-yes.ccw-anim-type-fade-up     .ccw-row{ transform: translateY(24px); }
.ccw-anim-yes.ccw-anim-type-fade-side   .ccw-row--solo.ccw-row--user{ transform: translateX(-30px); }
.ccw-anim-yes.ccw-anim-type-fade-side   .ccw-row--solo.ccw-row--reply{ transform: translateX(30px); }
.ccw-anim-yes.ccw-anim-type-fade-side   .ccw-row--paired{ transform: translateY(24px); }
.ccw-anim-yes.ccw-anim-type-scale       .ccw-row{ transform: scale(.92); }

.ccw-anim-yes .ccw-row.is-visible{
  opacity: 1 !important;
  transform: none !important;
}

/* prefers-reduced-motion — skip animations */
@media (prefers-reduced-motion: reduce){
  .ccw-anim-yes .ccw-row{ opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* === Mobile ================================================== */
@media (max-width: 720px){
  .ccw-list{ gap: 18px; }
  .ccw-m-stack-yes .ccw-row--paired{
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .ccw-m-stack-yes .ccw-row--paired::before{ display: none; }
  .ccw-m-stack-yes .ccw-row--paired .ccw-side.ccw-row--reply{
    flex-direction: row;
    justify-content: flex-start;
  }
}

/* === Presets (reasonable defaults; controls still override) ==== */
/* Soft Feminine — already the default */

/* Minimal Clean */
.ccw-preset-minimal .ccw-wrapper{ background: transparent; }
.ccw-preset-minimal .ccw-bubble--user{
  background: #f6f6f7;
  border-bottom-right-radius: 16px;
  box-shadow: none;
}
.ccw-preset-minimal .ccw-bubble--reply{
  background: #111;
  color: #fff;
  border-bottom-left-radius: 16px;
}
.ccw-preset-minimal .ccw-bubble--reply strong{ color: #ffd54f; }
.ccw-preset-minimal .ccw-avatar{ background: #f0f0f1; box-shadow: none; }
.ccw-preset-minimal .ccw-avatar__text{ color: #111; font-style: normal; }
.ccw-preset-minimal .ccw-row--paired::before{ border-color: #e5e5e7; }

/* Bold Gradient */
.ccw-preset-bold .ccw-wrapper{
  background: linear-gradient(135deg, #1a0033 0%, #4a0080 100%);
  color: #fff;
}
.ccw-preset-bold .ccw-bubble--user{
  background: rgba(255,255,255,.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
}
.ccw-preset-bold .ccw-bubble--reply{
  background: linear-gradient(135deg, #ff6b3d 0%, #e91e63 50%, #9c27b0 100%);
  color: #fff;
}
.ccw-preset-bold .ccw-bubble--reply strong{ color: #fff176; }
.ccw-preset-bold .ccw-avatar{ background: rgba(255,255,255,.12); box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.ccw-preset-bold .ccw-avatar__text{ color: #fff; }
.ccw-preset-bold .ccw-row--paired::before{ border-color: rgba(255,255,255,.25); }
