/* Test popup system for season -> match -> player flow */
body.archive-popup-open {
  overflow: hidden !important;
}

#archivePopupRoot {
  position: relative;
  z-index: 9000;
}

.archive-popup-layer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.archive-popup-layer.is-open {
  opacity: 1;
  pointer-events: auto;
}

.archive-popup-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(7, 25, 58, 0.38), rgba(3, 12, 31, 0.84)),
    rgba(3, 12, 31, 0.74);
}

.archive-popup-window {
  position: relative;
  width: min(1120px, calc(100vw - 46px));
  height: min(860px, calc(100vh - 46px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f3f7ff;
  border: 4px solid #07193a;
  border-radius: 14px;
  box-shadow:
    0 0 0 7px rgba(23, 70, 140, 0.24),
    0 22px 65px rgba(0, 0, 0, 0.68);
  transform: translateY(14px) scale(0.985);
  transition: transform 180ms ease;
}

.archive-popup-layer.is-open .archive-popup-window {
  transform: translateY(0) scale(1);
}

.archive-popup-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 9px 6px 15px;
  background: linear-gradient(to bottom, #17468c, #07193a);
  color: #ffffff;
  border-bottom: 2px solid #d69a2d;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.archive-popup-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.archive-popup-close {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #ffffff;
  color: #07193a;
  font-size: 25px;
  line-height: 1;
  font-weight: 900;
  cursor: pointer;
}

.archive-popup-close:hover {
  background: #d69a2d;
  color: #07193a;
}

.archive-popup-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #f3f7ff;
}

/* Deep-linked / iframe popup page mode */
html.archive-popup-mode,
body.archive-popup-mode {
  background: #f3f7ff !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: auto !important;
}

html.archive-popup-mode .header-bar,
html.archive-popup-mode .site-header-image,
html.archive-popup-mode .site-header-overlay,
html.archive-popup-mode .nav-links,
html.archive-popup-mode footer {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

html.archive-popup-mode .page-wrap {
  max-width: 100% !important;
  width: auto !important;
  margin: 0 !important;
  padding: 12px !important;
  box-sizing: border-box !important;
}

html.archive-popup-mode .content-box:first-child {
  margin-top: 0 !important;
}

html.archive-popup-mode .season-matches-wide {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
}

@media (max-width: 760px) {
  .archive-popup-layer {
    align-items: stretch;
    justify-content: stretch;
  }

  .archive-popup-window {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .archive-popup-toolbar {
    min-height: 46px;
  }

  html.archive-popup-mode .page-wrap {
    padding: 8px !important;
  }
}


/* === Popup width/overflow fix for team and wide match tables === */
.archive-popup-window {
  width: min(1260px, calc(100vw - 34px));
}

html.archive-popup-mode .content-box {
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: auto !important;
}

html.archive-popup-mode .team-matches-section,
html.archive-popup-mode .season-matches-wide {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  box-sizing: border-box !important;
  overflow-x: auto !important;
}

html.archive-popup-mode .team-season-matches-table,
html.archive-popup-mode .season-matches-table {
  width: 100% !important;
  min-width: 920px;
}

html.archive-popup-mode .team-season-result-link,
html.archive-popup-mode .season-result-link {
  grid-template-columns: minmax(135px, 1fr) 64px minmax(135px, 1fr) !important;
  column-gap: 8px !important;
}

html.archive-popup-mode .team-season-matches-table th,
html.archive-popup-mode .team-season-matches-table td,
html.archive-popup-mode .season-matches-table th,
html.archive-popup-mode .season-matches-table td {
  padding-left: 5px !important;
  padding-right: 5px !important;
}

@media (max-width: 760px) {
  html.archive-popup-mode .team-season-matches-table,
  html.archive-popup-mode .season-matches-table {
    min-width: 760px;
  }
}
/* === End popup width/overflow fix === */

.archive-editor-context-menu{position:fixed;z-index:2147483647;min-width:180px;padding:6px;background:#f3f7ff;border:2px solid #07193a;border-radius:9px;box-shadow:0 8px 28px rgba(0,0,0,.42);font:14px Arial,Helvetica,sans-serif;color:#14213d}.archive-editor-context-head{padding:5px 8px;font-weight:800;color:#07193a;border-bottom:1px solid rgba(7,25,58,.22);margin-bottom:4px}.archive-editor-context-menu button{display:block;width:100%;margin:0;padding:7px 9px;border:0;background:transparent;text-align:left;color:#14213d;cursor:pointer}.archive-editor-context-menu button:hover{background:#dbeafe}

#archivePopupRoot{z-index:2147483000!important}
.archive-popup-layer{z-index:2147483010!important;align-items:flex-start!important;padding-top:12px!important;padding-bottom:12px!important;box-sizing:border-box}
.archive-popup-window{max-height:calc(100vh - 24px)!important;height:min(860px,calc(100vh - 24px))!important}
