/* ==========================================================================
   Tour guidato
   ========================================================================== */

/* --- illustrazione e punti della proposta (scheda di benvenuto, onboarding.css) --- */

.tour-welcome-art {
  position: relative;
  width: 200px;
  height: 92px;
  margin-bottom: 4px;
}

.tour-art-app {
  position: absolute;
  left: 64px;
  top: 4px;
  width: 72px;
  height: 72px;
  filter: drop-shadow(0 10px 20px rgba(10, 100, 216, 0.35));
  animation: tour-float 3.2s ease-in-out infinite;
}

.tour-art-folder {
  position: absolute;
  top: 30px;
  width: 64px;
  height: 52px;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2));
}

.tour-art-folder.f1 {
  left: 0;
  transform: rotate(-10deg);
  animation: tour-float 3.6s ease-in-out infinite 0.4s;
}

.tour-art-folder.f2 {
  right: 0;
  transform: rotate(10deg);
  animation: tour-float 3.4s ease-in-out infinite 0.8s;
}

.tour-points {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 4px;
  padding: 0;
  list-style: none;
  text-align: left;
}

.tour-points li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 12px;
  background: var(--hover);
}

.tour-points li > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.tour-points strong {
  font-size: 13px;
}

.tour-points span {
  color: var(--text-2);
  line-height: 1.35;
}

.tour-point-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  padding: 6px;
  border-radius: 9px;
  background: linear-gradient(180deg, #5ac8fa, #0a64d8);
  color: #fff;
}

.tour-points li:nth-child(2) .tour-point-icon {
  background: linear-gradient(180deg, #5be07a, #13a54a);
}

.tour-points li:nth-child(3) .tour-point-icon {
  background: linear-gradient(180deg, #ffd36b, #ff9500);
}

.tour-points li:nth-child(4) .tour-point-icon {
  background: linear-gradient(180deg, #c47cff, #6e3df5);
}

@media (max-width: 480px) {
  .tour-points {
    grid-template-columns: 1fr;
  }
}

/* --- riflettore -------------------------------------------------------------------- */

.tour-blocker {
  position: fixed;
  inset: 0;
  z-index: 9600;
}

.tour-hole {
  position: fixed;
  z-index: 9601;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(8, 8, 20, 0.58), 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 24px 6px rgba(90, 200, 250, 0.55);
  pointer-events: none;
  transition: left 0.45s cubic-bezier(0.3, 0.8, 0.3, 1), top 0.45s cubic-bezier(0.3, 0.8, 0.3, 1),
    width 0.45s cubic-bezier(0.3, 0.8, 0.3, 1), height 0.45s cubic-bezier(0.3, 0.8, 0.3, 1), box-shadow 0.3s;
  animation: fade 0.3s ease-out;
}

.tour-hole::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 18px;
  border: 2px solid rgba(90, 200, 250, 0.8);
  animation: tour-pulse 1.8s ease-out infinite;
}

.tour-hole.none {
  box-shadow: 0 0 0 9999px rgba(8, 8, 20, 0.58);
}

.tour-hole.none::after {
  display: none;
}

.tour-hole.closing,
.tour-blocker.closing,
.tour-card.closing {
  opacity: 0;
  transition: opacity 0.25s;
}

/* --- scheda del passo ------------------------------------------------------------- */

.tour-card {
  position: fixed;
  z-index: 9602;
  width: min(370px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 14px;
  border-radius: 18px;
  background: var(--menu-solid);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4), 0 0 0 0.5px var(--menu-border);
  transition: left 0.45s cubic-bezier(0.3, 0.8, 0.3, 1), top 0.45s cubic-bezier(0.3, 0.8, 0.3, 1), opacity 0.2s;
}

.tour-card.wide {
  width: min(500px, calc(100vw - 24px));
}

.tour-card.switching {
  opacity: 0.4;
}

.tour-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tour-head > div {
  flex: 1;
  min-width: 0;
}

.tour-head small {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tour-head h2 {
  margin: 1px 0 0;
  font-size: 17px;
  line-height: 1.2;
}

.tour-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 12px;
  background: rgba(10, 122, 255, 0.12);
  color: var(--accent);
}

.tour-icon .svg {
  width: 100%;
  height: 100%;
}

.tour-icon:has(svg[viewBox='0 0 64 64']),
.tour-icon:has(svg[viewBox='0 0 100 80']) {
  padding: 0;
  background: none;
}

.tour-close {
  align-self: flex-start;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--hover);
  color: var(--text-2);
}

.tour-close .svg {
  width: 13px;
  height: 13px;
}

.tour-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}

.tour-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tour-dots {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.tour-dots i {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 3px;
  background: var(--text-3);
  opacity: 0.4;
  transition: width 0.3s, background 0.3s, opacity 0.3s;
}

.tour-dots i.done {
  background: var(--accent);
  opacity: 0.45;
}

.tour-dots i.on {
  width: 20px;
  background: var(--accent);
  opacity: 1;
}

.tour-buttons {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.tour-buttons .btn {
  height: 32px;
}

/* freccia che punta all'elemento evidenziato */
.tour-arrow {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--menu-solid);
  transform: rotate(45deg);
  box-shadow: -1px -1px 0 0 var(--menu-border);
}

.tour-arrow.bottom {
  top: -7px;
  margin-left: -7px;
}

.tour-arrow.top {
  bottom: -7px;
  margin-left: -7px;
  box-shadow: 1px 1px 0 0 var(--menu-border);
}

.tour-arrow.right {
  left: -7px;
  margin-top: -7px;
  box-shadow: -1px 1px 0 0 var(--menu-border);
}

.tour-arrow.left {
  right: -7px;
  margin-top: -7px;
  box-shadow: 1px -1px 0 0 var(--menu-border);
}

/* --- illustrazione: Anteprima PDF ----------------------------------------------------- */

.tm-viewer {
  border-radius: 12px;
  overflow: hidden;
  background: var(--content-bg);
  box-shadow: 0 0 0 0.5px var(--border), 0 8px 24px rgba(0, 0, 0, 0.15);
}

.tm-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 0.5px solid var(--border);
  background: var(--toolbar-bg);
}

.tm-dots {
  display: flex;
  gap: 4px;
  margin-right: 6px;
}

.tm-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff5f57;
}

.tm-dots i:nth-child(2) {
  background: #febc2e;
}

.tm-dots i:nth-child(3) {
  background: #28c840;
}

.tm-tool {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 3px 5px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 9px;
}

.tm-tool .svg {
  width: 15px;
  height: 15px;
}

.tm-tool i {
  font-style: normal;
}

.tm-tool.hot {
  color: var(--accent);
  background: rgba(10, 122, 255, 0.12);
  animation: tour-glow 2.4s ease-in-out infinite;
}

.tm-tool.hot:nth-child(4) {
  animation-delay: 0.3s;
}

.tm-tool.hot:nth-child(5) {
  animation-delay: 0.6s;
}

.tm-tool.hot:nth-child(6) {
  animation-delay: 0.9s;
}

.tm-body {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--pdfv-canvas, #8e8e93);
}

.tm-thumbs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tm-thumbs i {
  width: 30px;
  height: 40px;
  border-radius: 2px;
  background: #fff;
  opacity: 0.85;
}

.tm-thumbs i.on {
  box-shadow: 0 0 0 2px var(--accent);
  opacity: 1;
}

.tm-page {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px 16px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.tm-title {
  width: 55%;
  height: 9px;
  margin-bottom: 4px;
  border-radius: 3px;
  background: #3a3a3c;
}

.tm-line {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: #d1d1d6;
}

.tm-line:nth-of-type(3n) {
  width: 80%;
}

.tm-resume {
  position: absolute;
  left: 50%;
  bottom: 8px;
  padding: 3px 10px;
  border-radius: 10px;
  background: rgba(28, 28, 30, 0.85);
  color: #fff;
  font-size: 10px;
  white-space: nowrap;
  transform: translateX(-50%);
  animation: tour-toast 3s ease-in-out infinite;
}

/* --- illustrazione: voti, versioni, segnalazioni ----------------------------------------- */

.tm-community {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: stretch;
}

.tm-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  background: var(--row-alt);
  font-size: 12px;
  animation: tour-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.tm-card .svg {
  width: 22px;
  height: 22px;
}

.tm-vote {
  color: var(--accent);
  background: rgba(10, 122, 255, 0.1);
}

.tm-vote strong {
  font-size: 20px;
  animation: tour-count 2.4s ease-in-out infinite;
}

.tm-vote span {
  color: var(--text-2);
}

.tm-version {
  align-items: flex-start;
  text-align: left;
  animation-delay: 0.15s;
}

.tm-version b {
  color: var(--accent);
  font-size: 11px;
}

.tm-version em {
  margin-top: 4px;
  padding-left: 8px;
  border-left: 2px solid var(--border);
  color: var(--text-2);
  font-style: normal;
  font-size: 11px;
}

.tm-flag {
  color: var(--danger);
  background: rgba(255, 59, 48, 0.08);
  animation-delay: 0.3s;
}

@media (max-width: 480px) {
  .tm-community {
    grid-template-columns: 1fr 1fr;
  }

  .tm-version {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* --- cartella che vola sulla scrivania --------------------------------------------------- */

.tour-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9603;
  width: 72px;
  height: 58px;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.4));
}

.tour-ghost > .svg:first-child {
  width: 100%;
  height: 100%;
}

.tour-ghost-cursor {
  position: absolute;
  right: -8px;
  bottom: -10px;
  width: 22px;
  height: 22px;
  color: #fff;
  transform: rotate(-45deg);
}

/* --- animazioni ------------------------------------------------------------------------ */

@keyframes tour-pop {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
}

@keyframes tour-float {
  50% {
    translate: 0 -6px;
  }
}

@keyframes tour-pulse {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.06);
  }
}

@keyframes tour-glow {
  0%,
  100% {
    box-shadow: none;
  }
  50% {
    box-shadow: 0 0 0 2px rgba(10, 122, 255, 0.45);
  }
}

@keyframes tour-toast {
  0%,
  70% {
    opacity: 0;
  }
  80%,
  100% {
    opacity: 1;
  }
}

@keyframes tour-count {
  0%,
  40% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.25);
  }
  60%,
  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tour-hole,
  .tour-card {
    transition: none;
  }
}

/* --- esempio di ricerca nel testo (passo "Cerca anche dentro i documenti") ------------------ */

.tm-search {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: tour-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.tm-search-q {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 9px;
  background: var(--row-alt);
  font-size: 13px;
}

.tm-search-q .svg {
  width: 15px;
  height: 15px;
  color: var(--text-2);
}

.tm-search-hit {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
}

.tm-search-icon {
  flex-shrink: 0;
  width: 30px;
  height: 36px;
}

.tm-search-hit strong {
  display: block;
  font-size: 13px;
}

.tm-search-hit small {
  display: block;
  opacity: 0.85;
}

.tm-search-hit p {
  margin: 4px 0 0;
  line-height: 1.4;
}

.tm-search-hit mark {
  padding: 0 2px;
  border-radius: 3px;
  background: rgba(255, 214, 10, 0.9);
  color: #1d1d1f;
}
