/**
 * Sistema AMTI - Smart Tips & Modern Guidance System (v2.0)
 * 
 * Atualizações de Design:
 * - Botão Topbar 100% quadrado com animação interna e sutil da lâmpada acendendo.
 * - Zero pontos/beacons de notificação.
 * - Toasts informativos no canto superior direito com apenas título, descrição e botão fechar compacto.
 * - Modal central padronizado com largura padrão AMTI (max-width: 760px) e escurecimento de fundo completo.
 */

/* ── 1. BOTÃO DE DICAS NO TOPBAR (100% Rigorosamente Quadrado + Animação Interna) ── */
.amti-topbar-action-group .amti-btn.amti-topbar-btn-tips,
.amti-topbar-btn-tips {
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  aspect-ratio: 1 / 1 !important;
  flex: 0 0 42px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  overflow: hidden !important;
  cursor: pointer !important;
  transition: all 0.25s ease !important;
  box-sizing: border-box !important;
}

@media (max-width: 768px) {
  .amti-topbar-action-group .amti-btn.amti-topbar-btn-tips,
  .amti-topbar-btn-tips {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    aspect-ratio: 1 / 1 !important;
    flex: 0 0 36px !important;
  }
}

/* Ícone da Lâmpada */
.amti-topbar-btn-tips .amti-tip-bulb-icon {
  font-size: 1rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: color, filter, transform;
}

/* Estado Ativo: Lâmpada acendendo suavemente de forma moderna e sutil */
.amti-topbar-btn-tips.amti-tip-glowing .amti-tip-bulb-icon {
  animation: amti-bulb-subtle-glow 2.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes amti-bulb-subtle-glow {
  0%, 100% {
    color: inherit;
    filter: drop-shadow(0 0 0 transparent);
    transform: scale(1);
    opacity: 0.82;
  }
  50% {
    color: #fbbf24; /* acende suavemente em tom dourado/âmbar acolhedor */
    filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.75)) drop-shadow(0 0 10px rgba(245, 158, 11, 0.35));
    transform: scale(1.12);
    opacity: 1;
  }
}

/* Brilho interno sutil e difuso no fundo do botão */
.amti-topbar-btn-tips.amti-tip-glowing::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(251, 191, 36, 0.16) 0%, transparent 72%);
  animation: amti-bulb-ambient-pulse 2.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  pointer-events: none;
}

@keyframes amti-bulb-ambient-pulse {
  0%, 100% {
    opacity: 0.15;
  }
  50% {
    opacity: 0.85;
  }
}

/* ── 2. TOAST DE DICA (Estilo Nativo dos Popups de Salvamento Top-Right) ─── */
.toast.toast-tip {
  position: relative;
  padding: 14px 34px 14px 16px !important;
  display: flex !important;
  align-items: flex-start !important;
  gap: 0 !important;
  min-width: 320px !important;
  max-width: 440px !important;
  overflow: hidden !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease !important;
  cursor: pointer !important;
  padding-right: 38px !important;
}

.toast.toast-tip.is-informative {
  cursor: default !important;
}

.toast.toast-tip.is-informative:hover {
  transform: none !important;
  box-shadow: none !important;
}

.toast.toast-tip:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.85) !important;
  outline-offset: 3px !important;
}

.toast-tip-bulb-icon {
  position: absolute;
  top: 50%;
  margin-top: -0.5em;
  right: 12px;
  font-size: 1.05rem;
  line-height: 1;
  pointer-events: none;
  animation: amti-bulb-subtle-glow 2.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .amti-topbar-btn-tips.amti-tip-glowing .amti-tip-bulb-icon,
  .toast-tip-bulb-icon {
    animation: none !important;
  }
}

.toast-tip-progress-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.2);
}

.toast-tip-progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(1);
  transform-origin: left center;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #a78bfa);
  box-shadow: 0 0 8px rgba(129, 140, 248, 0.55);
  will-change: transform;
  animation: toast-tip-countdown 14s linear forwards;
}

.toast.toast-tip.is-paused .toast-tip-progress-fill {
  animation-play-state: paused;
}

@keyframes toast-tip-countdown {
  to {
    transform: scaleX(0);
  }
}

.toast-tip-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.toast-tip-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: inherit;
  margin: 0;
}

.toast.toast-tip .toast-message {
  font-size: 0.82rem;
  line-height: 1.4;
  opacity: 0.88;
  margin: 0;
}

/* ── 3. MODAL CENTRAL (Segue exatamente o padrão .amti-modal do Dashboard) ─── */
#amtiTipsCenterModal {
  /* Herda posicionamento e background do .amti-modal (background: transparent)
     O overlay escuro de fundo é feito por body.amti-has-open-modal::after,
     exatamente como todos os outros modais do sistema. */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#amtiTipsCenterModal.hidden {
  display: none !important;
}

/* Largura Padrão idêntica aos outros popups do Sistema AMTI */
#amtiTipsCenterModal .amti-modal-content,
.amti-tips-center-modal {
  width: 90% !important;
  max-width: 760px !important;
  max-height: 85vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background: var(--card-surface) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-glow) !important;
}

.amti-tips-center-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.amti-tips-center-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.amti-tips-center-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
}

.amti-tips-center-subtitle {
  font-size: 0.8rem;
  margin: 2px 0 0 0;
  opacity: 0.75;
}

#amtiTipsCenterModal .amti-tips-center-footer {
  display: flex;
  justify-content: flex-end !important;
  align-items: center;
  gap: 8px !important;
  flex-wrap: wrap;
}

#amtiTipsCenterModal .amti-tips-center-footer > button {
  flex: 0 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
}

.amti-tips-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  flex-wrap: wrap;
}

.amti-tips-tabs {
  display: flex;
  align-items: center;
  flex: 1 1 100%;
  justify-content: space-between;
  gap: 1px;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.amti-tips-tabs::-webkit-scrollbar {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .amti-tips-tabs {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
  }

  .amti-tips-tabs::-webkit-scrollbar {
    display: block;
    height: 4px;
  }

  .amti-tips-tabs::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 4px;
  }
}

.amti-tips-tab-btn {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  transition: all 0.2s ease;
}

.amti-tips-tab-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.06);
}

.amti-tips-tab-btn.active {
  opacity: 1;
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

#amtiTipsCenterModal .amti-tips-tab-btn {
  white-space: nowrap;
}

.amti-tips-auto-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.amti-tips-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.amti-tips-reset-btn {
  font-size: 0.75rem !important;
  font-weight: 600;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15)) !important;
  background: rgba(255, 255, 255, 0.05) !important;
  color: inherit !important;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}

.amti-tips-reset-btn:hover {
  background: rgba(56, 189, 248, 0.15) !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
  color: #38bdf8 !important;
}

html[data-theme='block-steel'] .amti-tips-reset-btn,
html.theme-block-steel .amti-tips-reset-btn,
html[data-theme='block-blue'] .amti-tips-reset-btn,
html.theme-block-blue .amti-tips-reset-btn,
html[data-theme='dark-block'] .amti-tips-reset-btn,
html.theme-dark-block .amti-tips-reset-btn,
html[data-theme='block-light'] .amti-tips-reset-btn,
html.theme-block-light .amti-tips-reset-btn {
  border-radius: 0px !important;
}

.amti-tips-list {
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  overflow-y: auto;
  max-height: 55vh;
}

@media (min-width: 640px) {
  .amti-tips-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

.amti-tip-hub-item {
  display: flex;
  flex-direction: column;
  padding: 15px;
  border-radius: 10px;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  background: rgba(255, 255, 255, 0.02);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.amti-tip-hub-item:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.amti-tip-hub-item.is-mastered {
  opacity: 0.72;
}

.amti-tip-hub-item.is-mastered:hover {
  opacity: 0.95;
}

.amti-tip-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.amti-tip-item-icon-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.amti-tip-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.amti-tip-item-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.amti-tip-status-pill {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.amti-tip-status-pill.pill-active {
  background: rgba(16, 185, 129, 0.16) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
}

.amti-tip-status-pill.pill-new {
  background: rgba(56, 189, 248, 0.16) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
}

.amti-tip-status-pill.pill-dismissed {
  background: rgba(148, 163, 184, 0.14) !important;
  color: #94a3b8 !important;
  border: 1px solid rgba(148, 163, 184, 0.25) !important;
}

.amti-tip-item-desc {
  font-size: 0.8rem;
  line-height: 1.45;
  margin: 0 0 12px 0;
  opacity: 0.85;
  flex: 1;
}

.amti-tip-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.amti-tip-info-pill {
  font-size: 0.74rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.amti-tip-btn-action {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  transition: all 0.2s ease;
}

.amti-tip-master-btn {
  font-size: 0.74rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
}

.amti-tip-master-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

/* ── 4. IDENTIDADE VISUAL DOS 6 TEMAS AMTI ───────────────────────────── */

/* ── Temas Block (cantos 100% retos) ── */
html[data-theme='block-steel'] .amti-topbar-btn-tips,
html.theme-block-steel .amti-topbar-btn-tips,
html[data-theme='block-blue'] .amti-topbar-btn-tips,
html.theme-block-blue .amti-topbar-btn-tips,
html[data-theme='dark-block'] .amti-topbar-btn-tips,
html.theme-dark-block .amti-topbar-btn-tips,
html[data-theme='block-light'] .amti-topbar-btn-tips,
html.theme-block-light .amti-topbar-btn-tips,
html[data-theme='block-steel'] .toast,
html[data-theme='block-steel'] .toast,
html[data-theme='block-steel'] .toast.toast-tip,
html.theme-block-steel .toast,
html.theme-block-steel .toast.toast-tip {
  background: linear-gradient(145deg, #182230, #101620);
  border-color: #3b4756;
}
html[data-theme='block-steel'] .amti-tip-btn-action {
  background: #2563eb;
  color: #fff;
}

/* Block Blue */
html[data-theme='block-blue'] .toast,
html[data-theme='block-blue'] .toast.toast-tip,
html.theme-block-blue .toast,
html.theme-block-blue .toast.toast-tip {
  background: linear-gradient(145deg, #07152c, #030a16);
  border-color: rgba(56, 189, 248, 0.45);
}
html[data-theme='block-blue'] .amti-tip-btn-action {
  background: #0284c7;
  color: #fff;
}

/* Dark Block */
html[data-theme='dark-block'] .toast,
html[data-theme='dark-block'] .toast.toast-tip,
html.theme-dark-block .toast,
html.theme-dark-block .toast.toast-tip {
  background: #09090b;
  border-color: #27272a;
}
html[data-theme='dark-block'] .amti-tip-btn-action {
  background: #ffffff;
  color: #09090b;
}

/* Block Light */
html[data-theme='block-light'] .toast,
html[data-theme='block-light'] .toast.toast-tip,
html.theme-block-light .toast,
html.theme-block-light .toast.toast-tip {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}
html[data-theme='block-light'] .toast .toast-message,
html[data-theme='block-light'] .toast.toast-tip .toast-message,
html.theme-block-light .toast .toast-message,
html.theme-block-light .toast.toast-tip .toast-message {
  color: #475569;
}
html[data-theme='block-light'] .amti-tip-btn-action {
  background: #0f172a;
  color: #ffffff;
}

/* Dark */
html[data-theme='dark'] .toast,
html[data-theme='dark'] .toast.toast-tip,
html.theme-dark .toast,
html.theme-dark .toast.toast-tip {
  background: rgba(17, 24, 39, 0.95);
  border-color: rgba(255, 255, 255, 0.14);
}
html[data-theme='dark'] .amti-tip-btn-action {
  background: #6366f1;
  color: #fff;
}

/* Light */
html[data-theme='light'] .toast,
html[data-theme='light'] .toast.toast-tip,
html.theme-light .toast,
html.theme-light .toast.toast-tip {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(203, 213, 225, 0.85);
  color: #0f172a;
}
html[data-theme='light'] .toast .toast-message,
html[data-theme='light'] .toast.toast-tip .toast-message,
html.theme-light .toast .toast-message,
html.theme-light .toast.toast-tip .toast-message {
  color: #475569;
}
html[data-theme='light'] .toast.toast-tip .toast-message,
html.theme-light .toast.toast-tip .toast-message {
  color: #475569;
}
html[data-theme='light'] .amti-tip-btn-action {
  background: #2563eb;
  color: #fff;
}

/* ── 5. PERFORMANCE GUARDS ── */
html.amti-performance-mode #amtiTipsCenterModal,
html.amti-ultra-performance-mode #amtiTipsCenterModal {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
