body {
  margin: 0;
  background: #3c2a18;
  font-family: Verdana;
  color: #f0e0b0;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
  width: 200px;
  background: #2a1a0e;
  border-right: 4px solid #6a4a20;
  padding: 10px;
  flex-shrink: 0;
}

.sidebar h2 {
  color: #ffd66b;
  text-align: center;
}

.tabBtn {
  width: 100%;
  padding: 10px;
  margin-bottom: 6px;
  border: none;
  background: #4a2e14;
  color: #f0e0b0;
  cursor: pointer;
  font-weight: bold;
}

.tabBtn.active {
  background: #a0742b;
  color: black;
}

/* CONTENT */

.content {
  flex: 1;
  padding: 15px;
  min-width: 0;
}

.panel {
  background: #2a1a0e;
  border: 4px solid #6a4a20;
  padding: 12px;
  width: 100%;
  box-sizing: border-box;
}

/* GRID DE ITENS */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.itemBtn {
  background: #4a2e14;
  border: 2px solid #6a4a20;
  text-align: center;
  cursor: pointer;
  padding: 8px;
}

.itemBtn > img {
  width: 32px;
}

/* BOTÕES */

.profileControls {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.profileControls select {
  padding: 6px;
  border: 2px solid #6a4a20;
  background: #3a2410;
  color: #f0e0b0;
  border-radius: 4px;
  min-width: 160px;
}

.buttons {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.setBtn {
  background: #7a9e2f;
}
.saveBtn {
  background: #2a7a9e;
}
.shareBtn {
  background: #7a2a9e;
}
.clearBtn {
  background: #8a2a2a;
}

/* ÁREA DE ITENS */

#itemsArea {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.itemsUngrouped,
.groupItems {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  min-height: 70px;
}

.groupsArea {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.itemGroup {
  border: 2px solid var(--group-color, #6a4a20);
  border-radius: 8px;
  padding: 8px;
  background: var(--group-bg-color, #2a1a0e);
}

.itemGroup.collapsed .groupItems {
  display: none;
}

.groupHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  background: var(--group-header-color, #1a1008); /* 🔥 FALTAVA */
  padding: 6px;
  border-radius: 6px;
}

.groupTitle {
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  outline: none;
  border: 1px dashed transparent;
  color: var(--group-title-color, #f0e0b0); /* 🔥 FALTAVA */
}

.groupTitle:focus {
  border-color: var(--group-color, #6a4a20);
  background: rgba(255, 255, 255, 0.08);
}

.groupColorPickers {
  margin-left: auto;
  display: flex;
  gap: 4px;
  align-items: center;
}

.groupColor {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 3px;
}

.minimizeBtn {
  border: none;
  background: transparent;
  color: var(--group-color, #f0e0b0);
  cursor: pointer;
  font-size: 12px;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

.groupDelete {
  border: none;
  background: #8a2a2a;
  color: #fff;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  cursor: pointer;
}

.dndContainer.dragOver {
  outline: 2px dashed #ffd66b;
  outline-offset: 2px;
  border-radius: 6px;
  background: rgba(255, 214, 107, 0.08);
}

.draggableCard {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.draggableCard:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.card.dragging {
  opacity: 0.55;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.45);
}

.cardPlaceholder {
  height: 110px;
  border: 2px dashed #ffd66b;
  border-radius: 8px;
  background: rgba(255, 214, 107, 0.12);
}

/* CARD */

.card {
  /* Default card looks neutral (white) and will change by rarity */
  background: var(--card-bg, #ffffff);
  border: 2px solid var(--card-border, #999999);
  padding: 10px;
  border-radius: 6px;
}

.cardHeader b {
  color: var(--card-title, #000000);
  font-weight: bold;
}

.cardHeader {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cardHeader img {
  width: 26px;
}

.remove {
  background: #8a2a2a;
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 5px;
}

.cardActions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.variantBtn {
  background: transparent;
  border: 1px solid rgba(240, 224, 176, 0.35);
  color: #f0e0b0;
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 15px;
  line-height: 1;
  transition: background 0.15s;
}

.variantBtn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #f0e0b0;
}

/* CRISTAIS */

.segmentBar {
  display: flex;
  gap: 3px;
  margin: 6px 0 10px 0;
  flex-wrap: wrap;
}

.crystal {
  width: 24px;
  height: 24px;
  background-image: url("icons/crystal.gif");
  background-size: contain;
  background-repeat: no-repeat;

  filter: grayscale(100%) brightness(0.6);
  opacity: 0.8;
}

.crystal.active {
  filter: none;
  opacity: 1;
}

/* COMBOS */

.comboGood {
  color: #66ff66;
}
.comboBad {
  color: #ff6666;
}

/* Card rarity coloring (based on stat average) */
.card.rarity-common {
  --card-bg: #4a2e14;
  --card-border: #d9d9d9;
  --card-title: #ffffff;
}

.card.rarity-rare {
  --card-bg: rgba(108, 180, 255, 0.14);
  --card-border: #6cb4ff;
  --card-title: #6cb4ff;
}

.card.rarity-epic {
  --card-bg: rgba(201, 135, 255, 0.16);
  --card-border: #c987ff;
  --card-title: #c987ff;
}

.card.rarity-legendary {
  --card-bg: rgba(255, 215, 0, 0.18);
  --card-border: #ffd700;
  --card-title: #ffd700;
}

/* TABELAS */

/* SUMMARY */

#summary {
  margin-top: 10px;
  font-weight: bold;
}

/* MOBILE */

.langSelector {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.langButtons {
  display: flex;
  gap: 6px;
}

.langBtn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  padding: 6px 8px;
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.langBtn.active,
.langBtn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 800px) {
  .sidebar {
    width: 120px;
  }

  #itemsArea {
    grid-template-columns: 1fr;
  }
}

/* CORES DOS STATS */

.statMin {
  color: #e8f3ff; /* branco gelo */
  font-weight: bold;
}

.statRec {
  color: #b766fa; /* roxo recomendado */
  font-weight: bold;
  text-shadow: 0 0 6px #b766fa88;
}

.statMax {
  color: #ffbf00; /* dourado */
  font-weight: bold;
  text-shadow: 0 0 6px #ffbf0088;
}

/* ITEM HEADER NA TABELA */

.tableItem {
  background: #2f1c0c;
  border: 2px solid #6a4a20;
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tableHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: bold;
}

.tableHeader img {
  width: 28px;
}

/* TABELA DE COMBOS */

.comboTableTitle {
  font-weight: bold;
  font-size: 12px;
  text-align: center;
  margin: 10px 0 3px;
  color: #f0e0b0;
  opacity: 0.85;
  letter-spacing: 0.03em;
}

.comboTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-family: monospace;
}

.comboTable th {
  background: #3a2410;
  border: 1px solid #6a4a20;
  padding: 4px;
}

.comboTable td {
  border: 1px solid #6a4a20;
  padding: 4px;
  text-align: center;
}

.comboRange {
  display: block;
  font-weight: bold;
}

.comboReq {
  display: block;
  font-size: 0.85em;
  color: #ccc;
}

/* GRID DA ABA TABELAS */

#tablesArea {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.singleStat {
  margin: 20px auto 0;
  height: 120px;
  padding: 12px 0;
  width: max-content;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: italic;
  color: #cccccc;
  font-weight: bolder;
  text-align: center;
}

/* TOAST */

.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(40, 40, 40, 0.92);
  color: #f0e0b0;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 210, 128, 0.5);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
  font-weight: bold;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1500;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

/* SLOT ITEM */

/* ICONE */

.tableIcon {
  width: 48px;
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 6px;
}

/* NOME ITEM */

.tableName {
  text-align: center;
  font-weight: bold;
  margin-bottom: 6px;
}

/* STATS */

.tableStats {
  text-align: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.rarityThresholds {
  width: 100%;
  margin: 8px 0 10px;
}

.rarityTitle {
  font-weight: bold;
  margin-bottom: 6px;
  text-align: center;
}

.rarityTable {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.rarityTable th,
.rarityTable td {
  border: 1px solid #6a4a20;
  padding: 4px;
  text-align: center;
  font-size: 12px;
}

.rarityTable th {
  background: #3a2410;
}

.rarityName {
  font-weight: bold;
}

.rarityRow.rarity-white .rarityValue {
  color: #f0f0f0;
}

.rarityRow.rarity-blue .rarityValue {
  color: #6cb4ff;
}

.rarityRow.rarity-purple .rarityValue {
  color: #c987ff;
}

.rarityRow.rarity-gold .rarityValue {
  color: #ffd700;
}

/* VARIANT SELECTOR FLOATING CARD */

.variantSelector {
  background: #2a1a0e;
  border: 2px solid #6a4a20;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.variantGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  min-width: 240px;
}

.variantItem {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: #3a2410;
  border: 1px solid #6a4a20;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.variantItem:hover {
  background: #5a3a20;
  border-color: #b86b2e;
  transform: scale(1.05);
  z-index: 10;
}

.variantItem img {
  max-width: 90%;
  max-height: 90%;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.3));
}

.variantItem[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a0a00;
  color: #f0e0b0;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid #6a4a20;
  z-index: 1001;
}
