/* ── LoL Stats Plugin ── */

.lol-container {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px;
  height: 100%;
  overflow-y: auto;
}

/* ── Search ── */
.lol-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.lol-search-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-normal);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.lol-search-input:focus { border-color: var(--accent); }
.lol-search-input::placeholder { color: var(--text-faint); }

.lol-search-region {
  padding: 10px 12px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-normal);
  font-size: 14px;
  cursor: pointer;
  outline: none;
}

.lol-search-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.lol-search-btn:hover { opacity: 0.85; }
.lol-search-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Recent Searches ── */
.lol-recent {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.lol-recent-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 16px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.lol-recent-chip:hover { border-color: var(--accent); color: var(--text-normal); }
.lol-recent-chip img {
  width: 18px; height: 18px; border-radius: 50%;
}
.lol-recent-tier {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.7;
  text-transform: uppercase;
}

/* ── Profile Header ── */
.lol-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  background: var(--bg-secondary);
  margin-bottom: 12px;
}
.lol-profile-icon {
  width: 72px; height: 72px;
  border-radius: 12px;
  border: 2px solid var(--bg-tertiary);
  object-fit: cover;
}
.lol-profile-info h2 {
  margin: 0 0 2px;
  font-size: 20px;
  color: var(--text-normal);
}
.lol-profile-info h2 span {
  color: var(--text-faint);
  font-weight: 400;
  font-size: 14px;
}
.lol-profile-level {
  font-size: 12px;
  color: var(--text-muted);
}
.lol-profile-ladder {
  font-size: 11px;
  color: var(--text-faint);
}
.lol-profile-updated {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 2px;
}
.lol-profile-info {
  flex: 1;
  min-width: 0;
}

/* ── Update Button ── */
.lol-update-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.lol-update-btn:hover { border-color: var(--accent); color: var(--text-normal); }
.lol-update-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.lol-update-btn.renewing { border-color: var(--accent); color: var(--accent); }
.lol-update-icon {
  font-size: 16px;
  display: inline-block;
}
.lol-update-btn.renewing .lol-update-icon {
  animation: lol-spin 1s linear infinite;
}

/* ── Ranked Cards ── */
.lol-ranked-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.lol-ranked-card {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border-left: 4px solid var(--bg-tertiary);
}
.lol-ranked-card.has-rank { border-left-color: var(--tier-color, var(--accent)); }
.lol-ranked-type {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.lol-ranked-tier {
  font-size: 18px;
  font-weight: 700;
  color: var(--tier-color, var(--text-normal));
}
.lol-ranked-lp {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 4px;
  font-weight: 400;
}
.lol-ranked-record {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.lol-ranked-wr {
  color: var(--text-faint);
  margin-left: 4px;
}
.lol-ranked-streak {
  color: #e74c3c;
  font-size: 11px;
  margin-left: 4px;
}

/* ── Section Headers ── */
.lol-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 8px;
  padding-left: 2px;
}

/* ── Most Champions ── */
.lol-champs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.lol-champ-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-secondary);
  min-width: 180px;
  flex-shrink: 0;
}
.lol-champ-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.lol-champ-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-normal);
}
.lol-champ-stats {
  font-size: 11px;
  color: var(--text-muted);
}
.lol-champ-kda {
  font-size: 11px;
  color: var(--text-faint);
}

/* ── Match History ── */
.lol-matches {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lol-match {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border-left: 4px solid var(--bg-tertiary);
  cursor: pointer;
  transition: background 0.15s;
}
.lol-match:hover { background: var(--bg-tertiary); }
.lol-match.win { border-left-color: #2ecc71; }
.lol-match.loss { border-left-color: #e74c3c; }

.lol-match-result {
  width: 28px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  flex-shrink: 0;
}
.lol-match.win .lol-match-result { color: #2ecc71; }
.lol-match.loss .lol-match-result { color: #e74c3c; }

.lol-match-champ {
  position: relative;
  flex-shrink: 0;
}
.lol-match-champ img {
  width: 40px; height: 40px; border-radius: 50%;
  display: block;
}
.lol-match-champ-level {
  position: absolute;
  bottom: -2px; right: -2px;
  background: var(--bg-deep);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.lol-match-kda {
  min-width: 80px;
  text-align: center;
  flex-shrink: 0;
}
.lol-match-kda-nums {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-normal);
}
.lol-match-kda-ratio {
  font-size: 11px;
  color: var(--text-faint);
}
.lol-match-kda-ratio.perfect { color: #f39c12; }
.lol-match-kda-ratio.great { color: #2ecc71; }

.lol-match-stats {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 70px;
  flex-shrink: 0;
}
.lol-match-stats span {
  font-size: 11px;
  color: var(--text-muted);
}

.lol-match-items {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.lol-match-items img {
  width: 24px; height: 24px;
  border-radius: 4px;
  background: var(--bg-deep);
}
.lol-match-item-empty {
  width: 24px; height: 24px;
  border-radius: 4px;
  background: var(--bg-deep);
}

.lol-match-meta {
  margin-left: auto;
  text-align: right;
  flex-shrink: 0;
}
.lol-match-duration {
  font-size: 12px;
  color: var(--text-muted);
}
.lol-match-queue {
  font-size: 10px;
  color: var(--text-faint);
}
.lol-match-ago {
  font-size: 10px;
  color: var(--text-faint);
}

/* ── Match Detail (expanded) ── */
.lol-match-detail {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 8px;
  margin-top: 4px;
  margin-bottom: 4px;
}
.lol-match-detail-team {
  margin-bottom: 6px;
}
.lol-match-detail-team-header {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}
.lol-match-detail-team-header.win { background: rgba(46,204,113,0.15); color: #2ecc71; }
.lol-match-detail-team-header.loss { background: rgba(231,76,60,0.15); color: #e74c3c; }

.lol-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.lol-detail-row:hover { background: var(--bg-secondary); }
.lol-detail-row.me { background: rgba(255,255,255,0.04); font-weight: 600; }

.lol-detail-champ {
  width: 24px; height: 24px; border-radius: 50%;
}
.lol-detail-name {
  width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-normal);
}
.lol-detail-kda { width: 70px; text-align: center; }
.lol-detail-cs { width: 45px; text-align: center; }
.lol-detail-dmg { width: 55px; text-align: center; }
.lol-detail-gold { width: 55px; text-align: center; }
.lol-detail-items {
  display: flex; gap: 1px;
}
.lol-detail-items img {
  width: 20px; height: 20px; border-radius: 3px;
}

/* ── Loading / Error / Empty ── */
.lol-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

.lol-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: lol-spin 0.8s linear infinite;
}
@keyframes lol-spin { to { transform: rotate(360deg); } }

.lol-error {
  padding: 16px;
  border-radius: 8px;
  background: rgba(231,76,60,0.1);
  color: #e74c3c;
  font-size: 13px;
  text-align: center;
  margin-bottom: 12px;
}

.lol-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}
.lol-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.lol-empty h3 {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 16px;
}
.lol-empty p {
  margin: 0;
  font-size: 13px;
}

/* ── Load more ── */
.lol-load-more {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.lol-load-more:hover { border-color: var(--accent); color: var(--text-normal); }

/* ══════════════════════════════════════════════
   Champion Tier List
   ══════════════════════════════════════════════ */

.lol-tier-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-tertiary);
}

.lol-tier-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.lol-tier-modes {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.lol-tier-mode-btn {
  padding: 6px 14px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 16px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.lol-tier-mode-btn:hover { border-color: var(--accent); color: var(--text-normal); }
.lol-tier-mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.lol-tier-filter {
  padding: 6px 12px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-normal);
  font-size: 12px;
  outline: none;
  width: 140px;
  margin-left: auto;
}
.lol-tier-filter:focus { border-color: var(--accent); }
.lol-tier-filter::placeholder { color: var(--text-faint); }

/* Tier Table */
.lol-tier-table {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lol-tier-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lol-tier-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-secondary);
  font-size: 13px;
  color: var(--text-muted);
  transition: background 0.15s;
}
.lol-tier-row:hover { background: var(--bg-tertiary); }

/* Tier row accent borders */
.lol-tier-row.tier-0 { border-left: 3px solid #f4c874; }
.lol-tier-row.tier-1 { border-left: 3px solid #d4a017; }
.lol-tier-row.tier-2 { border-left: 3px solid #576cce; }
.lol-tier-row.tier-3 { border-left: 3px solid #28b29e; }
.lol-tier-row.tier-4 { border-left: 3px solid var(--bg-tertiary); }
.lol-tier-row.tier-5 { border-left: 3px solid var(--bg-tertiary); opacity: 0.7; }

/* Column widths */
.lol-tier-col-rank { width: 32px; text-align: center; font-weight: 600; flex-shrink: 0; }
.lol-tier-col-champ {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 500;
  color: var(--text-normal);
}
.lol-tier-col-champ img {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lol-tier-col-tier { width: 36px; text-align: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.lol-tier-col-wr { width: 60px; text-align: center; flex-shrink: 0; }
.lol-tier-col-pr { width: 60px; text-align: center; flex-shrink: 0; }
.lol-tier-col-br { width: 60px; text-align: center; flex-shrink: 0; }
.lol-tier-col-kda { width: 50px; text-align: center; flex-shrink: 0; }

/* Tier badge colors */
.tier-badge-0 { color: #f4c874; }
.tier-badge-1 { color: #d4a017; }
.tier-badge-2 { color: #576cce; }
.tier-badge-3 { color: #28b29e; }
.tier-badge-4 { color: var(--text-faint); }
.tier-badge-5 { color: var(--text-faint); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .lol-search { flex-wrap: wrap; }
  .lol-search-input { width: 100%; }
  .lol-match { flex-wrap: wrap; gap: 6px; }
  .lol-match-meta { margin-left: 0; text-align: left; }
  .lol-match-items { flex-wrap: wrap; }
  .lol-profile { flex-wrap: wrap; }
  .lol-tier-controls { flex-direction: column; align-items: stretch; }
  .lol-tier-filter { width: 100%; margin-left: 0; }
  .lol-tier-col-br { display: none; }
  .lol-tier-col-kda { display: none; }
}
