/* =====================================================================
 * 6.* UX — skeletons, sticky filters, dark mode, toasts, badges, etc.
 * ===================================================================== */

/* --- Skeletons --- */
@keyframes b2c-skeleton-shine {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #eef2ee 0%, #f7f9f6 50%, #eef2ee 100%);
  background-size: 800px 100%;
  animation: b2c-skeleton-shine 1.4s infinite linear;
  border-radius: 8px;
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}
.skeleton-title { height: 18px; width: 60%; margin: 10px 0; }
.skeleton-text  { height: 12px; width: 100%; margin: 6px 0; }
.skeleton-img   { aspect-ratio: 1/1; width: 100%; }

/* --- Filtros horizontais do catalogo --- */
.filters-sticky {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 8px 12px;
  border-bottom: 1px solid #e5ece4;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
}
.filters-sticky::-webkit-scrollbar { display: none; }

/* --- Toasts --- */
.toast-container {
  position: fixed;
  inset: auto 12px 80px 12px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999; pointer-events: none;
}
.toast {
  background: #0f2e1d; color: #e9f5dc;
  padding: 12px 16px; border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  pointer-events: auto;
  display: flex; gap: 10px; align-items: center;
  animation: toast-in .25s ease-out;
}
.toast--success { background: #1a6a3a; }
.toast--warn    { background: #b07a00; color: #fff; }
.toast--error   { background: #a32525; color: #fff; }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- Quick-view modal --- */
.quick-view {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 9990;
  display: flex; align-items: flex-end; justify-content: center;
}
.quick-view__panel {
  background: #fff; width: 100%; max-width: 720px; border-radius: 16px 16px 0 0;
  padding: 16px; max-height: 85vh; overflow: auto; animation: qv-in .25s ease-out;
}
@media (min-width: 720px) {
  .quick-view { align-items: center; }
  .quick-view__panel { border-radius: 16px; }
}
@keyframes qv-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- Comparador --- */
.compare-bar {
  position: fixed; left: 12px; right: 12px; bottom: 76px; z-index: 100;
  background: #0f2e1d; color: #fff; border-radius: 12px;
  padding: 10px 14px; display: none; align-items: center; gap: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.compare-bar.is-active { display: flex; }

/* --- Recently viewed --- */
.recent-strip {
  display: flex; gap: 12px; overflow-x: auto; padding: 8px 12px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.recent-strip > * { scroll-snap-align: start; flex: 0 0 140px; }
.recent-strip::-webkit-scrollbar { display: none; }

/* --- Dark mode (opt-in, via [data-theme="dark"]) --- */
[data-theme="dark"] {
  --bg: #0a1410; --surface: #11241b; --text: #e9f5dc; --muted: #9bb29e;
  --border: #1d3a2a; --primary: #7BC142;
  background: var(--bg); color: var(--text);
}
[data-theme="dark"] .card,
[data-theme="dark"] .product-card,
[data-theme="dark"] header.app-header { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: #0d1d15; color: var(--text); border-color: var(--border);
}
[data-theme="dark"] .filters-sticky { background: rgba(10, 20, 16, 0.94); border-bottom-color: var(--border); }
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #11241b 0%, #1a3a2a 50%, #11241b 100%);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] { color-scheme: dark; }
  [data-theme="auto"] body { background: #0a1410; color: #e9f5dc; }
}

/* --- Foco visível (a11y 5.17) --- */
:focus-visible {
  outline: 3px solid var(--primary, #7BC142);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Badge de notificações --- */
.badge-dot {
  position: absolute; top: -2px; right: -2px;
  background: #d83a3a; color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px #fff;
}
