/* === Claudia widget — DDArch team-area ============================== */

/* Palette petrolio — scoped ai soli elementi del widget */
.claudia-mascot, .claudia-panel, .claudia-greet, .claudia-menu,
.claudia-header-btn, .claudia-launcher--floating,
.driver-popover.claudia-popover {
  --cl-bg: #0f171c;
  --cl-card: #141e24;
  --cl-accent: #3a9097;
  --cl-accent-soft: rgba(58, 144, 151, .2);
  --cl-ink: #e8eef0;
  --cl-ink-dim: rgba(232, 238, 240, .65);
  --cl-line: rgba(58, 144, 151, .35);
}

#claudia-root { position: fixed; z-index: 9000; inset: auto 24px 24px auto; pointer-events: none; }
.claudia-mascot {
  position: fixed; right: 24px; bottom: 24px; width: 96px; height: 96px;
  z-index: 1000000001;
  pointer-events: auto; cursor: pointer; user-select: none;
  border-radius: 50%; object-fit: cover; overflow: hidden;
  transition: transform .55s cubic-bezier(.34,1.56,.64,1), left .55s cubic-bezier(.4,0,.2,1), top .55s cubic-bezier(.4,0,.2,1), right .55s cubic-bezier(.4,0,.2,1), bottom .55s cubic-bezier(.4,0,.2,1), opacity .3s;
  animation: claudia-idle 3.2s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,.28));
}
.claudia-mascot img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.claudia-mascot.claudia-entering { animation: claudia-pop .7s cubic-bezier(.34,1.56,.64,1) both; }
.claudia-mascot.claudia-guiding { animation: none; }
.claudia-mascot.claudia-celebrate { animation: claudia-jump .6s ease-in-out 2; }
@keyframes claudia-idle { 0%,100% { transform: translateY(0) rotate(0deg);} 50% { transform: translateY(-7px) rotate(-1.5deg);} }
@keyframes claudia-pop { from { transform: scale(0) translateY(40px); opacity: 0;} to { transform: scale(1) translateY(0); opacity: 1;} }
@keyframes claudia-jump { 0%,100% { transform: translateY(0);} 40% { transform: translateY(-18px) rotate(3deg);} }

/* launcher flottante (pagine interne — on-demand) */
.claudia-launcher--floating {
  position: fixed; right: 24px; bottom: 24px; z-index: 1000000001;
  display: none;
}
.claudia-launcher--floating.visible { display: block; }
.claudia-launcher--floating img {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover; cursor: pointer;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.28));
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.claudia-launcher--floating img:hover { transform: scale(1.08); }

/* popover driver ristilizzato come fumetto DDArch */
.driver-popover.claudia-popover {
  background: var(--cl-card); color: var(--cl-ink);
  border: 1px solid var(--cl-line); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45); max-width: 340px;
  font-family: inherit;
}
:root[data-theme="light"] .driver-popover.claudia-popover { background: #f4f8f9; color: #1c1c1c; }
.driver-popover.claudia-popover .driver-popover-title { font-size: 15px; color: var(--cl-accent); }
.driver-popover.claudia-popover .driver-popover-navigation-btns button {
  background: transparent; border: 1px solid var(--cl-line);
  color: inherit; border-radius: 999px; padding: 5px 14px; text-shadow: none;
}
.driver-popover.claudia-popover .driver-popover-navigation-btns button:hover { background: var(--cl-accent); color: #fff; }
.driver-popover.claudia-popover .driver-popover-progress-text { font-family: var(--ff-mono, monospace); font-size: 11px; letter-spacing: .12em; }

/* bottone header */
.claudia-header-btn {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--cl-line); border-radius: 999px; padding: 3px 12px 3px 4px;
  font-family: var(--ff-mono, monospace); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--cl-ink-dim); transition: border-color .2s, color .2s;
  position: relative;
}
.claudia-header-btn:hover { color: var(--cl-accent); border-color: var(--cl-accent); }
.claudia-header-btn img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; display: block; }
@media (max-width: 720px) { .claudia-header-btn span { display: none; } .claudia-header-btn { padding: 3px 6px; } }
.claudia-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px;
  background: var(--cl-bg); border: 1px solid var(--cl-line);
  border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.4); z-index: 9100;
}
.claudia-menu button { all: unset; display: block; width: 100%; box-sizing: border-box; cursor: pointer; padding: 9px 12px; border-radius: 8px; font-size: 13px; color: inherit; }
.claudia-menu button:hover { background: var(--cl-accent-soft); color: var(--cl-accent); }

/* pannello novità */
.claudia-panel {
  position: fixed; right: 24px; bottom: 140px; width: 360px; max-width: calc(100vw - 32px);
  max-height: 60vh; display: flex; flex-direction: column; z-index: 9050;
  background: var(--cl-bg); border: 1px solid var(--cl-line);
  border-radius: 16px; box-shadow: 0 16px 48px rgba(0,0,0,.5); overflow: hidden;
  transform-origin: bottom right; animation: claudia-pop .45s cubic-bezier(.34,1.56,.64,1) both;
}
:root[data-theme="light"] .claudia-panel, :root[data-theme="light"] .claudia-menu { background: #f4f8f9; }
.claudia-panel__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--cl-line); }
.claudia-panel__head img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.claudia-panel__head .t { font-size: 14px; font-weight: 600; }
.claudia-panel__head .s { font-family: var(--ff-mono, monospace); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--cl-accent); }
.claudia-panel__close { all: unset; cursor: pointer; margin-left: auto; padding: 4px 8px; opacity: .6; }
.claudia-panel__close:hover { opacity: 1; }
.claudia-panel__msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.claudia-msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; animation: claudia-msg-in .3s ease both; }
.claudia-msg--bot { align-self: flex-start; background: var(--cl-accent-soft); border: 1px solid var(--cl-line); border-bottom-left-radius: 4px; }
.claudia-msg--user { align-self: flex-end; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-bottom-right-radius: 4px; }
:root[data-theme="light"] .claudia-msg--user { background: rgba(0,0,0,.05); border-color: rgba(0,0,0,.08); }
@keyframes claudia-msg-in { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: none;} }
.claudia-typing { display: inline-flex; gap: 4px; padding: 10px 12px; }
.claudia-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--cl-accent); animation: claudia-blink 1s infinite; }
.claudia-typing i:nth-child(2){ animation-delay: .2s } .claudia-typing i:nth-child(3){ animation-delay: .4s }
@keyframes claudia-blink { 0%,100% { opacity: .25 } 50% { opacity: 1 } }
.claudia-action-card { border: 1px dashed var(--cl-line); border-radius: 10px; padding: 10px; margin-top: 6px; font-size: 12.5px; }
.claudia-action-card .badge { font-family: var(--ff-mono, monospace); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--cl-accent); }
.claudia-action-card button { all: unset; display: inline-block; margin-top: 8px; padding: 5px 14px; border-radius: 999px; border: 1px solid var(--cl-line); opacity: .45; cursor: not-allowed; font-size: 12px; }
.claudia-panel__input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--cl-line); }
.claudia-panel__input input { flex: 1; background: transparent; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: 8px 14px; color: inherit; font-size: 13px; opacity: .55; cursor: not-allowed; }
:root[data-theme="light"] .claudia-panel__input input { border-color: rgba(0,0,0,.15); }

@media (prefers-reduced-motion: reduce) {
  .claudia-mascot, .claudia-panel, .claudia-msg { animation: none !important; transition: opacity .2s !important; }
}

/* === badge novità sul bottone header ================================= */
.claudia-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--cl-accent); color: #fff;
  font-family: var(--ff-mono, monospace); font-size: 10px; font-weight: 700;
  border-radius: 999px; line-height: 1;
  position: absolute; top: -4px; right: -4px;
  pointer-events: none;
}

/* === pannello novità ================================================== */
.claudia-panel--news .claudia-news-list { padding: 8px 14px 14px; }
.claudia-news-entry {
  padding: 10px 0; border-bottom: 1px solid var(--cl-line);
}
.claudia-news-entry:last-child { border-bottom: none; }
.claudia-news-date {
  font-family: var(--ff-mono, monospace); font-size: 10px; letter-spacing: .1em;
  color: var(--cl-accent); opacity: .7; margin-bottom: 4px;
}
.claudia-news-title {
  font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.claudia-new-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--cl-accent); flex-shrink: 0;
}
.claudia-news-text { font-size: 12.5px; line-height: 1.5; opacity: .82; }
.claudia-news-empty { font-size: 13px; opacity: .5; padding: 14px 0; text-align: center; }
:root[data-theme="light"] .claudia-news-entry { border-color: rgba(0,0,0,.09); }

/* === fumetto saluto del giorno ======================================= */
.claudia-greet {
  position: fixed; right: 128px; bottom: 48px;
  background: var(--cl-accent); color: #fff;
  font-size: 13px; font-weight: 600; line-height: 1.4;
  padding: 10px 16px; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.32);
  cursor: pointer; z-index: 1000000002;
  max-width: 220px;
  animation: claudia-greet-in .45s cubic-bezier(.34,1.56,.64,1) both;
}
/* coda del fumetto verso la mascotte (destra) */
.claudia-greet::after {
  content: ""; position: absolute; right: -10px; bottom: 18px;
  border: 6px solid transparent; border-left-color: var(--cl-accent);
}
@keyframes claudia-greet-in {
  from { opacity: 0; transform: scale(.8) translateX(12px); }
  to   { opacity: 1; transform: scale(1) translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .claudia-greet { animation: none; }
}
:root[data-theme="light"] .claudia-greet { box-shadow: 0 8px 24px rgba(0,0,0,.18); }

/* === modalità discreta (pagine interne) ============================= */
/* In modalità discreta la mascotte non è present — solo il bottone header è visibile.
   La figurina appare solo durante il tour, al saluto novità, e all'apertura pannello. */
body.claudia-mode--discreet .claudia-mascot { display: none; }
body.claudia-mode--discreet.claudia-show-mascot .claudia-mascot { display: block; }

/* === pannello chat viva (cantiere #chatbot-claudia-team-desk) ======= */
.claudia-panel--chat .claudia-panel__input input { opacity: 1; cursor: text; }
.claudia-msg--waiting { opacity: .7; font-style: italic; }
.claudia-chat-note { padding: 4px 12px; font-size: .78rem; color: var(--cl-accent); display: none; }
.claudia-send-btn { background: var(--cl-accent); color: #0f171c; border: 0; border-radius: 6px; padding: 6px 14px; cursor: pointer; font-weight: 600; font-size: 13px; }
.claudia-send-btn:disabled { opacity: .5; cursor: not-allowed; }
.claudia-menu__secondary { font-size: .78rem; opacity: .65; }
