/* Rank investors page */

.rank-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.rank-hero {
  margin-bottom: 2rem;
}

.rank-hero-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.rank-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(50, 205, 50, 0.5);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  font-size: 1.25rem;
}

.rank-hero-title {
  color: var(--text-primary);
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.rank-hero-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 400;
  margin: 0 0 1.25rem 0;
  line-height: 1.5;
}

.rank-hero-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.rank-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem 0.35rem;
  border-radius: 9999px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  font-size: 0.55rem;
  font-weight: 500;
  color: var(--text-primary);
}

.rank-source-pill.primary {
  color: var(--primary-color);
}

.rank-source-pill i {
  color: var(--primary-color);
  font-size: 0.5rem;
}

.rank-card {
  background: rgba(26, 26, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.rank-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.rank-controls-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 1.75rem;
  align-items: flex-end;
}

.rank-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.rank-controls input {
  background: rgba(15, 15, 15, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  font-size: 0.875rem;
  min-width: 160px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.rank-controls input:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(20, 20, 20, 0.95);
}

.rank-controls input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(18, 18, 18, 0.98);
}

.metric-dropdown {
  position: relative;
  min-width: 200px;
}

.metric-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  background: rgba(15, 15, 15, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.metric-dropdown-trigger:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(20, 20, 20, 0.95);
}

.metric-dropdown.open .metric-dropdown-trigger {
  border-color: var(--primary-color);
  background: rgba(18, 18, 18, 0.98);
  box-shadow: 0 0 0 1px var(--primary-color);
}

.metric-dropdown-trigger i {
  font-size: 0.65rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.metric-dropdown.open .metric-dropdown-trigger i {
  transform: rotate(180deg);
}

.metric-dropdown-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(26, 26, 26, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  padding: 0.35rem 0;
  max-height: 320px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.metric-dropdown.open .metric-dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.metric-dropdown-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.metric-dropdown-option:hover {
  background: rgba(255, 255, 255, 0.06);
}

.metric-dropdown-option.selected {
  background: rgba(50, 205, 50, 0.1);
  color: var(--primary-color);
}

.metric-dropdown-option.selected:hover {
  background: rgba(50, 205, 50, 0.14);
}

.metric-dropdown-option .check {
  width: 1rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--primary-color);
}

.metric-dropdown-option:not(.selected) .check {
  visibility: hidden;
}

.metric-dropdown-panel::-webkit-scrollbar {
  width: 6px;
}

.metric-dropdown-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
}

.metric-dropdown-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.metric-dropdown-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.rank-controls input[type="number"] {
  min-width: 64px;
  width: 64px;
  text-align: center;
}

.rank-controls > .btn-primary-action {
  flex-shrink: 0;
}

.rank-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.rank-block h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.rank-block.top h3 {
  color: #32cd32;
}

.rank-block.flop h3 {
  color: #ef4444;
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.rank-table th,
.rank-table td {
  padding: 0.5rem 0.6rem;
  text-align: right;
  border-bottom: 1px solid var(--border-color);
}

.rank-table th {
  color: var(--text-muted);
  font-weight: 500;
}

.rank-table td.num-trades,
.rank-table th:first-child,
.rank-table td:first-child {
  text-align: center;
}

.rank-table .investor-name {
  text-align: left;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 180px;
}

.rank-table .pct-good {
  color: #32cd32;
}

.rank-table .pct-bad {
  color: #ef4444;
}

.rank-table .pct-inverse-good {
  color: #32cd32;
}

.rank-table .pct-inverse-bad {
  color: #ef4444;
}

.rank-loading,
.rank-error {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.rank-loading.rank-result-summary {
  padding: 1rem 0 0;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.45);
}

.rank-error {
  color: #ef4444;
}

@keyframes rank-skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.rank-skeleton-table {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(15, 15, 15, 0.45);
  padding: 0.5rem 1rem 0.75rem;
  margin-top: 0.5rem;
}

.rank-skeleton-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.rank-skeleton-row:last-child {
  border-bottom: none;
}

.rank-skeleton-cell {
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.11) 45%,
    rgba(255, 255, 255, 0.05) 90%
  );
  background-size: 200% 100%;
  animation: rank-skeleton-shimmer 1.15s ease-in-out infinite;
}

.rank-skeleton-cell--narrow {
  flex: 0 0 2rem;
}

.rank-skeleton-cell--medium {
  flex: 0 0 22%;
}

.rank-skeleton-cell--wide {
  flex: 1;
  min-width: 40%;
}

@media (max-width: 900px) {
  .rank-tables {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .rank-page {
    padding: 1rem;
  }

  .rank-card {
    padding: 1.25rem;
  }

  .rank-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .rank-controls-fields {
    gap: 1rem;
  }

  .metric-dropdown,
  .rank-controls input {
    width: 100%;
    min-width: 0;
  }
}
