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

  Copied VERBATIM from
  supernova-desktop-application/css/destiny-2/match-history.css.

  Nothing above this line down to "MARKETING PORT DEVIATIONS" has been touched,
  including the LoL-era .cell-rune / .cell-spells / .cell-champion / .cell-items
  and .match-history-menu rules that have no markup on this page — keeping the
  file byte-identical is what guarantees the demo looks like the product.

  Every deviation lives in one clearly marked block at the very bottom.
*/

/* 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;
}

.match-history {
  position: relative;
  width: calc(100% - 112px);
  top: 72px;
  left: 90px;
  min-height: calc(100vh - 302px);
}

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

/* ===== Toolbar (sticky) ===== */
/* ================================
   Match History — Header Bar (Sticky)
   Works with Queues + Champions dropdowns
   and lane chips
   ================================ */

/* Toolbar container */
.match-history-toolbar {
  position: sticky;
  top: 0;
  /* stick to viewport top */
  z-index: 1;
  /* above the table header */
  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;
}

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

/* Right-side controls */
.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: 56px;
}




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

/* IMPORTANT: For sticky to work, avoid overflow on ancestors */
.match-history-background {
  overflow: clip;
  /* ensure sticky elements can stick */
}



/* ================================
   Dropdown Menus (Queues & Champions)
   JS positions these absolutely on <body>
   ================================ */

.match-history-menu {
  position: absolute;
  /* coordinates set by JS */
  inset: auto auto;
  /* reset */
  min-width: 220px;
  background: #1f2028;
  border: 1px solid #585b6e;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  color: #fff;
  overflow: hidden;
  z-index: 1000;
  /* above sticky bars */
}

/* Search (Champions menu only) */
.match-history-menu-search {
  padding: 8px 10px;
  border-bottom: 1px solid #3a3c47;
}

.match-history-search {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #fff;
  font-family: var(--font-work-sans);
}

/* Scrollable list area */
.match-history-menu-list {
  max-height: 360px;
  overflow: auto;
}

/* Menu items */
.match-history-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  background: transparent;
  border: none;
  color: #fff;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  font-family: inherit;
}

.match-history-menu-item:hover {
  background: #272730;
}

.match-history-menu-item[aria-selected="true"] {
  background: #262833;
}

/* Left side (icon + label) inside item */
.match-history-menu-item .left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  /* allow text ellipsis if needed */
}

.match-history-menu-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid #454756;
  object-fit: cover;
}

.match-history-menu-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right-aligned meta (e.g., KDA%) */
.match-history-menu-k {
  opacity: .7;
  font-size: 12px;
}

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









/* ===== Match Entries ===== */

.match-entries {
  overflow: scroll;
}

/* Header & Entry Rows */
.match-history-header,
.match-entry {
  display: grid;
  grid-template-columns: 0.9fr
    /* Date */
    0.9fr
    /* Result */
    1.6fr
    /* Mode */
    2.4fr
    /* Map */
    1fr
    /* Guardian */
    0.9fr
    /* K / D / A */
    0.9fr
    /* KDA Ratio */
    0.9fr
    /* Efficiency */
    0.9fr;
  align-items: center;
  padding: 8px 12px;
  font-size: var(--font-size-xs);
  box-sizing: border-box;
  gap: 8px;
}

.match-entry {
  min-height: 49px;
}

.match-history-header>div,
.match-entry>div {
  overflow: hidden;
  /* hide extra text */
  white-space: nowrap;
  /* single line */
  text-overflow: ellipsis;
  /* show … */
  min-width: 0;
  /* ✅ critical in grid to allow shrinking */
}



.match-entry {
  border-bottom: 1px solid #454756;
  transition: background 0.2s ease;
}

.match-entry:hover {
  background: #272730;
}

.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+9),
.match-entry> :nth-child(n+6):nth-child(-n+9) {
  text-align: right;
  justify-self: end;
  /* grid’s version of flex-end */
}

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


.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-rune img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: #454756 1px solid;
  object-fit: cover;
  margin: auto;
}

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

.cell-champion img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: #454756 1px solid;
}

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

.cell-items {
  display: flex;
  gap: 6px;
  /* tighten spacing a bit */
}

/* Container for each slot */


/* 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);
}

/* Role Icons */
.role-icon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: #454756 1px solid;
  /* Remove if too busy */
  object-fit: cover;
  margin-right: 4px;
}


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

.match-history-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.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) {

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

  .match-history-header,
  .match-entry {
    grid-template-columns: 1fr
      /* Date */
      0.9fr
      /* Result */
      2fr
      /* Mode */
      1fr
      /* Guardian */
      0.9fr
      /* K / D / A */
      0.9fr
      /* KDA Ratio */
      0.9fr
      /* Efficiency */
      0.9fr;
  }
}

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

  /* Hide Map + Efficiency */
  .match-history-header>div:nth-child(4),
  .match-entry>div:nth-child(4),
  .match-history-header>div:nth-child(8),
  .match-entry>div:nth-child(8) {
    display: none;
  }

  .match-history-header,
  .match-entry {
    grid-template-columns: 1fr
      /* Date */
      0.9fr
      /* Result */
      2fr
      /* Mode */
      0.9fr
      /* Guardian */
      0.9fr
      /* K / D / A */
      0.9fr
      /* KDA Ratio */
      0.9fr;
  }
}

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

  /* Hide Map + Efficiency + KDA Ratio */
  .match-history-header>div:nth-child(4),
  .match-entry>div:nth-child(4),
  .match-history-header>div:nth-child(8),
  .match-entry>div:nth-child(8),
  .match-history-header>div:nth-child(7),
  .match-entry>div:nth-child(7) {
    display: none;
  }

  .match-history-header,
  .match-entry {
    grid-template-columns:
      1fr
      /* Date */
      0.9fr
      /* Result */
      2fr
      /* Mode */
      0.9fr
      /* Guardian */
      0.9fr
      /* K / D / A */
      0.9fr;
    /* Duration */
  }
}


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

  /* Compact: hide Guardian, show essentials */
  .match-history-header>div:nth-child(5),
  .match-entry>div:nth-child(5) {
    display: none;
  }

  .match-history-header,
  .match-entry {
    grid-template-columns:
      1fr
      /* Date */
      0.9fr
      /* Result */
      1.6fr
      /* Mode */
      0.9fr
      /* K / D / A */
      0.9fr;
    /* Duration */
  }
}

@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;
    /* contain the span */
    min-width: 0;
    /* critical for flex child truncation */
  }

  .cell-mode span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
    /* allows it to shrink and ellipsize */
  }

}



@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;
    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;
  }



  .mode-picklist {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    box-shadow: none;
    /* if you added any */
  }

  .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) {

  /* Mobile: hide K/D/A, keep date/result/mode/duration */
  .match-history-header>div:nth-child(6),
  .match-entry>div:nth-child(6) {
    display: none;
  }

  .match-history-header,
  .match-entry {
    grid-template-columns:
      1fr
      /* Date */
      0.9fr
      /* Result */
      1.6fr
      /* Mode */
      0.9fr;
    /* Duration */
  }

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

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

  .match-history-header,
  .match-entry {
    grid-template-columns:
      1fr
      /* Date */
      0.9fr
      /* Result */
      0.9fr;
    /* Duration */
  }

  /* Hide Mode on very small screens */
  .match-history-header>div:nth-child(3),
  .match-entry>div:nth-child(3) {
    display: none;
  }
}

/* ==========================================================================
   MARKETING PORT DEVIATIONS
   --------------------------------------------------------------------------
   Everything above this line is a byte-for-byte copy of the app's
   css/destiny-2/match-history.css. The rules below are the only additions,
   and every one of them exists because this page has no app chrome.

   1. Vertical offsets. The app's real header is `position: fixed`, so the
      controls row and the table needed 56px / 72px of top offset to clear it.
      The marketing topbar (report-shell.css) is `position: sticky` and
      therefore already in flow, so the same values would leave a large empty
      band under it. 24px / 40px reproduces the app's visual spacing.

   2. Mode + Guardian icon sizing. The app's match-history.js injects these at
      runtime as a `<style id="d2-match-history-icon-styles">` element. Static
      CSS is clearer here and means match-history.js never touches
      document.head. The values are copied from that injected rule exactly.

   3. A trailing margin so the last row isn't flush against the viewport — the
      app has a footer band there, the demo doesn't.
   ========================================================================== */

/* --- 1 + 3. Offsets ------------------------------------------------------ */

.match-history {
  top: 40px;
  /* was 72px — see note 1 */
  margin-bottom: 80px;
}

.match-history-controls {
  top: 24px;
  /* was 56px — see note 1 */
}

/* --- 2. Mode / Guardian icon slots --------------------------------------- */
/* Mirrors the app's runtime-injected #d2-match-history-icon-styles exactly. */

.cell-mode,
.cell-guardian {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-icon,
.guardian-icon {
  width: 12px;
  height: auto;
  object-fit: contain;
  flex: 0 0 20px;
}

/*
  `.mode-icon` is shared with the mobile mode picklist's chevron under 540px,
  so this rule sits on top of it — exactly as it does in the app, where the
  injected <style> lands in document.head at DOMContentLoaded and therefore
  also comes after every <link>. The overlap is harmless either way: the only
  properties in common are `width: 12px` and `height: auto`, which the chevron
  rule already sets to the same values, and `flex` means nothing to an
  absolutely positioned element. Left as-is rather than "fixed", so the demo
  cascades the same way the product does.
*/
