/* MD Link — всплывающие подсказки (можно включать/выключать) */
.md-tip-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 9990;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}
.md-tip-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Lighter veil on light theme so page stays readable */
.connect-app[data-theme="light"] ~ .md-tip-overlay,
body:has(.connect-app[data-theme="light"]) .md-tip-overlay {
  background: rgba(15, 23, 42, 0.28);
}

.md-tip-spotlight {
  position: absolute;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.45), 0 0 0 3px #3b82f6;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 9991;
  width: 0;
  height: 0;
  top: 0;
  left: 0;
}

body:has(.connect-app[data-theme="light"]) .md-tip-spotlight {
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.28), 0 0 0 3px #2563eb;
}

.md-tip-bubble {
  position: fixed;
  z-index: 9992;
  max-width: 320px;
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 14px;
  padding: 16px 18px;
  color: #e2e8f0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.md-tip-bubble.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.md-tip-bubble .md-tip-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: #93c5fd;
  display: flex;
  align-items: center;
  gap: 8px;
}
.md-tip-bubble .md-tip-body {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #cbd5e1;
  margin-bottom: 14px;
}
.md-tip-bubble .md-tip-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.md-tip-bubble .md-tip-step {
  font-size: 0.75rem;
  color: #64748b;
  margin-right: auto;
}
.md-tip-bubble .btn-tip {
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.md-tip-bubble .btn-tip-next {
  background: #3b82f6;
  color: #fff;
}
.md-tip-bubble .btn-tip-next:hover {
  background: #2563eb;
}
.md-tip-bubble .btn-tip-skip {
  background: transparent;
  color: #94a3b8;
}
.md-tip-bubble .btn-tip-skip:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

/* FAB */
.md-help-fab {
  position: fixed;
  bottom: 88px;
  right: 18px;
  z-index: 100;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.md-help-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(59, 130, 246, 0.5);
}
.md-help-fab.active {
  background: linear-gradient(135deg, #ef4444, #f97316);
}

.md-help-panel {
  position: fixed;
  bottom: 150px;
  right: 18px;
  z-index: 101;
  width: 280px;
  background: #0f172a;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  padding: 16px 18px;
  color: #e2e8f0;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.md-help-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.md-help-panel h6 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #93c5fd;
  margin-bottom: 12px;
}
.md-help-panel .form-check {
  margin-bottom: 12px;
}
.md-help-panel .form-check-label {
  color: #cbd5e1;
  font-size: 0.875rem;
}
.md-help-panel .btn-start-tour {
  display: block;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: #3b82f6;
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.15s;
}
.md-help-panel .btn-start-tour:hover {
  background: #2563eb;
}
.md-help-panel a.md-help-doc {
  display: block;
  text-align: center;
  color: #60a5fa;
  font-size: 0.85rem;
  text-decoration: none;
}
.md-help-panel a.md-help-doc:hover {
  text-decoration: underline;
  color: #93c5fd;
}

/* Hover hints */
[data-md-hint] {
  position: relative;
}
[data-md-hint]::after {
  content: attr(data-md-hint);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.35;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.4);
  white-space: normal;
  width: max-content;
  max-width: 240px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  text-align: center;
}
[data-md-hint]:hover::after,
[data-md-hint]:focus::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

body.md-hints-off [data-md-hint]::after {
  display: none !important;
}

@media (max-width: 991px) {
  .md-help-fab {
    bottom: 72px;
    right: 14px;
    width: 48px;
    height: 48px;
  }
  .md-help-panel {
    right: 14px;
    bottom: 130px;
    width: calc(100vw - 28px);
    max-width: 300px;
  }
}
