/* ─── FAB + popup sugerencias IA ─── */
.tuko-ai-nudge {
  position: fixed;
  right: 2rem;
  bottom: 2.25rem;
  z-index: 920;
  pointer-events: none;
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.tuko-ai-nudge--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.tuko-ai-nudge--visible .tuko-ai-nudge-fab {
  animation:
    tukoAiFabGlow 4s ease-in-out infinite,
    tukoAiFabNudge 4s ease-in-out infinite;
}

.tuko-ai-nudge--visible:has(.tuko-ai-nudge-fab:hover) .tuko-ai-nudge-fab,
.tuko-ai-nudge--visible:has(.tuko-ai-nudge-fab:focus-visible) .tuko-ai-nudge-fab {
  animation: none;
}

.tuko-ai-nudge--visible:has(.tuko-ai-nudge-fab:hover) .tuko-ai-nudge-fab::before,
.tuko-ai-nudge--visible:has(.tuko-ai-nudge-fab:focus-visible) .tuko-ai-nudge-fab::before {
  animation: none;
  opacity: 0;
}

.tuko-ai-nudge-fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 0.78rem 1.2rem 0.78rem 0.85rem;
  background: linear-gradient(135deg, #9333ea 0%, #7c3aed 45%, #6366f1 100%);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  isolation: isolate;
  box-shadow:
    0 12px 32px rgba(124, 58, 237, 0.44),
    0 2px 8px rgba(15, 23, 42, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tuko-ai-nudge--visible .tuko-ai-nudge-fab::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle, rgba(196, 181, 253, 0.72) 0%, rgba(124, 58, 237, 0.32) 42%, transparent 70%);
  opacity: 0;
  transform: scale(0.92);
  animation: tukoAiFabHalo 4s ease-in-out infinite;
}

.tuko-ai-nudge-fab:hover,
.tuko-ai-nudge-fab:focus-visible {
  transform: translateY(-2px);
  animation: none;
  box-shadow:
    0 16px 36px rgba(124, 58, 237, 0.48),
    0 4px 12px rgba(15, 23, 42, 0.1);
}

.tuko-ai-nudge-fab:hover .tuko-ai-nudge-fab-icon,
.tuko-ai-nudge-fab:focus-visible .tuko-ai-nudge-fab-icon {
  animation: none;
}

.tuko-ai-nudge-fab:hover .tuko-ai-nudge-fab-badge,
.tuko-ai-nudge-fab:focus-visible .tuko-ai-nudge-fab-badge {
  animation: none;
}

.tuko-ai-nudge-fab:active {
  transform: translateY(0);
}

.tuko-ai-nudge-fab-icon {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.tuko-ai-nudge-fab-icon svg {
  width: 1.05rem;
  height: 1.05rem;
}

.tuko-ai-nudge-fab-badge {
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #7c3aed;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.35rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.tuko-ai-nudge--intro .tuko-ai-nudge-fab::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 2px solid rgba(167, 139, 250, 0.65);
  animation: tukoAiNudgeRing 2.2s ease-out 3;
  pointer-events: none;
}

@keyframes tukoAiFabGlow {
  0%, 55%, 100% {
    box-shadow:
      0 12px 32px rgba(124, 58, 237, 0.44),
      0 2px 8px rgba(15, 23, 42, 0.08);
    filter: brightness(1);
  }
  68%, 80% {
    box-shadow:
      0 18px 44px rgba(124, 58, 237, 0.66),
      0 0 28px rgba(147, 51, 234, 0.42);
    filter: brightness(1.1);
  }
}

@keyframes tukoAiFabHalo {
  0%, 55%, 100% {
    opacity: 0;
    transform: scale(0.92);
  }
  62%, 80% {
    opacity: 1;
    transform: scale(1.16);
  }
  86% {
    opacity: 0;
    transform: scale(1);
  }
}

@keyframes tukoAiFabNudge {
  0%, 55%, 100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  62% {
    transform: translate3d(-2px, -3px, 0) rotate(-3deg);
  }
  68% {
    transform: translate3d(2px, -2px, 0) rotate(2.5deg);
  }
  74% {
    transform: translate3d(-2px, -3px, 0) rotate(-2deg);
  }
  80% {
    transform: translate3d(2px, -1px, 0) rotate(2deg);
  }
  86% {
    transform: translate3d(0, -2px, 0) rotate(0deg);
  }
}

@keyframes tukoAiNudgeRing {
  0% { transform: scale(1); opacity: 0.85; }
  100% { transform: scale(1.18); opacity: 0; }
}

/* Modal */
.tuko-ai-nudge-modal {
  position: fixed;
  inset: 0;
  z-index: 940;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  pointer-events: none;
}

.tuko-ai-nudge-modal[hidden] {
  display: none !important;
}

.tuko-ai-nudge-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.tuko-ai-nudge-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 52rem);
  max-height: min(88vh, 50rem);
  overflow: hidden;
  border-radius: 1.375rem;
  background: #fff;
  box-shadow:
    0 24px 64px rgba(15, 23, 42, 0.2),
    0 8px 24px rgba(61, 80, 242, 0.12);
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  transition:
    opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
}

.tuko-ai-nudge-modal--open {
  pointer-events: auto;
}

.tuko-ai-nudge-modal--open .tuko-ai-nudge-backdrop {
  opacity: 1;
}

.tuko-ai-nudge-modal--open .tuko-ai-nudge-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.tuko-ai-nudge-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tuko-ai-nudge-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.tuko-ai-nudge-close svg {
  width: 1rem;
  height: 1rem;
}

.tuko-ai-nudge-panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.tuko-ai-nudge-panel-body .tuko-publish-hub-ai {
  margin: 0;
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tuko-ai-nudge-panel-body .tuko-publish-hub-ai--modal-scroll {
  min-height: 0;
}

.tuko-ai-nudge-panel-body .tuko-publish-hub-ai-head--sticky {
  flex-shrink: 0;
  margin-bottom: 0;
  padding: 1.25rem 3rem 1rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
}

.tuko-ai-nudge-panel-body .tuko-publish-hub-ai-head--sticky .tuko-publish-hub-ai-count {
  margin-right: 0;
}

.tuko-ai-nudge-panel-body .tuko-publish-hub-ai-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 1.375rem 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.tuko-ai-nudge-panel-body .tuko-publish-hub-ai-head {
  margin-bottom: 1.25rem;
  padding-right: 2rem;
}

.tuko-ai-nudge-panel-body .tuko-publish-hub-ai-title {
  font-size: 1.1875rem;
}

.tuko-ai-nudge-panel-body .tuko-publish-hub-ai-desc {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  margin-top: 0.35rem;
  line-height: 1.4;
}

.tuko-ai-nudge-panel-body .tuko-publish-hub-ai-grid {
  grid-template-columns: 1fr;
  gap: 1rem;
  padding-top: 0.25rem;
}

.tuko-ai-nudge-panel-body .tuko-publish-hub-ai-card--detailed .tuko-publish-hub-ai-card-thumb {
  height: 11rem;
}

.tuko-ai-nudge-panel-body .tuko-publish-hub-ai-card-main {
  padding: 1.5rem 1.625rem 1.625rem;
}

.tuko-ai-nudge-panel-body .tuko-ai-detail-why {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.tuko-ai-nudge-panel-body .tuko-ai-detail-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: #0f172a;
}

.tuko-ai-nudge-panel-body .tuko-ai-detail-signals-list li {
  font-size: 0.875rem;
  color: #0f172a;
}

.tuko-ai-nudge-panel-body .tuko-publish-hub-ai-card--detailed .tuko-publish-hub-ai-card-title {
  font-size: 1.1875rem;
  margin-bottom: 1.375rem;
}

.tuko-ai-nudge-panel-body .tuko-ai-detail-block,
.tuko-ai-nudge-panel-body .tuko-ai-milestones {
  margin-bottom: 1.5rem;
}

.tuko-ai-nudge-panel-body .tuko-ai-detail-chips--follow {
  margin-top: 0.4rem;
}

.tuko-ai-nudge-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  padding: 1rem 1.5rem 1.375rem;
  border-top: 1px solid #f1f5f9;
  margin-top: 0;
  background: #fff;
}

.tuko-ai-nudge-footer-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  margin-left: auto;
}

.tuko-ai-nudge-footer-actions {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.tuko-ai-nudge-close-btn {
  width: auto;
  min-width: 7rem;
  padding: 0.625rem 1.5rem;
  border: 1px solid #3d50f2;
  border-radius: 0.625rem;
  background: #3d50f2;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(61, 80, 242, 0.28);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tuko-ai-nudge-close-btn:hover {
  background: #3346d9;
  border-color: #3346d9;
  color: #fff;
  box-shadow: 0 4px 14px rgba(61, 80, 242, 0.35);
}

.tuko-ai-nudge-link {
  border: none;
  background: transparent;
  color: #3d50f2;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: color 0.15s ease;
}

.tuko-ai-nudge-link:hover {
  color: #2f3fd0;
  text-decoration: underline;
}

.tuko-ai-nudge-dismiss {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  text-align: right;
}

.tuko-ai-nudge-dismiss input {
  width: 0.95rem;
  height: 0.95rem;
  accent-color: #3d50f2;
}

/* Sidebar badge (publish nav) */
.tuko-publish-nav-badge {
  margin-left: auto;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #3d50f2;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.125rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tuko-sidebar-button[data-section='publish'] {
  position: relative;
}

.tuko-sidebar-button[data-section='publish'] .tuko-publish-nav-badge {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 640px) {
  .tuko-ai-nudge {
    right: 1.25rem;
    bottom: 1.5rem;
  }

  .tuko-ai-nudge-fab-label {
    display: none;
  }

  .tuko-ai-nudge-fab {
    padding: 0.85rem;
    border-radius: 999px;
  }

  .tuko-ai-nudge-modal {
    padding: 1rem;
  }

  .tuko-ai-nudge-panel {
    width: 100%;
    max-height: 90vh;
  }
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-panel {
  background: #1e293b;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.45),
    0 8px 24px rgba(61, 80, 242, 0.15);
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-backdrop {
  background: rgba(2, 6, 23, 0.72);
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-panel-body .tuko-publish-hub-ai-head--sticky {
  background: #1e293b;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-panel-body .tuko-publish-hub-ai-desc {
  color: #cbd5e1;
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-panel-body .tuko-ai-detail-text {
  color: #e2e8f0;
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-panel-body .tuko-ai-detail-signals-list li {
  color: #e2e8f0;
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-panel-body .tuko-ai-detail-label {
  color: #94a3b8;
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-footer {
  background: #1e293b;
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-close {
  background: rgba(51, 65, 85, 0.85);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-close:hover {
  background: rgba(71, 85, 105, 0.95);
  color: #f8fafc;
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-dismiss {
  color: #94a3b8;
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-close-btn {
  background: #3d50f2;
  border-color: #3d50f2;
  color: #fff;
  box-shadow: 0 2px 8px rgba(61, 80, 242, 0.35);
}

html[data-tuko-theme='dark'] .tuko-ai-nudge-close-btn:hover {
  background: #4f63f5;
  border-color: #4f63f5;
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .tuko-ai-nudge,
  .tuko-ai-nudge--visible,
  .tuko-ai-nudge-panel,
  .tuko-ai-nudge-backdrop,
  .tuko-ai-nudge-fab,
  .tuko-ai-nudge--visible .tuko-ai-nudge-fab::before,
  .tuko-ai-nudge--intro .tuko-ai-nudge-fab::after {
    transition: none;
    animation: none;
  }
}
