/* AKTT Guild Stats — dark gamer-clean theme.
   Palette inspired by GitHub dark + ESO gold accents. */

:root {
  --bg:        #0d1117;
  --bg-2:     #161b22;
  --bg-3:     #21262d;
  --border:   #30363d;
  --text:     #c9d1d9;
  --text-dim: #8b949e;
  --gold:     #fbbc04;     /* ESO gold accent */
  --gold-dim: #d8a002;
  --gold-dk:  #392a00;
  --gold-lt:  #ffedb9;
  --gold-bg : #272216;
  --green:    #7ee787;
  --blue:     #79c0ff;
  --purple:   #d2a8ff;
  --red:      #ff7b72;

  --slate:    #81a4ff;
  --slate-dim:#5376ce;
  --slate-lt: #c7d7ff;
  --slate-bg: #17213b;

  --realgold:    #dcc06e;
  --realgold-dim:#a68f51;
  --realgold-lt: #ffefbf;
  --realgold-bg: #282314;
  
  --primary-hilite: var(--realgold);
  --primary-hilite-dim: var(--realgold-dim);
  --primary-hilite-bg: var(--realgold-bg);
  --primary-hilite-lt: var(--realgold-lt);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

a { color: var(--primary-hilite); text-decoration: none; }
a:hover { color: var(--primary-hilite-dim); text-decoration: underline; }

.muted     { color: var(--text-dim); }
.small     { font-size: 0.85em; }
.emph      { color: var(--primary-hilite); }

/* --- nav ----------------------------------------------------------------- */

.topnav {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1.2rem;
  display: flex; align-items: center; gap: 1.5rem;
  flex-wrap: wrap;
  position: sticky; top: 0; z-index: 10;
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary-hilite);
  letter-spacing: 0.2px;
}
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 1rem; }
.nav-links a {
  color: var(--text);
  font-weight: 500;
  padding: 0.25rem 0;
}
.nav-links a:hover { color: var(--primary-hilite); text-decoration: none; }

.user-picker {
  margin-left: auto;
  position: relative;
  min-width: 240px;
}
.user-picker input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.9rem;
}
.user-picker input:focus { outline: none; border-color: var(--primary-hilite); }
.search-results {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-top: none;
  margin: 0; padding: 0;
  list-style: none;
  max-height: 300px; overflow-y: auto;
  border-radius: 0 0 4px 4px;
  z-index: 20;
}
.search-results li { padding: 0; }
.search-results li a {
  display: block;
  padding: 0.4rem 0.6rem;
  color: var(--text);
}
.search-results li a:hover { background: var(--bg-3); color: var(--primary-hilite); text-decoration: none; }

/* --- layout -------------------------------------------------------------- */

.container { max-width: 1200px; width: 100%; margin: 0 auto; padding: 1.5rem 1.2rem; flex: 1; }

.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin: 0 0 0.25rem 0; color: var(--primary-hilite); }

/* --- cards --------------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.2rem;
}
.card-title {
  margin: 0 0 0.5rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}
.card .big {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-hilite);
}
.card p { margin: 0; }

.mini-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
}
.mini-card .muted { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }

/* --- panels -------------------------------------------------------------- */

.panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
}
.panel h3 { margin: 0 0 0.75rem 0; color: var(--text); }

.grid { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* --- period tabs (pill row) --------------------------------------------- */

.period-tabs {
  display: flex;
  gap: 0.4rem;
  margin: -0.5rem 0 1.2rem 0;
  flex-wrap: wrap;
}
.period-tabs a {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1;
}
.period-tabs a:hover {
  border-color: var(--primary-hilite);
  color: var(--primary-hilite);
  text-decoration: none;
}
.period-tabs a.active {
  background: var(--primary-hilite);
  color: var(--bg);
  border-color: var(--primary-hilite);
}
.period-tabs a.active:hover { color: var(--bg); }

/* --- boards grid (rankings) --------------------------------------------- */

.grid.boards {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.panel.board { display: flex; flex-direction: column; }
.panel.board h3 { margin-bottom: 0.25rem; }
.board-sub { margin: 0 0 0.6rem 0; }

/* --- ranked lists -------------------------------------------------------- */

.ranked { list-style: none; padding: 0; margin: 0; counter-reset: rank; }
.ranked li {
  counter-increment: rank;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--bg-3);
}
.ranked li:last-child { border-bottom: none; }
.ranked li::before {
  content: counter(rank) ".";
  color: var(--primary-hilite);
  font-weight: 600;
  margin-right: 0.6rem;
  min-width: 1.5em;
  display: inline-block;
}

/* --- tables -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th, table.data td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--bg-3);
}
table.data th {
  background: var(--bg-3);
  position: sticky; top: 0;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
table.data tbody tr:hover { background: rgba(251, 188, 4, 0.05); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .emph { color: var(--primary-hilite); font-weight: 500; }
table.data .unlocked { color: var(--green); font-weight: 500; }
table.sortable th[data-dir="asc"]::after { content: " ▲"; color: var(--primary-hilite); }
table.sortable th[data-dir="desc"]::after { content: " ▼"; color: var(--primary-hilite); }

/* --- raffles ------------------------------------------------------------ */

table.raffle-index tbody tr.row-link:hover { background: rgba(251, 188, 4, 0.08); }

.raffle-section { padding-top: 0.6rem; }
.raffle-section-title {
  margin: 0 0 1rem 0;
  font-size: 1.15rem;
  color: var(--primary-hilite);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}
.raffle-section-title .muted { color: var(--text-dim); }
.raffle-section-title .small { font-size: 0.8rem; }

table.prize-table tr.prize-cat-header td {
  background: var(--bg-3);
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.4px;
  padding-top: 0.5rem;
  padding-bottom: 0.3rem;
}

@keyframes pulse-amber {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
.urgent-pulse {
  color: #5ee91e;
  animation: pulse-amber 2s ease-in-out infinite;
  font-weight: 500;
}

@keyframes blink-red {
  0%, 49%, 100% { opacity: 1;    color: #FF4B4A; }
  50%, 90%      { opacity: 0.15; color: #FF4B4A; }
}
.urgent-blink {
  color: #FF4B4A;
  animation: blink-red 1.2s step-start infinite;
  font-weight: 500;
}

/* --- raffle section tabs ------------------------------------------------- */

.raffle-tabs-wrapper { margin-bottom: 1.5rem; }

.raffle-tab-bar {
  display: flex;
  gap: 2px;
}

.raffle-tab {
  padding: 0.45rem 1.1rem;
  background: var(--bg-3);         /* recessed vs. the panel */
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: var(--text-dim);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  bottom: -1px;                    /* overlaps the panel's top border by 1px */
  line-height: 1.4;
  transition: color 0.1s, background 0.1s;
}
.raffle-tab:hover { color: var(--text); background: var(--bg-2); }
.raffle-tab.active {
  background: var(--bg-2);        /* matches the panel */
  color: var(--primary-hilite);
  font-weight: 600;
  z-index: 1;
  border-bottom-color: var(--bg-2); /* "erases" the panel's top border underneath */
}

.raffle-tab-panel {
  margin-bottom: 0;               /* wrapper handles the gap */
  border-top-left-radius: 0;      /* the first tab sits in this corner */
}

/* --- guild performance table -------------------------------------------- */

.perf-table td:first-child {
  white-space: nowrap;
  font-weight: 500;
}
.perf-table td:not(:first-child),
.perf-table th:not(:first-child) {
  text-align: right;
  white-space: nowrap;
}
/* "This Week" column — 2nd column — gets the gold accent */
.perf-table th:nth-child(2) {
  color: var(--primary-hilite);
  border-left: 2px solid rgba(251, 188, 4, 0.25);
}
.perf-table td:nth-child(2) {
  color: var(--primary-hilite);
  font-weight: 500;
  border-left: 2px solid rgba(251, 188, 4, 0.25);
}
/* Older weeks are dimmed */
.perf-table td:nth-child(n+3) { color: var(--text-dim); }

/* --- footer -------------------------------------------------------------- */

.footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 0.6rem 1.2rem;
  display: flex; gap: 0.6rem; justify-content: center;
  font-size: 0.85rem;
}

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 720px) {
  .topnav { gap: 0.5rem; }
  .nav-links { gap: 0.6rem; font-size: 0.9rem; }
  .user-picker { min-width: 100%; margin-left: 0; }
}

/* --- tippy tooltips ------------------------------------------------------ */

.tippy-box[data-theme~='custom-dark'] {
  background-color: var(--primary-hilite-bg);
  color: var(--primary-hilite-lt);
  border: 1px solid var(--primary-hilite-dim);
  font-size: 0.8rem;
}
.tippy-box[data-theme~='custom-dark'] .tippy-arrow {
  color: var(--primary-hilite-dim);
}

/* --- user rank table separator ------------------------------------------- */

.table-sep {
  /*border-left: 2px solid rgba(251, 188, 4, 0.25);*/
  background-color: rgb(46, 46, 46);
}