/* history.css — Past Tournaments page styles */

/* ── Shared header logo block (history + upcoming + contact) ─── */
.logo-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-title {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 0 30px rgba(123, 47, 190, 0.4);
  line-height: 1;
}

.site-sub {
  display: block;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  color: var(--purple-bright);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-top: 5px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--purple-light);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  margin-bottom: 8px;
  transition: all 0.2s;
}
.back-btn:hover {
  color: var(--text);
  border-color: var(--purple-light);
  background: var(--purple-dim);
}

#history-content {
  max-width: 900px;
  margin: 32px auto;
  padding: 0 24px;
}

.history-loading {
  text-align: center;
  padding: 48px;
  font-family: 'Share Tech Mono', monospace;
  color: var(--text-dim);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.history-card.open {
  border-color: var(--purple-light);
}

.history-card-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}
.history-card-header:hover {
  background: var(--purple-dim);
}

.history-card-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.history-card-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.06em;
}
.history-card-date {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
}

.history-chevron {
  color: var(--text-dim);
  transition: transform 0.3s;
  flex-shrink: 0;
}
.history-card.open .history-chevron {
  transform: rotate(180deg);
}

.history-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 0px solid var(--border);
}
.history-card.open .history-card-body {
  max-height: 2400px;
  border-top: 1px solid var(--border);
}

.history-loading-inner,
.history-error,
.history-empty {
  padding: 24px;
  text-align: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
}

.history-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 20px;
  align-items: start;
}

.history-panel-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--purple-light);
  margin-bottom: 12px;
}

.ht-row, .hf-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.ht-row:last-child, .hf-row:last-child {
  border-bottom: none;
}

.ht-place, .hf-rank {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  color: var(--text-dim);
  width: 24px;
  flex-shrink: 0;
}
.ht-logo, .hf-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ht-players, .hf-name {
  flex: 1;
  color: var(--text);
}
.ht-score {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  color: var(--purple-bright);
}
.hf-kills {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
}

@media (prefers-reduced-motion: reduce) {
  .history-card,
  .history-card-body,
  .history-chevron {
    transition: none;
  }
}

.history-fragger-panel {
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  height: 100%;
  overflow-y: auto;
}

.hfp-section-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--purple-light);
  margin-bottom: 10px;
}

.hfp-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
  box-shadow: 0 0 6px var(--purple-glow);
}

.hfp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(123,47,190,0.1);
}
.hfp-row:last-child {
  border-bottom: none;
}

.hfp-rank {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  color: var(--text-dim);
  width: 18px;
  flex-shrink: 0;
}

.hfp-logo {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.hfp-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hfp-bar-wrap {
  width: 60px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  flex-shrink: 0;
}

.hfp-bar {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--purple), var(--purple-bright));
  transition: width 0.4s ease;
}

.hfp-kills {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .hfp-bar {
    transition: none;
  }
}

/* ── Month group collapsible ───────────────────────────────────── */
.month-group {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--purple);
  border-radius: 8px;
  overflow: hidden;
}

.month-group__header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  min-height: 88px;
  transition: background 0.2s;
}

.month-group__header:hover {
  background: var(--purple-dim);
}

.month-group__label {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.06em;
}

.month-group__chevron {
  color: var(--text-dim);
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.month-group.is-open .month-group__chevron {
  transform: rotate(180deg);
}

.month-group__body {
  max-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.month-group.is-open .month-group__body {
  max-height: 8000px;
  padding: 8px 12px 12px;
}

@media (prefers-reduced-motion: reduce) {
  .month-group__header,
  .month-group__body,
  .month-group__chevron {
    transition: none;
  }
}

/* ── Mobile overrides ──────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Month group */
  .month-group__label { font-size: 11px; }

  /* Expanded tournament card body: allow more height for stacked layout */
  .history-card.open .history-card-body { max-height: 5000px; }

  /* Stack standings + fraggers vertically, full width */
  .history-panels {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
  }

  /* Tournament list card header text */
  .history-card-name { font-size: 12px; }
  .history-card-date { font-size: 10px; }

  /* Standings rows: allow names to wrap, scale text ~10% */
  .ht-row, .hf-row {
    font-size: 12.5px;
    gap: 8px;
  }

  .ht-players, .hf-name {
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
    overflow: visible;
    text-overflow: unset;
  }

  .ht-score { font-size: 11px; }

  /* Fragger panel rows: kill bar scales to fill available width */
  .hfp-row { gap: 6px; }

  .hfp-bar-wrap {
    flex: 1;
    width: auto;
    min-width: 40px;
  }

  .hfp-name {
    font-size: 12px;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: unset;
  }

  .hfp-kills { font-size: 11px; }

  /* History fragger panel: remove fixed height so it expands fully */
  .history-fragger-panel {
    height: auto;
    overflow-y: visible;
  }

  /* Map breakdown scroll strip: touch-scrollable */
  .history-card-body .mc-scroll {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }
}
