/* ================================================================
   Brokerr — Tour & Try-This Feature
   ================================================================ */

/* ---------- "Try this" floating panel ---------- */
.try-this-panel {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0) + 88px);
  right: 20px;
  width: 300px;
  background: white;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  z-index: 850;
  animation: try-this-in 350ms ease;
  overflow: hidden;
}
@keyframes try-this-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.try-this-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.08), rgba(27, 42, 74, 0.03));
  border-bottom: 1px solid var(--color-gray-100);
}
.try-this-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.try-this-close {
  background: none;
  border: none;
  color: var(--color-gray-400);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.try-this-close:hover { color: var(--color-gray-700); }
.try-this-commands {
  display: flex;
  flex-direction: column;
  padding: 4px;
}
.try-this-cmd {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  background: none;
  border: none;
  padding: 8px 10px;
  text-align: left;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-xs);
  color: var(--color-gray-700);
  transition: all 0.15s;
}
.try-this-cmd:hover {
  background: var(--color-gray-50);
  color: var(--color-primary);
}
.try-this-cmd-icon {
  color: var(--color-secondary);
  font-weight: bold;
  flex-shrink: 0;
}
.try-this-cmd-text {
  line-height: 1.4;
  font-style: italic;
}

@media (max-width: 767px) {
  .try-this-panel { display: none; }
}

/* ---------- Interactive Tour v2 ---------- */

/* Overlay container */
.tour-v2-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: auto;
  animation: tour-v2-enter 400ms cubic-bezier(0.16, 1, 0.3, 1);
}
.tour-v2-overlay.tour-v2-exit {
  animation: tour-v2-leave 250ms ease forwards;
}
@keyframes tour-v2-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes tour-v2-leave {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Frosted backdrop */
.tour-v2-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px) saturate(1.2);
  -webkit-backdrop-filter: blur(6px) saturate(1.2);
  pointer-events: auto;
  cursor: default;
  transition: clip-path 400ms cubic-bezier(0.4, 0, 0.2, 1);
}
.tour-v2-backdrop--full {
  clip-path: none !important;
}

/* Highlighted element */
.tour-highlighted {
  position: relative;
  z-index: 9050;
  box-shadow:
    0 0 0 3px rgba(13, 148, 136, 0.5),
    0 0 0 6px rgba(13, 148, 136, 0.15),
    0 0 40px rgba(13, 148, 136, 0.1);
  border-radius: 8px;
  animation: tour-v2-pulse 2.5s ease-in-out infinite;
}
@keyframes tour-v2-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 3px rgba(13, 148, 136, 0.5),
      0 0 0 6px rgba(13, 148, 136, 0.15),
      0 0 40px rgba(13, 148, 136, 0.1);
  }
  50% {
    box-shadow:
      0 0 0 5px rgba(13, 148, 136, 0.3),
      0 0 0 10px rgba(13, 148, 136, 0.08),
      0 0 48px rgba(13, 148, 136, 0.06);
  }
}

/* Tooltip card */
.tour-v2-card {
  position: fixed;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.14),
    0 8px 24px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 22px 24px 18px;
  width: 380px;
  max-width: calc(100vw - 24px);
  z-index: 9100;
  animation: tour-v2-card-in 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tour-v2-card--mobile {
  width: auto;
  left: 8px !important;
  right: 8px !important;
  bottom: 8px !important;
  top: auto !important;
  transform: none !important;
  border-radius: 20px 20px 16px 16px;
  padding: 16px 20px 18px;
  animation: tour-v2-slide-up 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Mobile sheet handle */
.tour-v2-card--mobile::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--color-gray-300);
  border-radius: 2px;
  margin: 0 auto 12px;
}
@keyframes tour-v2-card-in {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes tour-v2-slide-up {
  from { opacity: 0; transform: translateY(60px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Step counter */
.tour-v2-step-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-secondary);
  background: rgba(13, 148, 136, 0.08);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tour-v2-card__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-primary, #1B2A4A);
  margin-bottom: 6px;
  line-height: 1.3;
  letter-spacing: -0.2px;
}
.tour-v2-card__body {
  font-size: 13.5px;
  color: var(--color-gray-600, #475569);
  line-height: 1.6;
  margin-bottom: 16px;
}
.tour-v2-card__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--color-gray-100);
}
.tour-v2-card__nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Fullscreen card (welcome + completion) */
.tour-v2-fullscreen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9100;
  padding: 24px;
}
.tour-v2-fullscreen__inner {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  box-shadow:
    0 32px 100px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(0, 0, 0, 0.03);
  padding: 52px 44px 40px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  animation: tour-v2-scale-in 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes tour-v2-scale-in {
  from { opacity: 0; transform: scale(0.88) translateY(24px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.tour-v2-fullscreen__icon {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}
.tour-v2-fullscreen__title {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-primary, #1B2A4A);
  margin-bottom: 10px;
  letter-spacing: -0.6px;
}
.tour-v2-fullscreen__body {
  font-size: 15px;
  color: var(--color-gray-500, #64748B);
  line-height: 1.65;
  margin-bottom: 32px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.tour-v2-fullscreen__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Logo icon for welcome */
.tour-v2-logo-icon {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background: linear-gradient(145deg, #0D9488, #0A7A70);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 34px;
  font-weight: 800;
  box-shadow:
    0 12px 40px rgba(13, 148, 136, 0.35),
    0 0 0 1px rgba(13, 148, 136, 0.1);
  letter-spacing: -1px;
}

/* Icon circle */
.tour-v2-icon-circle {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tour-v2-icon-circle--teal {
  background: linear-gradient(145deg, #0D9488, #0A7A70);
  box-shadow: 0 10px 32px rgba(13, 148, 136, 0.3);
}

/* Quick links grid (completion step) */
.tour-v2-quicklinks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 28px;
}
.tour-v2-quicklink {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200, #E2E8F0);
  border-radius: 14px;
  text-decoration: none;
  color: var(--color-primary, #1B2A4A);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}
.tour-v2-quicklink:hover {
  border-color: var(--color-secondary);
  background: rgba(13, 148, 136, 0.04);
  color: var(--color-secondary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.12);
}
.tour-v2-quicklink__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: white;
  border: 1px solid var(--color-gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gray-600, #475569);
  transition: all 0.2s ease;
}
.tour-v2-quicklink:hover .tour-v2-quicklink__icon {
  background: rgba(13, 148, 136, 0.08);
  border-color: rgba(13, 148, 136, 0.2);
  color: var(--color-secondary);
}

/* Progress dots */
.tour-v2-progress {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: 16px;
}
.tour-v2-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-gray-200, #E2E8F0);
  transition: all 350ms cubic-bezier(0.4, 0, 0.2, 1);
}
.tour-v2-dot--active {
  background: var(--color-secondary);
  width: 22px;
  border-radius: 3px;
}
.tour-v2-dot--done {
  background: var(--color-secondary);
  opacity: 0.35;
}

/* Buttons */
.tour-v2-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.tour-v2-btn--sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;
}
.tour-v2-btn--lg {
  padding: 14px 36px;
  font-size: 15px;
  border-radius: 12px;
}
.tour-v2-btn--primary {
  background: linear-gradient(145deg, #0D9488, #0A7A70);
  color: white;
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.3);
}
.tour-v2-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.35);
}
.tour-v2-btn--secondary {
  background: var(--color-gray-100, #F1F5F9);
  color: var(--color-gray-700, #334155);
}
.tour-v2-btn--secondary:hover {
  background: var(--color-gray-200, #E2E8F0);
}
.tour-v2-btn--ghost {
  background: none;
  color: var(--color-gray-400, #94A3B8);
  font-weight: 500;
  font-size: 12px;
}
.tour-v2-btn--ghost:hover {
  color: var(--color-gray-600, #475569);
}
.tour-v2-btn--outline {
  background: white;
  color: var(--color-secondary);
  border: 1px solid rgba(13, 148, 136, 0.3);
}
.tour-v2-btn--outline:hover {
  background: rgba(13, 148, 136, 0.04);
  border-color: var(--color-secondary);
}

/* Typing animation (copilot step) */
.tour-v2-typing {
  margin-bottom: 14px;
}
.tour-v2-typing__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-gray-50, #F8FAFC);
  border: 1px solid var(--color-gray-200, #E2E8F0);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  color: var(--color-gray-600, #475569);
}
.tour-v2-typing__slash {
  color: var(--color-secondary);
  font-weight: 700;
}
.tour-v2-typing__text {
  overflow: hidden;
  white-space: nowrap;
  animation: tour-v2-typewriter 2s steps(30) 0.5s both;
  max-width: 0;
}
@keyframes tour-v2-typewriter {
  from { max-width: 0; }
  to { max-width: 300px; }
}
.tour-v2-typing__cursor {
  width: 2px;
  height: 16px;
  background: var(--color-secondary);
  animation: tour-v2-blink 0.8s step-end infinite;
  flex-shrink: 0;
  border-radius: 1px;
}
@keyframes tour-v2-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .tour-v2-fullscreen__inner {
    padding: 36px 24px 28px;
    border-radius: 22px;
  }
  .tour-v2-fullscreen__title {
    font-size: 22px;
  }
  .tour-v2-fullscreen__body {
    font-size: 14px;
  }
  .tour-v2-quicklinks {
    gap: 8px;
  }
  .tour-v2-quicklink {
    padding: 14px 8px;
    font-size: 12px;
  }
}

/* -- 768px Mobile -- */
@media (max-width: 768px) {
  .try-this-panel { display: none; }

  .tour-v2-card--mobile {
    bottom: calc(var(--mobile-nav-height, 64px) + var(--safe-area-bottom, 0px) + 8px) !important;
  }
  .tour-v2-btn { min-height: 44px; }
  .tour-v2-quicklink { min-height: 44px; }
  .tour-v2-card__actions { gap: 6px; }
  .tour-v2-card__title { font-size: 16px; }
  .tour-v2-card__body { font-size: 13px; margin-bottom: 12px; }
  .tour-v2-step-counter { font-size: 10px; padding: 2px 8px; }
}
