/* Lato è il font usato in tutto il sito aliita.com (nav, titoli, bottoni):
   lo stesso font qui rende il widget coerente con il resto del negozio. Se
   il Google Font non si carica, ricade su un sans-serif di sistema. */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap');

:root {
  --ccw-accent: #aebbb4;
  --ccw-accent-dark: #8ea19e;
  --ccw-send: #ee9788;
  --ccw-send-hover: #ca8074;
  --ccw-accent-text: #1a1a1a;
  --ccw-ink: #262625;
  --ccw-ink-soft: #6f6b64;
  --ccw-bg: #fffdfb;
  --ccw-surface: #f6f4f1;
  --ccw-border: #e7e2da;
  --ccw-sans: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.ccw-bubble {
  position: fixed;
  bottom: 24px;
  width: 62px;
  height: 62px;
  background: none;
  color: var(--ccw-accent);
  cursor: pointer;
  z-index: 999998;
  border: none;
  padding: 0;
  transition: transform 0.2s ease, color 0.2s ease;
}

.ccw-bubble:hover {
  color: var(--ccw-accent-dark);
  transform: translateY(-2px) scale(1.04);
}

/* Il fumetto vero e proprio: un cerchio SVG con una codina disegnata come
   curva (non un quadrato ruotato), quindi con angoli morbidi e naturali.
   drop-shadow segue la sagoma esatta invece di proiettare un'ombra
   rettangolare come farebbe box-shadow su questa forma irregolare. */
.ccw-bubble-shape {
  position: absolute;
  top: 0;
  left: 0;
  filter: drop-shadow(0 8px 18px rgba(26, 26, 26, 0.22)) drop-shadow(0 2px 6px rgba(26, 26, 26, 0.12));
}

.ccw-bubble-letter {
  position: absolute;
  left: 50%;
  top: 47%;
  transform: translate(-50%, -50%);
  font-family: var(--ccw-sans);
  font-weight: 300;
  font-size: 22px;
  line-height: 1;
  color: #fff;
}

.ccw-panel {
  position: fixed;
  bottom: 100px;
  width: 420px;
  max-width: calc(100vw - 32px);
  height: 660px;
  max-height: calc(100vh - 120px);
  background: var(--ccw-bg);
  border: 1px solid var(--ccw-border);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(26, 26, 26, 0.2), 0 6px 20px rgba(26, 26, 26, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  font-family: var(--ccw-sans);
  color: var(--ccw-ink);
}

.ccw-panel:not(.ccw-hidden) {
  animation: ccw-panel-in 0.22s ease;
}

@keyframes ccw-panel-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Lato di posizionamento: di default a sinistra, per non sovrapporsi al
   pulsante "torna su" che molti temi Shopify (Broadcast incluso) mettono in
   basso a destra. Impostabile dal tema con data-position="right". */
.ccw-pos-left {
  left: 20px;
}

.ccw-pos-right {
  right: 20px;
}

.ccw-hidden {
  display: none !important;
}

.ccw-header {
  background: var(--ccw-accent);
  color: var(--ccw-accent-text);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ccw-header-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.ccw-header-title {
  font-family: var(--ccw-sans);
  font-weight: 300;
  font-size: 19px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
}

.ccw-header-subtitle {
  font-family: var(--ccw-sans);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  opacity: 1;
}

.ccw-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  font-weight: 300;
  cursor: pointer;
  line-height: 1;
  opacity: 1;
  transition: opacity 0.15s ease;
  padding: 4px;
}

.ccw-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ccw-header button.ccw-expand {
  font-size: 17px;
}

.ccw-panel.ccw-large {
  width: 580px;
  height: 780px;
}

.ccw-header button:hover {
  opacity: 1;
}

.ccw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--ccw-surface);
}

.ccw-messages::-webkit-scrollbar {
  width: 6px;
}

.ccw-messages::-webkit-scrollbar-thumb {
  background: var(--ccw-border);
  border-radius: 3px;
}

.ccw-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 300;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.ccw-msg.user {
  align-self: flex-end;
  background: var(--ccw-accent);
  color: var(--ccw-accent-text);
  border-bottom-right-radius: 2px;
}

.ccw-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: var(--ccw-ink);
  border: 1px solid var(--ccw-border);
  border-bottom-left-radius: 2px;
}

.ccw-msg.system {
  align-self: center;
  background: transparent;
  color: var(--ccw-ink-soft);
  font-size: 12px;
  text-align: center;
  max-width: 100%;
}

.ccw-msg.system a {
  color: inherit;
  text-decoration: underline;
}

.ccw-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}

.ccw-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ccw-accent-dark);
  display: inline-block;
  animation: ccw-typing-bounce 1.2s infinite ease-in-out;
}

.ccw-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.ccw-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ccw-typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.ccw-inputrow {
  display: flex;
  border-top: 1px solid var(--ccw-border);
  padding: 10px;
  gap: 8px;
  background: var(--ccw-bg);
}

.ccw-inputrow input {
  flex: 1;
  border: 1px solid var(--ccw-border);
  border-radius: 3px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 300;
  font-family: var(--ccw-sans);
  outline: none;
  background: var(--ccw-surface);
  color: var(--ccw-ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ccw-inputrow input:focus {
  border-color: var(--ccw-accent-dark);
  background: #fff;
}

.ccw-inputrow button {
  background: var(--ccw-send);
  color: var(--ccw-accent-text);
  border: none;
  border-radius: 3px;
  padding: 0 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ccw-inputrow button:hover:not(:disabled) {
  background: var(--ccw-send-hover);
}

.ccw-inputrow button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Modulo compatto: nome e email affiancati, messaggio basso, cosi' resta piu' spazio
   per leggere la chat. Se lo schermo e' molto basso il modulo scorre su se' stesso. */
.ccw-contact-form {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--ccw-border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #fff;
  flex: 0 1 auto;
  max-height: 52%;
  overflow-y: auto;
}

.ccw-contact-form.ccw-hidden {
  display: none;
}

.ccw-contact-form .ccw-small-note,
.ccw-contact-form textarea,
.ccw-contact-form button {
  grid-column: 1 / -1;
}

.ccw-contact-form input,
.ccw-contact-form textarea {
  min-width: 0;
}

.ccw-contact-form textarea {
  min-height: 52px;
  height: 52px;
}

.ccw-messages {
  min-height: 130px;
}

.ccw-contact-form input,
.ccw-contact-form textarea {
  border: 1px solid var(--ccw-border);
  border-radius: 3px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 300;
  font-family: var(--ccw-sans);
  resize: vertical;
  background: var(--ccw-surface);
  color: var(--ccw-ink);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ccw-contact-form input:focus,
.ccw-contact-form textarea:focus {
  border-color: var(--ccw-accent-dark);
  background: #fff;
}

.ccw-contact-form button {
  background: var(--ccw-accent);
  color: var(--ccw-accent-text);
  border: none;
  border-radius: 3px;
  padding: 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ccw-contact-form button:hover:not(:disabled) {
  background: var(--ccw-accent-dark);
}

.ccw-small-note {
  font-size: 11.5px;
  color: var(--ccw-ink-soft);
  text-align: center;
  line-height: 1.4;
}

/* Animazione "a riposo": quando la pagina resta ferma per qualche secondo un riflesso
   traslucido attraversa il fumetto (clippato sulla sua forma) e il fumetto fa un piccolo
   saltino. Parte da JS aggiungendo la classe .ccw-shine-on; si disattiva con
   data-idle-delay="0" e rispetta prefers-reduced-motion. */
.ccw-shine {
  opacity: 0;
}

.ccw-bubble.ccw-shine-on {
  animation: ccw-bubble-nudge 1.3s cubic-bezier(0.4, 0, 0.2, 1) 1;
}

.ccw-bubble.ccw-shine-on .ccw-shine {
  animation: ccw-shine-sweep 1.5s cubic-bezier(0.45, 0.05, 0.55, 0.95) 1;
}

@keyframes ccw-shine-sweep {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(64px);
    opacity: 1;
  }
}

@keyframes ccw-bubble-nudge {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  35% {
    transform: translateY(-4px) scale(1.06);
  }
  70% {
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ccw-bubble.ccw-shine-on,
  .ccw-bubble.ccw-shine-on .ccw-shine {
    animation: none;
  }
}


/* ------------------------------------------------ schede dei prodotti consigliati */
.ccw-cards {
  align-self: stretch;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ccw-cards.ccw-hidden {
  display: none;
}

.ccw-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--ccw-border);
  border-radius: 6px;
  overflow: hidden;
  color: var(--ccw-ink);
  text-decoration: none;
  transition: box-shadow 0.15s ease;
}

.ccw-card:hover {
  box-shadow: 0 4px 14px rgba(26, 26, 26, 0.12);
}

.ccw-card-img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fff;
}

.ccw-card-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ccw-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 6px 8px 0;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}

.ccw-card-price {
  padding: 2px 8px 8px;
  font-size: 11px;
  font-weight: 300;
  color: var(--ccw-ink-soft);
}

.ccw-card-sold {
  margin-left: 6px;
  font-size: 11px;
  color: var(--ccw-send-hover);
}
