/* ──────────────────────────────────────────────────
   Trading Calculator — extends style.css (palette vars,
   .search-input, .card-value-icon, .card-demand etc. are
   already defined there and reused below).
   ────────────────────────────────────────────────── */

.calc-hero { padding: 70px 24px 20px; }

.tc-section { padding: 10px 0 80px; }

.tc-wrap { display: flex; flex-direction: column; gap: 18px; }

.tc-toolbar { display: flex; justify-content: flex-end; gap: 10px; }
.tc-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(28,37,52,0.8); border: 1px solid var(--border);
  color: var(--muted); font-size: 0.82rem; font-weight: 500;
  padding: 8px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition); font-family: 'Inter', sans-serif;
}
.tc-btn:hover { color: var(--text); border-color: var(--gold); }
.tc-btn.tc-clear:hover { color: var(--danger); border-color: var(--danger); }

/* ──────────── 3-COLUMN LAYOUT ──────────── */
.tc-grid {
  display: grid;
  grid-template-columns: 1fr 250px 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) {
  .tc-grid { grid-template-columns: 1fr; }
  .tc-verdict { order: 3; position: sticky; bottom: 12px; }
}

.tc-side {
  background: rgba(20,27,36,0.8);
  border: 1px solid rgba(36,48,68,0.8);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
}
.tc-give { border-top: 2px solid #F87171; }
.tc-receive { border-top: 2px solid #34D399; }

.tc-side-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.tc-side-header h2 {
  font-family: 'Playfair Display', serif; font-size: 1.15rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px; color: var(--text);
}
.tc-side-icon { font-size: 1.1rem; }
.tc-side-total {
  display: flex; align-items: center; gap: 4px;
  font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1.15rem;
  color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tc-side-count { font-size: 0.72rem; color: var(--muted); font-weight: 500; margin-left: 6px; }

.tc-search-wrap { position: relative; margin-bottom: 14px; }

.tc-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
  max-height: 320px; overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
}
.tc-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; cursor: pointer; transition: background var(--transition);
  border-bottom: 1px solid rgba(36,48,68,0.5);
}
.tc-dropdown-item:last-child { border-bottom: none; }
.tc-dropdown-item:hover { background: rgba(240,165,0,0.08); }
.tc-dropdown-img {
  width: 32px; height: 32px; border-radius: 6px; flex-shrink: 0;
  background: rgba(28,37,52,0.9); display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-size: 1rem;
}
.tc-dropdown-img img { width: 100%; height: 100%; object-fit: cover; }
.tc-dropdown-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tc-dropdown-name { font-size: 0.85rem; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-dropdown-value { display: flex; align-items: center; gap: 3px; font-size: 0.75rem; color: var(--gold); }
.tc-dropdown-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 0.85rem; }

/* ──────────── ITEM ROWS ──────────── */
.tc-items { display: flex; flex-direction: column; gap: 8px; max-height: 480px; overflow-y: auto; padding-right: 2px; }
.tc-empty { color: var(--muted); font-size: 0.85rem; text-align: center; padding: 24px 8px; }
.tc-empty.tc-error { color: var(--danger); }

.tc-row {
  display: grid;
  grid-template-columns: 40px 1fr auto auto auto;
  align-items: center; gap: 10px;
  background: rgba(28,37,52,0.55);
  border: 1px solid rgba(36,48,68,0.6);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  animation: fadeUp 0.25s ease both;
}
.tc-row-img {
  width: 40px; height: 40px; border-radius: 6px; overflow: hidden;
  background: rgba(20,27,36,0.9); display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; cursor: pointer; flex-shrink: 0;
}
.tc-row-img img { width: 100%; height: 100%; object-fit: cover; }
.tc-row-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; cursor: pointer; }
.tc-row-name { font-size: 0.85rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-row-demand { font-size: 0.62rem; font-weight: 600; padding: 1px 7px; border-radius: 99px; border: 1px solid; width: fit-content; }

.tc-row-qty { display: flex; align-items: center; gap: 6px; }
.tc-qty-btn {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border);
  background: rgba(20,27,36,0.9); color: var(--text); font-size: 0.9rem; line-height: 1;
  cursor: pointer; transition: all var(--transition); display: flex; align-items: center; justify-content: center;
}
.tc-qty-btn:hover { border-color: var(--gold); color: var(--gold); }
.tc-qty-num { min-width: 16px; text-align: center; font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.tc-row-value {
  display: flex; align-items: center; gap: 3px;
  font-size: 0.85rem; font-weight: 700; color: var(--gold); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tc-row-remove {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 0.85rem; padding: 4px; transition: color var(--transition);
}
.tc-row-remove:hover { color: var(--danger); }

/* ──────────── VERDICT PANEL ──────────── */
.tc-verdict {
  background: rgba(20,27,36,0.85);
  border: 1px solid rgba(36,48,68,0.8);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
  display: flex; flex-direction: column; gap: 16px;
}
.tc-verdict-badge {
  font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 700;
  color: var(--muted); transition: color var(--transition);
}
.tc-verdict-badge.fair    { color: var(--gold); }
.tc-verdict-badge.winning { color: #34D399; }
.tc-verdict-badge.losing  { color: #F87171; }

.tc-scale { display: flex; flex-direction: column; gap: 6px; }
.tc-scale-track {
  position: relative; height: 10px; border-radius: 99px;
  background: rgba(28,37,52,0.9); border: 1px solid var(--border);
  overflow: visible;
}
.tc-scale-fill {
  position: absolute; top: 0; bottom: 0; border-radius: 99px;
  transition: left 0.35s cubic-bezier(.19,.9,.24,1.05), width 0.35s cubic-bezier(.19,.9,.24,1.05), background var(--transition);
}
.tc-scale-fill.fair    { background: var(--gold-glow); }
.tc-scale-fill.winning { background: rgba(52,211,153,0.35); }
.tc-scale-fill.losing  { background: rgba(248,113,113,0.35); }
.tc-scale-center {
  position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px;
  background: var(--border); transform: translateX(-50%);
}
.tc-scale-marker {
  position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); border: 2px solid var(--navy);
  transform: translate(-50%, -50%);
  transition: left 0.35s cubic-bezier(.19,.9,.24,1.05), background var(--transition);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.25);
}
.tc-scale-marker.fair    { background: var(--gold); box-shadow: 0 0 12px var(--gold-glow); }
.tc-scale-marker.winning { background: #34D399; box-shadow: 0 0 12px rgba(52,211,153,0.45); }
.tc-scale-marker.losing  { background: #F87171; box-shadow: 0 0 12px rgba(248,113,113,0.45); }

.tc-scale-labels { display: flex; justify-content: space-between; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

.tc-verdict-detail {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 1rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums;
  min-height: 1.4em;
}
.tc-verdict-percent { color: var(--muted); font-weight: 500; font-size: 0.85rem; }

@media (max-width: 900px) {
  .tc-verdict { order: 0; }
}

@media (max-width: 600px) {
  .tc-row { grid-template-columns: 36px 1fr auto; grid-template-rows: auto auto; row-gap: 6px; }
  .tc-row-img { grid-column: 1 / 2; grid-row: 1 / 3; align-self: center; }
  .tc-row-info { grid-column: 2 / 3; grid-row: 1 / 2; }
  .tc-row-remove { grid-column: 3 / 4; grid-row: 1 / 2; justify-self: end; }
  .tc-row-qty { grid-column: 2 / 3; grid-row: 2 / 3; justify-self: start; }
  .tc-row-value { grid-column: 3 / 4; grid-row: 2 / 3; justify-self: end; }
}
