/* WeChoice Rank 2025 - Sidebar Layout */
:root {
  --swiper-theme-color: #007aff;
  --f-spinner-width: 36px;
  --f-spinner-height: 36px;
  --f-spinner-color-1: rgba(0,0,0,0.1);
  --f-spinner-color-2: rgba(17,24,28,0.8);
  --f-spinner-stroke: 2.75;
  --primary-bg: #fdfaf7;
  --text-dark: #1a1a1a;
  --brand-red: #8b1e1e;
  --font-heading: "Inter", sans-serif;
  --font-body: "Inter", sans-serif;
  
  /* Custom colors */
  --gold: #FFD700;
  --silver: #C0C0C0;
  --bronze: #CD7F32;
  --card-bg: #ffffff;
  --border-color: #dedede;
  --row-hover: #f8f8f8;
  --positive: #16a34a;
  --negative: #dc2626;
  
  /* Sidebar */
  --sidebar-width: 280px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--primary-bg);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  color: #fff;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 16px;
}

.logo img {
  height: 32px;
  filter: brightness(0) invert(1);
}

.site-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--gold);
}

.stats-bar {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Main Layout with Sidebar */
.main-wrapper {
  display: flex;
  min-height: calc(100vh - 200px);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: 100px;
  height: calc(100vh - 100px);
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.sidebar-header h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
}

.category-list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 100px;
  background: #fff;
  color: var(--text-dark);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.3px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-item:hover {
  background-color: #f5f5f5;
  border-color: #ccc;
}

.category-item.active {
  background-color: #000;
  color: #fff;
  border-color: #000;
  font-weight: 500;
}

.category-item .count {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.6;
  padding-left: 8px;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 24px;
  min-width: 0;
}

.category-section {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.category-header {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.category-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.5px;
}

.category-meta {
  font-size: 13px;
  color: #666;
}

/* Table Styles */
.table-wrapper {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow: hidden;
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.rank-table thead {
  background: #f8f8f8;
  border-bottom: 2px solid #eee;
}

.rank-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
}

.rank-table th.text-right,
.rank-table td.text-right {
  text-align: right;
}

.rank-table th.text-center,
.rank-table td.text-center {
  text-align: center;
}

.rank-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s ease;
}

.rank-table tbody tr:hover {
  background: var(--row-hover);
}

.rank-table tbody tr:last-child {
  border-bottom: none;
}

.rank-table td {
  padding: 14px 16px;
  vertical-align: middle;
}

/* Rank Number */
.rank-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  background: #f0f0f0;
  color: #666;
}

.rank-1 .rank-number {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(255,215,0,0.4);
}

.rank-2 .rank-number {
  background: linear-gradient(135deg, #E8E8E8 0%, #C0C0C0 100%);
  color: #1a1a1a;
}

.rank-3 .rank-number {
  background: linear-gradient(135deg, #CD7F32 0%, #A0522D 100%);
  color: #fff;
}

/* Nominee Name */
.nominee-name {
  font-weight: 500;
  color: var(--text-dark);
}

.rank-1 .nominee-name,
.rank-2 .nominee-name,
.rank-3 .nominee-name {
  font-weight: 600;
}

/* Vote Count */
.vote-count {
  font-weight: 700;
  font-size: 16px;
  color: var(--brand-red);
  font-variant-numeric: tabular-nums;
}

/* Vote Change */
.vote-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.vote-change.positive {
  color: var(--positive);
}

.vote-change.negative {
  color: var(--negative);
}

.vote-change.neutral {
  color: #999;
}

/* Progress Bar in Table */
.progress-cell {
  width: 120px;
}

.progress-bar {
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-red) 0%, #c13d3d 100%);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Loading State */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #666;
}

.spinner {
  width: var(--f-spinner-width);
  height: var(--f-spinner-height);
  border: 3px solid var(--f-spinner-color-1);
  border-top-color: var(--f-spinner-color-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer */
.footer {
  background: #1a1a1a;
  color: #fff;
  padding: 24px 0;
  text-align: center;
}

.footer p {
  font-size: 13px;
  margin-bottom: 4px;
}

.footer-note {
  color: rgba(255,255,255,0.5);
  font-size: 11px !important;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #000;
  border: none;
  cursor: pointer;
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.mobile-menu-toggle span {
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Responsive */
@media (max-width: 900px) {
  .main-wrapper {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 150;
    border-right: none;
    border-top: 1px solid var(--border-color);
    max-height: 60vh;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  }
  
  .sidebar.open {
    transform: translateY(0);
  }
  
  .sidebar-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .category-list {
    padding: 8px 16px 24px;
    max-height: calc(60vh - 60px);
    overflow-y: auto;
  }
  
  .mobile-menu-toggle {
    display: flex;
  }
  
  .mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }
  
  .main-content {
    padding: 16px;
    padding-bottom: 80px;
  }
  
  .category-title {
    font-size: 20px;
  }
  
  .rank-table {
    font-size: 13px;
  }
  
  .rank-table th,
  .rank-table td {
    padding: 10px 12px;
  }
  
  .rank-number {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  
  .vote-count {
    font-size: 14px;
  }
  
  .progress-cell {
    display: none;
  }
  
  .hide-mobile {
    display: none;
  }
}

@media (max-width: 480px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .stats-bar {
    gap: 16px;
  }
  
  .stat-value {
    font-size: 16px;
  }
  
  .main-content {
    padding: 12px;
  }
  
  .rank-table th,
  .rank-table td {
    padding: 8px 10px;
  }
  
  .category-item {
    font-size: 12px;
    padding: 8px 12px;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* No Data State */
.no-votes {
  color: #999;
  font-style: italic;
}

/* Badge for no API */
.badge-no-api {
  display: inline-block;
  padding: 2px 8px;
  background: #fee2e2;
  color: #dc2626;
  font-size: 11px;
  border-radius: 4px;
  margin-left: 8px;
}

.category-item.no-api {
  opacity: 0.7;
}

/* Update info */
.update-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.update-info small {
  color: #888;
  font-size: 11px;
}

.refresh-btn {
  padding: 6px 12px;
  font-size: 12px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.refresh-btn:hover {
  background: #e0e0e0;
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #ddd;
}
