@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
:root {
  --bg-color: #f4f7f9;
  --card-bg-color: #ffffff;
  --text-color: #2c3e50;
  --text-light-color: #7f8c8d;
  --primary-color: #4a47a3;
  --primary-dark-color: #3b3882;
  --success-color: #198754;
  --danger-color: #dc3545;
  --border-color: #e4e7ea;
  --shadow: 0 4px 15px rgba(0,0,0,0.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg-color); color: var(--text-color); }
header {
  text-align: center;
  padding: 2.2rem 1rem 1.2rem 1rem;
  background-color: var(--card-bg-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.2rem;
  position: relative;
}
header > div {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.3rem;
}
header p {
  font-size: 1.08rem;
  color: var(--text-light-color);
  margin-top: 0.2rem;
}
main {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 2.5rem;
  max-width: 1200px;
  margin: 0 auto 2.5rem auto;
  padding: 0 1.5rem;
}
.form-column {
  flex: 1;
  max-width: 400px;
  min-width: 320px;
}
.results-column {
  flex: 2;
  min-width: 340px;
  max-width: 700px;
}

.form-card { background-color: var(--card-bg-color); border-radius: 12px; padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.form-card h3 { font-size: 1.25rem; margin-bottom: 1.5rem; border-left: 4px solid var(--primary-color); padding-left: 1rem; }

label { display: block; margin-bottom: 0.5rem; margin-top: 1.25rem; font-weight: 500; font-size: 0.9rem; color: var(--text-color); }
input[type="number"] { width: 100%; padding: 0.8rem; font-size: 1rem; border: 1px solid var(--border-color); border-radius: 8px; background-color: #fdfdfd; color: var(--text-color); transition: border-color 0.2s ease, box-shadow 0.2s ease; }
input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(74, 71, 163, 0.15); }
button { margin-top: 2rem; width: 100%; padding: 1rem; background-color: var(--primary-color); color: white; font-size: 1.1rem; font-weight: 600; border: none; border-radius: 8px; cursor: pointer; transition: background-color 0.2s ease, transform 0.1s ease; }
button:hover { background-color: var(--primary-dark-color); }
button:active { transform: scale(0.98); }

#results-container .placeholder, #breakeven-container .placeholder { color: var(--text-light-color); text-align: center; background-color: var(--card-bg-color); border: 2px dashed var(--border-color); border-radius: 12px; padding: 4rem 2rem; }

.marketplace-card { display: flex; align-items: flex-start; gap: 1rem; background-color: var(--card-bg-color); border: 1px solid var(--border-color); border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.marketplace-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.marketplace-card.highlight { border: 2px solid var(--success-color); }
.card-logo { flex-shrink: 0; width: 80px; height: 40px; margin-top: 5px; object-fit: contain; }
.card-info h3 { font-size: 1.1rem; margin: 0; }
.card-info .fees { font-size: 0.8rem; color: var(--text-light-color); margin-bottom: 0.5rem; }
.shipping-notice { font-size: 0.8rem; font-weight: 500; color: var(--primary-color); background-color: #e8e7f8; padding: 0.2rem 0.5rem; border-radius: 4px; display: inline-block; margin-top: 0.5rem; }
.card-results .price { font-size: 1.8rem; font-weight: 700; color: var(--primary-color); }
.card-results .profit.positive { color: var(--success-color); }
.card-results .profit.negative { color: var(--danger-color); }

#breakeven-container h3 { font-size: 1.5rem; margin-bottom: 1.5rem; color: var(--primary-color); }
.breakeven-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.breakeven-table th, .breakeven-table td { text-align: left; padding: 0.75rem; border-bottom: 1px solid var(--border-color); }
.breakeven-table th { color: var(--text-light-color); font-weight: 500; font-size:0.9rem; }
.breakeven-table td { font-weight: 600; }
.breakeven-table .be-channel { display: flex; align-items: center; gap: 0.5rem; }
.breakeven-table .be-logo { width: 20px; height: 20px; object-fit: contain; }

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
}
.form-card {
  background: var(--card-bg-color);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem 2rem 2rem;
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-card h2 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
}
.form-card label {
  margin-top: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}
.form-card input {
  width: 100%;
  padding: 0.8rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #fdfdfd;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-card input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 71, 163, 0.15);
}
.form-card button {
  width: 100%;
  padding: 1rem;
  background: var(--primary-color);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 1rem;
  transition: background 0.2s, transform 0.1s;
}
.form-card button:hover {
  background: var(--primary-dark-color);
}
.form-card button:active {
  transform: scale(0.98);
}
.login-msg {
  margin-top: 1rem;
  text-align: center;
  color: var(--danger-color);
  font-size: 1rem;
  min-height: 1.5em;
}
@media (max-width: 600px) {
  .form-card {
    padding: 1.5rem 0.5rem;
    max-width: 98vw;
  }
}

@media (max-width: 992px) {
  main { flex-direction: column; gap: 1.5rem; padding: 0 0.5rem; }
  .form-column, .results-column { max-width: 100%; min-width: 0; }
  header > div { flex-direction: column; gap: 1.2rem; }
}
@media (max-width: 600px) {
  header { padding: 1.2rem 0.3rem 0.7rem 0.3rem; }
  header h1 { font-size: 1.3rem; }
  header p { font-size: 0.95rem; }
  main { padding: 0 0.2rem; gap: 0.7rem; }
  .form-card { padding: 1rem 0.3rem; max-width: 100vw; }
  .marketplace-card { flex-direction: column; align-items: stretch; padding: 0.8rem; }
  .card-logo { width: 100%; height: 32px; margin: 0 0 8px 0; }
  .card-info h3 { font-size: 1rem; }
  .card-results .price { font-size: 1.2rem; }
  .breakeven-table th, .breakeven-table td { padding: 0.4rem; font-size: 0.9rem; }
  .feedback-global { padding: 0.7rem 0.5rem; font-size: 1rem; }
}

.feedback-global {
  max-width: 600px;
  margin: 1.5rem auto 0 auto;
  padding: 1.2rem 2rem;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow);
  transition: opacity 0.3s;
}
.feedback-global.success {
  background: #eafaf1;
  color: var(--success-color);
  border: 1.5px solid var(--success-color);
}
.feedback-global.error {
  background: #fff0f2;
  color: var(--danger-color);
  border: 1.5px solid var(--danger-color);
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: #fdfdfd;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 0.5rem;
  margin-top: 0.2rem;
}
.input-wrapper input[type="number"] {
  border: none;
  outline: none;
  background: transparent;
  flex: 1;
  padding: 0.8rem 0.5rem;
  font-size: 1rem;
  color: var(--text-color);
  border-radius: 8px;
}
.input-prefix, .input-suffix {
  color: var(--text-light-color);
  font-size: 1rem;
  padding: 0 0.7rem;
  font-weight: 500;
  user-select: none;
}
.input-prefix {
  border-right: 1px solid var(--border-color);
}
.input-suffix {
  border-left: 1px solid var(--border-color);
}
.tooltip-icon {
  display: inline-block;
  margin-left: 6px;
  background: var(--primary-color);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  text-align: center;
  font-size: 0.95em;
  font-weight: bold;
  cursor: pointer;
  line-height: 18px;
  transition: background 0.2s;
}
.tooltip-icon:hover {
  background: var(--primary-dark-color);
} 

.historico-simulacoes {
  background: var(--card-bg-color);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(74,71,163,0.07);
  margin-top: 2.5rem;
  padding: 1.5rem 2rem;
  border: 1.5px solid var(--border-color);
  transition: box-shadow 0.2s, border 0.2s;
}
.historico-simulacoes h3 {
  font-size: 1.18rem;
  color: var(--primary-color);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.historico-simulacoes h3::before {
  content: "\1F4C8 "; /* gráfico emoji */
  font-size: 1.2em;
  margin-right: 0.2em;
}
#historico-lista {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 220px;
  overflow-y: auto;
}
#historico-lista li {
  font-size: 1.01rem;
  color: var(--text-color);
  background: linear-gradient(90deg, #f7f7fb 80%, #ecebfa 100%);
  border-radius: 10px;
  margin-bottom: 0.6rem;
  padding: 0.85rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(74,71,163,0.04);
  border: 1px solid #ecebfa;
  transition: background 0.2s, box-shadow 0.2s, border 0.2s;
  position: relative;
}
#historico-lista li:hover {
  background: linear-gradient(90deg, #ecebfa 80%, #f7f7fb 100%);
  box-shadow: 0 4px 16px rgba(74,71,163,0.09);
  border: 1.5px solid var(--primary-color);
}
#historico-lista li::before {
  content: "\1F552 "; /* relógio emoji */
  margin-right: 0.7em;
  font-size: 1.1em;
  opacity: 0.7;
}

/* Gráficos - canvas */
#grafico-canais, #grafico-composicao {
  background: #f7f7fb;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(74,71,163,0.07);
  padding: 1.2rem 0.5rem;
  margin-bottom: 1.5rem;
  border: 1.5px solid #ecebfa;
  display: block;
}

/* Ponto de Equilíbrio - tabela */
.breakeven-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #f7f7fb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(74,71,163,0.06);
  margin-top: 1rem;
}
.breakeven-table th, .breakeven-table td {
  padding: 0.85rem 0.7rem;
  text-align: center;
  font-size: 1.01rem;
}
.breakeven-table th {
  background: #ecebfa;
  color: var(--primary-color);
  font-weight: 600;
  border-bottom: 2px solid #e4e7ea;
}
.breakeven-table tr:nth-child(even) td {
  background: #f7f7fb;
}
.breakeven-table tr:nth-child(odd) td {
  background: #fff;
}
.breakeven-table td .be-channel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}
.breakeven-table .be-logo {
  width: 28px;
  height: 18px;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(74,71,163,0.10);
}

/* Pequenos ajustes para harmonia */
.marketplace-card {
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(74,71,163,0.07);
  border: 1.5px solid #ecebfa;
}
.marketplace-card.highlight {
  border: 2.5px solid var(--success-color);
}

/* Ajuste para dark mode */
body.theme-dark #grafico-canais,
body.theme-dark #grafico-composicao,
body.theme-dark .breakeven-table {
  background: #23272b;
  border-color: var(--border-color);
}
body.theme-dark .breakeven-table th {
  background: #23272b;
  color: var(--primary-color);
}
body.theme-dark .breakeven-table tr:nth-child(even) td {
  background: #23272b;
}
body.theme-dark .breakeven-table tr:nth-child(odd) td {
  background: #181a1b;
}

.sugestao-ideal {
  background: #eafaf1;
  color: var(--success-color);
  border: 2px solid var(--success-color);
  border-radius: 10px;
  font-size: 1.15rem;
  font-weight: 600;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  justify-content: center;
}
.sugestao-ideal .icon {
  font-size: 1.5rem;
  margin-right: 0.5rem;
} 

.discount-notice {
  background: #fff3cd;
  color: #856404;
  border-radius: 6px;
  font-size: 0.95em;
  font-weight: 500;
  padding: 0.2rem 0.7rem;
  margin-top: 0.5rem;
  display: inline-block;
  border: 1px solid #ffeeba;
} 

.margem-baixa-notice {
  background: #ffeaea;
  color: #b30000;
  border-radius: 6px;
  font-size: 0.95em;
  font-weight: 500;
  padding: 0.2rem 0.7rem;
  margin-top: 0.5rem;
  display: inline-block;
  border: 1px solid #ffb3b3;
} 

.logout-btn {
  background: var(--danger-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.35rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  position: static;
  margin: 0;
  transition: background 0.2s;
  z-index: 10;
}
.logout-btn:hover {
  background: #a71d2a;
} 

.usuario-nome {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 1rem;
  margin-left: 1.2rem;
  background: #f4f7f9;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  display: inline-block;
} 

.resumo-financeiro {
  background: #f7f7fb;
  color: var(--primary-color);
  border: 2px solid #e4e7ea;
  border-radius: 10px;
  font-size: 1.08rem;
  font-weight: 500;
  padding: 1rem 1.5rem;
  margin-bottom: 1.2rem;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 2.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.resumo-financeiro span {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
}
.resumo-financeiro .valor {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--success-color);
} 

.theme-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.28rem 0.7rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  position: static;
  margin: 0;
  transition: background 0.2s;
  z-index: 10;
}
.theme-btn:hover {
  background: var(--primary-dark-color);
}

body.theme-dark {
  --bg-color: #181a1b;
  --card-bg-color: #23272b;
  --text-color: #f1f1f1;
  --text-light-color: #b0b0b0;
  --primary-color: #8ab4f8;
  --primary-dark-color: #5a7bb7;
  --success-color: #34c759;
  --danger-color: #ff453a;
  --border-color: #33383d;
  --shadow: 0 4px 15px rgba(0,0,0,0.18);
}
body.theme-dark .form-card,
body.theme-dark .historico-simulacoes,
body.theme-dark .resumo-financeiro,
body.theme-dark .sugestao-ideal {
  background: var(--card-bg-color);
  color: var(--text-color);
  border-color: var(--border-color);
}
body.theme-dark .marketplace-card {
  background: var(--card-bg-color);
  color: var(--text-color);
  border-color: var(--border-color);
}
body.theme-dark .input-wrapper {
  background: #23272b;
  border-color: var(--border-color);
}
body.theme-dark .input-prefix, body.theme-dark .input-suffix {
  color: var(--text-light-color);
}
body.theme-dark .feedback-global.success {
  background: #1e2a1e;
  color: var(--success-color);
  border-color: var(--success-color);
}
body.theme-dark .feedback-global.error {
  background: #2a1e1e;
  color: var(--danger-color);
  border-color: var(--danger-color);
}
body.theme-dark .discount-notice {
  background: #3a2e1e;
  color: #ffe082;
  border-color: #ffe082;
}
body.theme-dark .margem-baixa-notice {
  background: #3a1e1e;
  color: #ffb3b3;
  border-color: #ffb3b3;
} 

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.theme-btn, .logout-btn {
  position: static;
  margin: 0;
  min-width: 38px;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.theme-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.28rem 0.7rem;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 10;
}
.theme-btn:hover {
  background: var(--primary-dark-color);
}
.logout-btn {
  background: var(--danger-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.28rem 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 10;
}
.logout-btn:hover {
  background: #a71d2a;
}
.usuario-nome {
  color: var(--primary-color);
  font-weight: 700;
  font-size: 1.08rem;
  margin-left: 0.7rem;
  background: #f7f7fb;
  border-radius: 10px;
  padding: 0.5rem 1.2rem;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(74,71,163,0.07);
  text-shadow: 0 1px 0 #fff;
}
.usuario-nome svg, .usuario-nome img, .usuario-nome .icon {
  margin-right: 0.5rem;
} 

.graficos-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f7fb;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(74,71,163,0.07);
  border: 1.5px solid #ecebfa;
  margin: 2rem 0 1.5rem 0;
  padding: 1.2rem 0.5rem;
  gap: 1.2rem;
  position: relative;
}
.graficos-canvas-wrapper {
  width: 100%;
  max-width: 480px;
  min-width: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.graficos-canvas-wrapper canvas {
  width: 100% !important;
  max-width: 450px;
  min-width: 180px;
  height: 430px !important;
  margin: 0 auto;
  display: block;
  background: transparent;
}
.grafico-nav-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(74,71,163,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
}
.grafico-nav-btn:hover {
  background: var(--primary-dark-color);
  transform: scale(1.08);
}
@media (max-width: 600px) {
  .graficos-container {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.7rem 0.2rem;
  }
  .graficos-canvas-wrapper {
    max-width: 98vw;
  }
  .graficos-canvas-wrapper canvas {
    max-width: 98vw;
    height: 160px !important;
  }
  .grafico-nav-btn {
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
  }
}
body.theme-dark .graficos-container {
  background: #23272b;
  border-color: var(--border-color);
} 

/* Checkbox customizado para o histórico */
#historico-lista input[type="checkbox"].chk-historico {
  accent-color: var(--primary-color);
  width: 1.15em;
  height: 1.15em;
  border-radius: 5px;
  margin-right: 12px;
  vertical-align: middle;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(74,71,163,0.08);
  transition: box-shadow 0.2s;
}
#historico-lista input[type="checkbox"].chk-historico:focus {
  outline: 2px solid var(--primary-color);
  box-shadow: 0 0 0 2px #b3b3f7;
}

/* Botão de apagar selecionados estilizado */
#btn-remover-historico {
  margin: 14px 0 0 0;
  background: linear-gradient(90deg, var(--danger-color) 80%, #ffb3b3 100%);
  color: #fff;
  border: none;
  padding: 0.85rem 1.5rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1.08rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(220,53,69,0.08);
  letter-spacing: 0.5px;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  display: block;
}
#btn-remover-historico:hover {
  background: linear-gradient(90deg, #a71d2a 80%, #ffb3b3 100%);
  box-shadow: 0 4px 16px rgba(220,53,69,0.13);
  transform: translateY(-2px) scale(1.03);
} 