/*
  match-history.css — STATIC marketing port of the app's Dota 2 Match History.

  Ported from supernova-desktop-application/css/dota-2/match-history.css.
  The layout offsets (top/left/width) are unchanged because the marketing
  report shell uses the same content box as the app's side-nav layout.

  Dropped from the original: the LoL-era cell-rune / cell-spells / cell-champion
  rules and the .match-history-menu dropdown styles — neither has markup on
  this page. Everything that renders is identical to the app.
*/

/* Global Variables and Base */
html,
body {
  text-align: left;
  font-size: var(--font-size-sm);
  color: var(--color-white);
  font-family: var(--font-work-sans);
}

body {
  background: #1C1C24 url(https://files.supernova-analytics.com/sn-app-icons/Profile/Page-Background-dark.png);
  background-size: cover;
  background-position: center;
  background-repeat: repeat;
  background-attachment: fixed;
}

/* Match History Layout */
.match-history-background {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  right: 0;
  bottom: 40px;
  left: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--br-4xs);
  background: var(--color-gray-200);
  border: 1px solid var(--color-darkslategray-100);
  box-sizing: border-box;
  overflow: clip;
  /* ensure sticky elements can stick */
}

/*
  Vertical offsets differ from the app: the app's header is `position: fixed`,
  so its content needed 56px/72px of top offset to clear it. The marketing
  topbar is sticky and therefore already in flow, so the same values would
  leave a large empty band. 24px / 40px reproduces the app's visual spacing
  (24px under the header, 16px between the controls and the table).
*/
.match-history {
  position: relative;
  width: calc(100% - 112px);
  top: 40px;
  left: 90px;
  min-height: calc(100vh - 302px);
  margin-bottom: 80px;
}

.loading {
  text-align: center;
  top: 200px;
  position: absolute;
  width: 100%;
  color: #A8AAB0;
}

/* ================================
   Toolbar (sticky)
   ================================ */
.match-history-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px;
  background: #1C1C24;
  border-bottom: 1px solid #454756;
  border-radius: 9px 9px 0px 0px;
}

.match-history-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}

/* Controls row above the table */
.match-history-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: calc(100% - 112px);
  box-sizing: border-box;
  position: relative;
  z-index: 10;
  left: 90px;
  top: 24px;
}

/* ================================
   Column labels (sticky under toolbar)
   ================================ */
.match-history-header {
  position: sticky;
  top: 48px;
  z-index: 1;
  font-weight: 500;
  background: var(--color-gray-1200);
  border-bottom: 1px solid #454756;
  text-transform: uppercase;
}

/* Utility */
.hidden {
  display: none !important;
}

/* ===== Match Entries ===== */
.match-entries {
  overflow: scroll;
}

/* Header & Entry Rows */
.match-history-header,
.match-entry {
  display: grid;
  grid-template-columns:
    1fr
    1fr
    0.8fr
    2.2fr
    2.5fr
    0.8fr
    1.5fr
    0.8fr
    0.8fr
    1.2fr
    0.8fr
  ;
  align-items: center;
  padding: 8px 12px;
  font-size: var(--font-size-xs);
  box-sizing: border-box;
  gap: 8px;
}

/*
  The report button is gated behind has_report, so this cell is empty on every
  demo row. :empty drops it out of the grid — no stray column, no trailing gap.
  The templates no longer declare an Actions track either; if a match ever
  carries a report the cell lands in an implicit auto track sized to the button.
  match-history.js emits it without surrounding whitespace so :empty matches.
*/
.cell-action:empty {
  display: none;
}

.match-history-header>div,
.match-entry>div {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.match-entry {
  background: var(--color-gray-1100);
  border-bottom: 1px solid #454756;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.match-entry:hover {
  background: #272730;
  box-shadow: inset 3px 0 0 #3CB4CC;
}

.match-entry>div {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cell-duration {
  text-align: right;
  justify-content: end;
}

.match-history-header> :nth-child(n+6):nth-child(-n+11),
.match-entry> :nth-child(n+6):nth-child(-n+11) {
  text-align: right;
  justify-self: end;
}

.match-entry>div:nth-child(5) {
  overflow: visible;
}

.match-entry>div:nth-child(12) {
  justify-content: end;
}

.mh-row-btn {
  height: 30px;
  width: 30px;
  border-radius: 4px;
  border: #454756 1px solid;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.mh-row-btn:hover {
  border: #3CB4CC 1px solid;
}

/* Icons */
.cell-hero img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: #454756 1px solid;
  object-fit: cover;
}

.cell-items img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: #454756 1px solid;
}

.cell-items {
  display: flex;
  gap: 6px;
}

/* Empty slot (no img inside) */
.item-icon-container.empty-1 {
  border: #3c3f50 1px solid;
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

/* Victory / Defeat Highlights */
.match-entry.victory-row {
  background: linear-gradient(to right, #3ec56994 -116%, rgba(62, 197, 105, 0) 60%) no-repeat, var(--color-gray-200);
  background-size: 40% 100%;
  color: #fff;
}

.match-entry.defeat-row {
  background-color: var(--color-gray-200);
}

/* Result cell colouring */
.cell-result.victory {
  color: var(--color-mediumseagreen-100, #3ec569);
  font-weight: 600;
}

.cell-result.defeat {
  color: var(--color-crimson, #f53c3d);
  font-weight: 600;
}

/* Empty / Error States */
.empty,
.error {
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--color-lightgray);
  position: relative;
  top: 30px;
}

.queue-mode-wrapper {
  display: none;
}

.queue-tabs {
  display: inline-flex;
  position: relative;
  border: 1px solid #454857;
  border-radius: 4px;
}

.queue-tab {
  appearance: none;
  border: 0;
  background: var(--Obsidian);
  color: #A8AAB0;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
  font-family: var(--font-work-sans);
}

.queue-tab+.queue-tab {
  border-left: 1px solid #454857;
}

.queue-tab:hover {
  background: #272730;
}

.queue-tab:focus-visible {
  outline: 2px solid #7cc1ff;
  outline-offset: -2px;
  border-radius: 8px;
}

.queue-tab.is-active {
  color: #fff;
  background: var(--Obsidian);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
  z-index: 2;
}

.queue-tab:first-child {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.queue-tab:last-child {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.timeline-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.timeline-icon {
  position: absolute;
  right: 12px;
  top: 16px;
  width: 12px;
  height: auto;
  pointer-events: none;
  filter: brightness(0) invert(1);
}

.timeline-picklist {
  width: 125px;
  height: 36px;
  padding-left: 12px;
  padding-right: 28px;
  border-radius: 4px;
  background-color: var(--Obsidian);
  border: 1px solid var(--Charcoal);
  color: #fff;
  font-family: var(--font-work-sans);
  font-size: 14px;
  appearance: none;
  cursor: pointer;
  background-image: none;
  box-sizing: border-box;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-picklist:hover {
  background-color: #272730;
}

.timeline-picklist:focus,
.timeline-picklist:active {
  border: 1px solid white;
  outline: none !important;
  box-shadow: none !important;
}

.timeline-picklist:focus-visible {
  border: 1px solid #3CB4CC;
  outline: none !important;
  box-shadow: none !important;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 360px;
  margin: 100px auto;
  text-align: center;
  padding: 20px;
  color: var(--text-secondary, #9fa4ad);
  gap: 6px;
}

.empty-icon {
  height: auto;
  width: 34px;
  margin-bottom: 8px;
}

.empty-message {
  font-size: 16px;
  font-weight: 600;
  color: white;
  margin: 0;
}

.empty-subtext {
  font-size: 14px;
  font-weight: 400;
  color: #A8AAB0;
  margin: 0;
  line-height: 1.5;
}

/* ========================================
   Custom Tooltip for Match History Items
   ======================================== */
.item-tooltip-wrapper {
  position: relative;
  display: inline-block;
}

.tooltip-content {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: -22%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #24252c;
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  border: #454756 1px solid;
}

.tooltip-content::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: #454756 1px solid;
}

.item-tooltip-wrapper:hover .tooltip-content {
  visibility: visible;
  opacity: 1;
}

@media screen and (max-width: 1366px) {

  .match-history-header>div:nth-child(7),
  .match-entry>div:nth-child(7) {
    display: none;
  }

  .match-history-header,
  .match-entry {
    grid-template-columns:
      1fr
      1.3fr
      1fr
      2.2fr
      2.5fr
      1fr
      1.15fr
      1fr
      1.5fr
      1fr
    }
}

@media screen and (max-width: 1200px) {

  .match-history-header>div:nth-child(10),
  .match-entry>div:nth-child(10) {
    display: none;
  }

  .match-history-header,
  .match-entry {
    grid-template-columns:
      1fr
      1.2fr
      0.8fr
      2fr
      2.5fr
      0.8fr
      0.6fr
      0.6fr
      1fr
    }

}

@media screen and (max-width: 1024px) {

  .match-history-header>div:nth-child(11),
  .match-entry>div:nth-child(11) {
    display: none;
  }

  .match-history-header,
  .match-entry {
    grid-template-columns:
      1fr
      1.2fr
      0.8fr
      2fr
      2.5fr
      0.8fr
      0.6fr
      0.6fr
    }

}

@media screen and (max-width: 1024px) {

  .match-history-header>div:nth-child(8),
  .match-history-header>div:nth-child(9),
  .match-entry>div:nth-child(8),
  .match-entry>div:nth-child(9) {
    display: none;
  }

  .match-history-header,
  .match-entry {
    grid-template-columns:
      1fr
      1.2fr
      0.8fr
      2fr
      2.5fr
      0.8fr
    }

  .cell-hero {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    min-width: 0;
  }

  .cell-hero span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
  }

}

@media screen and (max-width: 800px) {

  .match-history-header>div:nth-child(5),
  .match-entry>div:nth-child(5) {
    display: none;
  }

  .match-history-header,
  .match-entry {
    grid-template-columns:
      1fr
      1.2fr
      0.8fr
      2fr
      0.8fr
    }

}

@media screen and (max-width: 768px) {

  .match-history-controls {
    width: calc(100% - 36px);
    left: 18px;
  }

  .match-history {
    width: calc(100% - 36px);
    left: 18px;
    min-height: calc(100vh - 358px);
  }

  .cell-mode {
    display: flex;
    overflow: hidden;
    min-width: 0;
  }

  .cell-mode span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
  }

}

@media screen and (max-width: 540px) {

  .queue-mode-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .queue-tabs {
    display: none;
  }

  .mode-icon {
    position: absolute;
    right: 12px;
    top: 16px;
    width: 12px;
    height: auto;
    pointer-events: none;
    filter: brightness(0) invert(1);
    display: block;
  }

  .mode-picklist {
    height: 36px;
    padding: 0 12px;
    border-radius: 4px;
    background-color: var(--Obsidian);
    border: 1px solid var(--Charcoal);
    font-family: var(--font-work-sans);
    font-size: 14px;
    color: white;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    outline: none;
    box-shadow: none;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    width: 100%;
  }

  .mode-picklist:hover {
    background-color: #272730
  }

  .mode-picklist:active,
  .mode-picklist:focus {
    border: 1px solid white;
    outline: none !important;
    box-shadow: none !important;
  }

  .mode-picklist:focus-visible {
    border: 1px solid #3CB4CC;
    outline: none !important;
    box-shadow: none !important;
  }

  .timeline-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 100%;
  }

  .timeline-picklist {
    width: 100%;
  }

  .empty-icon {
    height: auto;
    width: 28px;
    margin-bottom: 8px;
  }

  .empty-message {
    font-size: 16px;
    font-weight: 600;
    color: white;
    margin: 0;
  }

  .empty-subtext {
    font-size: 14px;
    font-weight: 400;
    color: #A8AAB0;
    margin: 0;
  }

}

@media screen and (max-width: 520px) {

  .match-history-header>div:nth-child(4),
  .match-entry>div:nth-child(4) {
    display: none;
  }

  .match-history-header,
  .match-entry {
    grid-template-columns:
      1fr
      1.5fr
      1fr
      1fr
    }

  .match-entry {
    padding: 17px 12px;
  }

}

@media screen and (max-width: 400px) {

  .match-history-header>div:nth-child(6),
  .match-entry>div:nth-child(6) {
    display: none;
  }

  .match-history-header,
  .match-entry {
    grid-template-columns: repeat(3, 1fr);
  }

}
