/* ═══════════════════════════════════════════════════════════════════════════
   Chatbot Gate – Leo  |  chatbot-gate.css  v2.0.0
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variabili ────────────────────────────────────────────────────────────── */
.cbg-root {
  --cbg-accent:       #1a56db;
  --cbg-accent-dark:  #1245b5;
  --cbg-accent-bg:    #eff6ff;
  --cbg-border:       #d1d5db;
  --cbg-border-error: #ef4444;
  --cbg-bg:           #ffffff;
  --cbg-text:         #111827;
  --cbg-text-muted:   #6b7280;
  --cbg-radius:       12px;
  --cbg-shadow:       0 4px 28px rgba(0,0,0,.09);
  --cbg-t:            .22s ease;
}

/* ── Animazioni ───────────────────────────────────────────────────────────── */
@keyframes cbg-in {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes cbg-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-18px); }
}
@keyframes cbg-in-back {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Step generico ────────────────────────────────────────────────────────── */
.cbg-step {
  background: var(--cbg-bg);
  border: 1px solid var(--cbg-border);
  border-radius: var(--cbg-radius);
  box-shadow: var(--cbg-shadow);
  overflow: hidden;
  max-width: 660px;
  margin: 0 auto;
  animation: cbg-in .3s ease both;
}

.cbg-step--exit {
  animation: cbg-out .28s ease both;
}

/* ── Step footer ──────────────────────────────────────────────────────────── */
.cbg-step-footer {
  padding: 1.1rem 1.75rem 1.6rem;
  display: flex;
  justify-content: flex-end;
}

.cbg-step-footer--between {
  justify-content: space-between;
  align-items: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STEP 1 – Testo introduttivo
   ═══════════════════════════════════════════════════════════════════════════ */

.cbg-step1-body {
  display: flex;
  gap: 1.2rem;
  padding: 1.75rem 1.75rem 1rem;
  align-items: flex-start;
}

/* Avatar "L" di Leo */
.cbg-leo-avatar {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--cbg-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cbg-leo-initial {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
}

.cbg-step1-content {
  font-size: .92rem;
  color: var(--cbg-text);
  line-height: 1.65;
  flex: 1;
}

.cbg-step1-content p {
  margin: 0 0 .7rem;
}

.cbg-step1-content p:last-child {
  margin-bottom: 0;
}

/* Testo "Ciao sono Leo!" */
.cbg-intro-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 .5rem !important;
}

.cbg-intro-list {
  margin: .35rem 0 0 1.1rem;
  padding: 0;
  list-style: disc;
}

.cbg-intro-list li {
  margin-bottom: .55rem;
  line-height: 1.6;
}

.cbg-intro-list li:last-child {
  margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STEP 2 – Checkbox
   ═══════════════════════════════════════════════════════════════════════════ */

.cbg-step2-header {
  padding: 1.5rem 1.75rem .6rem;
  border-bottom: 1px solid var(--cbg-border);
  margin-bottom: .75rem;
}

.cbg-step2-title {
  margin: 0 0 .25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cbg-text);
}

.cbg-step2-sub {
  margin: 0;
  font-size: .875rem;
  color: var(--cbg-text-muted);
}

/* Lista checkbox */
.cbg-checks {
  list-style: none;
  margin: 0;
  padding: 0 1.75rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.cbg-item {
  border-radius: 8px;
  padding: .65rem .75rem;
  transition: background var(--cbg-t);
}

.cbg-item:hover {
  background: var(--cbg-accent-bg);
}

.cbg-item--error {
  background: #fef2f2;
}

.cbg-item--error .cbg-check-icon {
  border-color: var(--cbg-border-error);
}

.cbg-label {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  cursor: pointer;
  color: var(--cbg-text);
  font-size: .92rem;
  line-height: 1.55;
  user-select: none;
}

/* Input nativo nascosto */
.cbg-cb {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Checkbox custom */
.cbg-check-icon {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: .2rem;
  border: 2px solid var(--cbg-border);
  border-radius: 4px;
  background: #fff;
  transition: border-color var(--cbg-t), background var(--cbg-t);
  position: relative;
}

.cbg-check-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    var(--cbg-accent)
    url("data:image/svg+xml,%3Csvg viewBox='0 0 12 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 5l3.5 3.5L11 1' stroke='%23fff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 68% no-repeat;
  border-radius: 2px;
  transition: opacity var(--cbg-t);
}

.cbg-cb:checked + .cbg-check-icon {
  border-color: var(--cbg-accent);
}

.cbg-cb:checked + .cbg-check-icon::after {
  opacity: 1;
}

.cbg-cb:focus-visible + .cbg-check-icon {
  outline: 2px solid var(--cbg-accent);
  outline-offset: 2px;
}

/* Link interni */
.cbg-link {
  color: var(--cbg-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.cbg-link:hover {
  color: var(--cbg-accent-dark);
}

/* Errore */
.cbg-error {
  margin: 0 1.75rem .6rem;
  padding: .6rem .9rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #b91c1c;
  font-size: .875rem;
  line-height: 1.45;
}

/* ── Pulsanti ─────────────────────────────────────────────────────────────── */
.cbg-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .8rem 1.5rem;
  background: var(--cbg-accent);
  color: #fff;
  font-size: .95rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: background var(--cbg-t), box-shadow var(--cbg-t), transform var(--cbg-t);
  box-shadow: 0 2px 10px rgba(26,86,219,.25);
  line-height: 1;
}

.cbg-btn:hover {
  background: var(--cbg-accent-dark);
  box-shadow: 0 4px 16px rgba(26,86,219,.35);
}

.cbg-btn:active {
  transform: scale(.98);
}

.cbg-btn:focus-visible {
  outline: 2px solid var(--cbg-accent);
  outline-offset: 3px;
}

.cbg-btn-arrow {
  font-style: normal;
}

/* Bottone ghost (Indietro) */
.cbg-btn--ghost {
  background: transparent;
  color: var(--cbg-text-muted);
  box-shadow: none;
  padding-left: .25rem;
}

.cbg-btn--ghost:hover {
  background: transparent;
  color: var(--cbg-text);
  box-shadow: none;
}

/* ── Step 3 – Chatbot ─────────────────────────────────────────────────────── */
.cbg-chatbot-wrap,
#customgpt_chat,
.cbg-root iframe {
  height: 800px !important;
  width: 100%;
  border: 0;
  display: block;
  animation: cbg-in .4s ease both;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .cbg-step1-body {
    padding: 1.25rem 1.1rem .75rem;
    gap: .9rem;
  }

  .cbg-step2-header,
  .cbg-checks,
  .cbg-step-footer,
  .cbg-error {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }

  .cbg-chatbot-wrap,
  #customgpt_chat,
  .cbg-root iframe {
    height: 600px !important;
  }
}

/* ── Rich text dentro le checkbox (output wp_editor) ─────────────────────── */
.cbg-text--rich p,
.cbg-text--rich ul,
.cbg-text--rich ol {
  margin: 0;
  padding: 0;
}

.cbg-text--rich ul,
.cbg-text--rich ol {
  padding-left: 1.2em;
}

.cbg-text--rich p + p {
  margin-top: .35em;
}

/* ── Rich text nel testo introduttivo Step 1 ─────────────────────────────── */
.cbg-step1-content p {
  margin: 0 0 .65rem;
}

.cbg-step1-content p:last-child {
  margin-bottom: 0;
}

.cbg-step1-content ul,
.cbg-step1-content ol {
  margin: .3rem 0 .65rem 1.2rem;
  padding: 0;
}

.cbg-step1-content li {
  margin-bottom: .45rem;
  line-height: 1.6;
}

.cbg-step1-content li:last-child {
  margin-bottom: 0;
}
