/* ─────────────────────────────────────────────
   PeçaRadar — Reset & Layout Base
───────────────────────────────────────────── */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
}

button { cursor: pointer; font-family: inherit; }
a      { color: inherit; }

/* ══════════════════════════════════════════
   Keyframes globais — todos centralizados aqui.
   NÃO redefinir em outros arquivos CSS.
══════════════════════════════════════════ */

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* Usado pelo #updateToast */
@keyframes slideDown {
  0%   { top: -20px; opacity: 0; }
  100% { top: 16px;  opacity: 1; }
}

/* Usado pelo .content-cat-display no topbar.css */
@keyframes fadeInSlide {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Usado pelo #prefsModal */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Usado por .compare-box e .prefs-box */
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Usado pelos .typing-dot no modal.css */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

/* ── App shell ── */

#app {
  display: block;
  min-height: 100vh;
  width: 100%;
  /* overflow-x removido para evitar clipping de menus absolutos */
}

#main {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100vw;
  /* overflow-x removido para evitar clipping de menus absolutos */
}

/* ── Content ── */

#content { padding: 20px 24px; }

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

/* ── Empty state ── */

#empty {
  display: none;
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
}

#empty h3 {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

/* ── Loader ── */

#loader {
  display: none;
  text-align: center;
  padding: 30px;
  color: var(--pink, #d946ef);
  font-weight: 600;
}

.loader-icon {
  display: inline-block;
  animation: spin 1s linear infinite;
  font-size: 24px;
  margin-bottom: 8px;
}

/* ── Toast de atualização ── */

#updateToast {
  display: none;
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--pink, #d946ef);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  z-index: 9999;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
  cursor: pointer;
  white-space: nowrap;
}

/* ── Filters bar ── */

#filters {
  padding: 10px 24px;
  display: flex;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  flex-shrink: 0;
  width: 100%;
  max-width: 100vw;
}

.filter-chip {
  padding: 5px 13px;
  border-radius: 20px;
  font-size: 12px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  transition: all var(--t, 0.15s ease);
  white-space: nowrap;
}

.filter-chip:hover  { border-color: var(--accent); color: var(--accent); }
.filter-chip.on     { background: var(--tag-bg); border-color: var(--accent); color: var(--accent); }
.filter-chip.hot    { border-color: var(--hot); color: var(--hot); }
.filter-chip.hot.on { background: var(--hot-bg); color: var(--hot-text); }

#sort-sel {
  margin-left: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 8px);
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

#sort-sel option { background: var(--surface); }

/* ── Divider ── */

.divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

/* ── Monitor modal (estilos movidos do HTML inline) ── */

.monitor-modal-overlay {
  display: none;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  padding: 16px;
}

.monitor-modal-overlay.open { display: flex; }

.monitor-modal-box {
  width: 100%;
  max-width: 500px;
  background: #110f15;
  border: 1px solid #36323E;
  padding: 24px;
  border-radius: 12px;
}

.monitor-modal-box .modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.monitor-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #ccc;
  margin-bottom: 8px;
}

.monitor-input,
.monitor-select {
  width: 100%;
  padding: 14px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: #1a1721;
  border: 1px solid #36323e;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t, 0.15s ease);
}

.monitor-input:focus,
.monitor-select:focus { border-color: var(--accent); }

.monitor-select { margin-bottom: 24px; }

.monitor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
}

/* Botão excluir: à esquerda, revelado via JS */
.m-btn.danger {
  margin-right: auto;
  background: transparent;
  color: #ef4444;
  border: none;
  font-weight: 600;
  display: none;
}

/* Monitor list — estado vazio */
.monitor-empty {
  display: block;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  padding: 4px 0;
  font-style: italic;
}

/* ── Monitor items (renderizados pelo monitor.js) ── */

.monitor-item {
  padding: 8px 12px;
  background: #1a1721;
  border-left: 3px solid #d946ef;
  border-radius: 0 6px 6px 0;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background var(--t, 0.15s ease);
}

.monitor-item:hover { background: #2a2636; }

.monitor-item-title {
  font-weight: 600;
  font-size: 13px;
  color: #fff;
}

.monitor-item-meta {
  font-size: 11px;
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  opacity: 0.8;
  color: rgba(255, 255, 255, 0.7);
}

.monitor-badge {
  font-size: 10px;
  font-weight: 600;
}

.monitor-badge--ativo   { color: #00B37E; }
.monitor-badge--pausado { color: #ef4444; }

/* ── Notificações (renderizadas pelo monitor.js) ── */

.notif-item {
  padding: 12px;
  background: #1a1721;
  border: 1px solid #36323E;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color var(--t, 0.15s ease);
}

.notif-item:hover { border-color: #d946ef; }

.notif-tracker {
  font-size: 11px;
  color: #d946ef;
  font-weight: 600;
  margin-bottom: 4px;
}

.notif-title {
  font-size: 13px;
  color: #fff;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

.notif-price { color: #00B37E; font-weight: 700; }
.notif-store { font-size: 11px; color: #888; }

.notif-empty {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ── Scrollbar ── */

::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 10px; }

/* ── Responsive ── */

@media (max-width: 1024px) {
  #grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
}

@media (max-width: 950px) {
  #content { padding: 16px; }
  #grid    { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  #filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 12px 16px;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
  }
  #filters::-webkit-scrollbar { display: none; }
  #sort-sel { margin-left: auto; flex-shrink: 0; }
}

@media (max-width: 480px) {
  #grid    { grid-template-columns: 1fr; }
  #content { padding: 12px; }
}