/* ─────────────────────────────────────────────────────────────────────
 *  Capitalys, Onboarding Tutorial styles
 *
 *  Overlay sombre + spotlight clair sur l'élément expliqué + tooltip
 *  flottant avec flèche directionnelle.
 *  Palette alignée sur Capitalys (gold #8B7340, navy #2D2A24).
 * ──────────────────────────────────────────────────────────────────── */

/* ── Overlay (full screen) ──────────────────────────────────────── */
.tut-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  animation: tut-fade-in .25s ease-out;
}

.tut-overlay.tut-fade-out {
  animation: tut-fade-out .22s ease-in forwards;
}

@keyframes tut-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes tut-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* The mask is a fixed dark rectangle. The spotlight cuts a clear hole
 * by being positioned on top of the mask with its own (transparent) area
 * and a strong box-shadow that paints the rest of the screen dark. This
 * is the standard "spotlight without filter blur" technique. */
.tut-mask {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, .55);
  pointer-events: auto;  /* catches clicks but does nothing */
}

.tut-spotlight {
  position: absolute;
  background: transparent;
  border-radius: 10px;
  box-shadow:
    0 0 0 9999px rgba(20, 20, 20, .58),
    0 0 0 2px rgba(139, 115, 64, .85),
    0 0 24px 4px rgba(139, 115, 64, .35);
  pointer-events: none;
  transition: top .35s cubic-bezier(.4, 0, .2, 1),
              left .35s cubic-bezier(.4, 0, .2, 1),
              width .35s cubic-bezier(.4, 0, .2, 1),
              height .35s cubic-bezier(.4, 0, .2, 1);
}

/* SVG overlay for multi-zone spotlights (used when a step needs several
 * separate "holes" in the dark layer). */
.tut-svg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Hide the mask once the spotlight covers it (we use only the spotlight's
 * box-shadow as the dark area for clean edges). */
.tut-overlay .tut-mask {
  display: none;
}

/* ── Tooltip ───────────────────────────────────────────────────── */
.tut-tooltip {
  position: fixed;
  z-index: 9999;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: #FAF9F5;
  border: 1px solid rgba(139, 115, 64, .25);
  border-radius: 12px;
  padding: 18px 20px 16px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, .08),
    0 16px 40px rgba(0, 0, 0, .12);
  font-family: var(--sans);
  color: var(--text);
  pointer-events: auto;
  animation: tut-tooltip-in .28s cubic-bezier(.34, 1.36, .64, 1);
}

@keyframes tut-tooltip-in {
  from {
    opacity: 0;
    transform: scale(.94) translateY(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.tut-tooltip .tut-counter {
  display: inline-block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gold, #8B7340);
  margin-bottom: 8px;
}

.tut-tooltip .tut-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.2px;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 8px;
}

.tut-tooltip .tut-body {
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  opacity: .82;
  margin-bottom: 16px;
}

/* ── Actions row ─────────────────────────────────────────────────── */
.tut-tooltip .tut-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tut-tooltip .tut-skip {
  background: transparent;
  border: none;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text);
  opacity: .5;
  cursor: pointer;
  padding: 6px 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity .15s, color .15s;
}

.tut-tooltip .tut-skip:hover {
  opacity: .85;
  color: var(--gold, #8B7340);
}

.tut-tooltip .tut-next {
  background: var(--text);
  color: #FAF9F5;
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, transform .12s, box-shadow .15s;
}

.tut-tooltip .tut-next:hover {
  background: var(--gold, #8B7340);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 115, 64, .25);
}

.tut-tooltip .tut-next:active {
  transform: translateY(0);
}

/* ── Tooltip arrow ─────────────────────────────────────────────── */
.tut-tooltip::before,
.tut-tooltip::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border: 10px solid transparent;
}

/* Arrow on the LEFT of tooltip → tooltip is to the RIGHT of target */
.tut-tooltip[data-side="right"]::before {
  top: 50%;
  left: -11px;
  transform: translateY(-50%);
  border-right-color: rgba(139, 115, 64, .25);
}
.tut-tooltip[data-side="right"]::after {
  top: 50%;
  left: -10px;
  transform: translateY(-50%);
  border-right-color: #FAF9F5;
}

/* Arrow on the RIGHT of tooltip → tooltip is to the LEFT of target */
.tut-tooltip[data-side="left"]::before {
  top: 50%;
  right: -11px;
  transform: translateY(-50%);
  border-left-color: rgba(139, 115, 64, .25);
}
.tut-tooltip[data-side="left"]::after {
  top: 50%;
  right: -10px;
  transform: translateY(-50%);
  border-left-color: #FAF9F5;
}

/* Arrow on TOP of tooltip → tooltip is BELOW the target */
.tut-tooltip[data-side="bottom"]::before {
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: rgba(139, 115, 64, .25);
}
.tut-tooltip[data-side="bottom"]::after {
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: #FAF9F5;
}

/* Arrow on BOTTOM of tooltip → tooltip is ABOVE the target */
.tut-tooltip[data-side="top"]::before {
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: rgba(139, 115, 64, .25);
}
.tut-tooltip[data-side="top"]::after {
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: #FAF9F5;
}

/* ── Mobile adjustments ────────────────────────────────────────── */
@media(max-width:720px) {
  .tut-tooltip {
    width: calc(100vw - 32px);
    padding: 16px 18px 14px;
  }
  .tut-tooltip .tut-title {
    font-size: 16px;
  }
  .tut-tooltip .tut-body {
    font-size: 13px;
  }
}

/* ── Floating help button ────────────────────────────────────────── */
.tut-help-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(45, 42, 36, .85);
  color: #FAF9F5;
  border: none;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12), 0 8px 24px rgba(0, 0, 0, .08);
  opacity: .55;
  transition: opacity .2s, transform .15s, background .2s;
}

.tut-help-btn:hover {
  opacity: 1;
  background: var(--gold, #8B7340);
  transform: translateY(-2px);
}

.tut-help-btn:active {
  transform: translateY(0);
}

/* Hide help button while tutorial is active to avoid duplication */
body:has(.tut-overlay) .tut-help-btn,
.tut-help-btn[hidden] {
  display: none;
}

@media(max-width:720px) {
  .tut-help-btn {
    bottom: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    font-size: 16px;
  }
}
