/* ==========================================================================
   Comparador de Preços - Layout Direto (Destaque Verde e Vermelho)
   ========================================================================== */

:root {
  --bg-main: #0b0f19;
  --bg-card: #151c2c;
  --bg-input: #1a2336;
  --border-color: #2a364f;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #6366f1;
  --accent-hover: #4f46e5;

  /* Destaques Verde e Vermelho */
  --green-bg: rgba(16, 185, 129, 0.18);
  --green-border: #10b981;
  --green-text: #34d399;

  --red-bg: rgba(239, 68, 68, 0.18);
  --red-border: #ef4444;
  --red-text: #f87171;

  --radius-sm: 6px;
  --radius-md: 10px;
}

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

html, body {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.3;
  min-height: 100vh;
  padding: 8px 6px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.app-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Header */
.app-header {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.app-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  gap: 5px;
}

.btn {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-ghost:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

/* Espaço Reservado Fixo */
.winner-banner {
  height: 32px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.winner-banner.has-winner {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--green-border);
  color: var(--green-text);
  font-weight: 700;
}

.winner-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* Seção de Produtos */
.products-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.products-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* CARD DO PRODUTO (Padrão Neutro) */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.card-row {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
}

.row-top {
  justify-content: space-between;
}

.item-badge {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  text-align: center;
}

.field-group {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.field-group.field-size {
  flex: 1;
  min-width: 0;
}

.field-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Inputs */
.inp {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 5px 6px;
  outline: none;
  box-sizing: border-box;
}

.inp:focus {
  border-color: var(--accent-primary);
}

.inp-qty {
  width: 40px;
  flex-shrink: 0;
  text-align: center;
}

.inp-size {
  width: 100%;
  min-width: 0;
  flex: 1;
}

/* Linha 2 */
.row-bottom {
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  padding-top: 5px;
  justify-content: space-between;
}

.inp-price-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding-left: 6px;
  width: 98px;
  flex-shrink: 0;
}

.currency-sym {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  flex-shrink: 0;
}

.inp-price-wrapper .inp {
  border: none;
  width: 100%;
  padding-left: 2px;
}

/* Resultado */
.result-container {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  overflow: hidden;
}

.res-main {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.res-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Botão Deletar */
.btn-del {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  line-height: 1;
  flex-shrink: 0;
}

.btn-del:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

/* DESTAQUES DE CORES */

/* 🟡 Intermediário Preenchido (Amarelo Suave) */
.product-card.is-middle {
  background: rgba(234, 179, 8, 0.12) !important;
  border-color: rgba(234, 179, 8, 0.4) !important;
}

.product-card.is-middle .item-badge {
  background: rgba(234, 179, 8, 0.25) !important;
  color: #fde68a !important;
  border-color: rgba(234, 179, 8, 0.5) !important;
}

.product-card.is-middle .res-main {
  color: #fde68a !important;
  font-weight: 700;
}

/* 🟢 Mais Barato (Verde) */
.product-card.is-cheapest {
  background: var(--green-bg) !important;
  border-color: var(--green-border) !important;
}

.product-card.is-cheapest .item-badge {
  background: var(--green-border) !important;
  color: #000 !important;
}

.product-card.is-cheapest .res-main {
  color: var(--green-text) !important;
  font-weight: 800;
}

.product-card.is-expensive {
  background: var(--red-bg) !important;
  border-color: var(--red-border) !important;
}

.product-card.is-expensive .item-badge {
  background: var(--red-border) !important;
  color: #fff !important;
}

.product-card.is-expensive .res-main {
  color: var(--red-text) !important;
  font-weight: 800;
}

/* TUTORIAL ESCRITO */
.tutorial-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  user-select: none;
}

.tutorial-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.tutorial-list {
  padding-left: 16px;
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tutorial-list strong {
  color: var(--text-secondary);
}

.tutorial-colors {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 6px;
  margin-top: 2px;
}

.tutorial-author {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
  opacity: 0.6;
  font-style: italic;
}
