/* CS2 Inventory Value Checker — mirrors the CounterSheets app Home tab
   (frontend/src/style.css default theme + homeWidgets/constants.js). */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Stratum+2&display=swap");

:root {
  --bg-primary: #0f1317;
  --bg-secondary: #11111a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #222240;
  --bg-header: #13131e;
  --bg-input: #13131e;
  --text-primary: #dadae7;
  --text-secondary: #9aa3b8;
  --text-muted: #888;
  --border-primary: #2e2e1e;
  --color-positive: #a6e3a1;
  --color-negative: #ff6b6b;
  --color-accent: #c9943a;
  --text-on-accent: #fff;
  --font-heading: "Stratum 2", "Noto Sans", "Inter", sans-serif;
}

* {
  box-sizing: border-box;
}

/* display rules on .results/.status etc. must not defeat the hidden attr */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: "Inter", "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ----- Top bar ----- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Match the cssheets.com site-header height (12px padding + ~36px nav row). */
  padding: 12px 22px;
  min-height: 60px;
  box-sizing: border-box;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-primary);
  /* Match the cssheets.com site-header's bottom drop shadow. */
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.wordmark {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.wordmark-accent {
  color: var(--color-accent);
}

.topbar-link {
  font-weight: 600;
  font-size: 0.95rem;
}

/* ----- Hero / lookup ----- */
.hero {
  text-align: center;
  padding: 64px 0 24px;
  transition: padding 0.3s ease;
}

.hero.compact {
  padding: 28px 0 8px;
}

.hero.compact h1 {
  font-size: 1.4rem;
}

.hero.compact .hero-note {
  display: none;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  font-weight: 700;
  margin: 0 0 12px;
  transition: font-size 0.3s ease;
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin: 0 0 32px;
}

.lookup {
  display: flex;
  gap: 10px;
  max-width: 620px;
  margin: 0 auto;
}

.lookup input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  font-size: 1rem;
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s;
}

.lookup input:focus {
  border-color: var(--color-accent);
}

.lookup button {
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 650;
  color: var(--text-on-accent);
  background-color: var(--color-accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: filter 0.15s;
  white-space: nowrap;
}

.lookup button:hover {
  filter: brightness(1.12);
}

.lookup button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.hero-note {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 14px;
}

/* ----- Status / errors ----- */
.status {
  max-width: 620px;
  margin: 8px auto 0;
  padding: 14px 18px;
  border-radius: 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  text-align: center;
}

.status.error {
  border-color: #7f3b3b;
  color: #e8a9a9;
}

/* ----- Results stack ----- */
.results {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 0 56px;
}

/* ----- Header stats card ----- */
.stats-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-input) 140%);
  border: 1px solid var(--border-primary);
  border-radius: 14px;
  padding: 22px 26px;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-primary);
}

.profile-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
}

.total-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.total-value {
  margin: 2px 0 0;
  font-family: var(--font-heading);
  font-size: clamp(34px, 6vw, 46px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--color-positive);
}

.stats-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  padding: 10px 16px;
  min-width: 92px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-num {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
}

/* ----- Panels ----- */
.panels-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panels-row.single {
  grid-template-columns: 1fr;
}

.panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 14px;
  padding: 20px 24px;
}

.panel-title {
  margin: 0 0 14px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-head .panel-title {
  margin-bottom: 14px;
}

.alloc-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
}

.alloc-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.alloc-tab:hover {
  color: var(--text-primary);
}

.alloc-tab.active {
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid var(--border-primary);
  padding: 4px 9px;
}

/* ----- Item rows (Top 5 / stickers) ----- */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background-color: var(--bg-input);
  border-left: 3px solid var(--text-muted);
  border-radius: 8px;
  padding: 10px 12px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.item-row:hover {
  background-color: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
  text-decoration: none;
}

.item-row img.item-img {
  width: 80px;
  height: 60px;
  object-fit: contain;
  flex-shrink: 0;
}

.item-main {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-count {
  color: var(--text-muted);
  font-weight: 500;
}

.item-stickers {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}

.item-stickers img {
  width: 28px;
  height: 21px;
  object-fit: contain;
}

.item-price {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-positive);
  white-space: nowrap;
}

.empty-note {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 18px 0;
}

/* ----- Allocation donut ----- */
.allocation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}

.donut-wrap {
  position: relative;
  width: 260px;
  height: 260px;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-center-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.donut-center-value {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
}

.alloc-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 260px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-label {
  flex: 1;
  color: var(--text-secondary);
}

.legend-value {
  font-weight: 600;
}

.legend-pct {
  color: var(--text-muted);
  width: 48px;
  text-align: right;
}

/* ----- CTA ----- */
.cta-card {
  text-align: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 14px;
  padding: 32px 24px;
}

.cta-card h2 {
  font-family: var(--font-heading);
  margin: 0 0 10px;
}

.cta-card p {
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 22px;
}

.cta-btn {
  display: inline-block;
  padding: 13px 28px;
  font-weight: 650;
  color: var(--text-on-accent);
  background-color: var(--color-accent);
  border-radius: 10px;
  transition: filter 0.15s;
}

.cta-btn:hover {
  filter: brightness(1.12);
  text-decoration: none;
}

/* ----- Footer ----- */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 24px 16px;
  border-top: 1px solid var(--border-primary);
  margin-top: 40px;
}

/* ----- Mobile ----- */
@media (max-width: 760px) {
  .panels-row {
    grid-template-columns: 1fr;
  }

  .stats-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-right {
    width: 100%;
  }

  .stat-tile {
    flex: 1;
  }
}

@media (max-width: 560px) {
  .hero {
    padding-top: 44px;
  }

  .lookup {
    flex-direction: column;
  }

  .lookup button {
    width: 100%;
    padding: 15px;
  }

  .allocation {
    gap: 24px;
  }
}
