.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
header {
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.back-link:hover {
  color: var(--primary);
  background-color: var(--background);
}

/* Main Content */
.friends-container {
  padding: 3rem 0;
  min-height: calc(100vh - 80px);
}

/* Page Header */
.page-header {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInDown 0.8s ease-out;
}

.page-title {
  font-size: clamp(2.5rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--info) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.stats-summary {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-content {
  text-align: left;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Search Section */
.search-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.search-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--info) 0%, #3182CE 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.search-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.search-container {
  position: relative;
  margin-bottom: 1rem;
}

.search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  border: 2px solid rgba(0,0,0,0.1);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--background);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.search-input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 1.1rem;
}

.search-results {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Recent Users Grid */
.recent-users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.recent-user-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  transition: var(--transition);
  border: 1px solid rgba(0,0,0,0.05);
}

.recent-user-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}

.recent-user-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 0.5rem;
  border: 2px solid var(--primary-light);
}

.recent-user-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-user-username {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.recent-user-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.recent-user-actions .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.recent-user-status {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 0.5rem;
}

.recent-user-status.online {
  color: var(--success);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  align-items: center;
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.filter-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.filter-tag {
  padding: 0.5rem 1rem;
  border-radius: 50px;
  border: 2px solid var(--primary-light);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  font-size: 0.9rem;
}

.filter-tag:hover,
.filter-tag.active {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Section Layout */
.friends-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.8s ease-out;
}

.friends-section:nth-child(4) { animation-delay: 0.1s; }
.friends-section:nth-child(5) { animation-delay: 0.2s; }
.friends-section:nth-child(6) { animation-delay: 0.3s; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--background);
}

.section-title-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-count {
  background: var(--primary-light);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.view-toggle {
  display: flex;
  background: var(--background);
  border-radius: var(--radius-md);
  padding: 0.25rem;
}

.view-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.view-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Friend Cards */
.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.friends-grid.list-view {
  grid-template-columns: 1fr;
}

.friend-card {
  background: var(--background);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 2px solid transparent;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.friend-card:hover {
  border-color: var(--primary-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.friend-card.list-view {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
}

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

.friend-card.list-view .friend-header {
  margin-bottom: 0;
  flex: 1;
}

.friend-avatar-container {
  position: relative;
}

.friend-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-light);
  transition: var(--transition);
}

.friend-avatar:hover {
  transform: scale(1.05);
  border-color: var(--primary);
}

.avatar-placeholder {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  font-size: 1.2rem;
  border: 3px solid var(--primary-light);
}

.online-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid white;
  background: var(--online);
}

.online-indicator.offline {
  background: var(--offline);
}

.friend-info {
  flex: 1;
}

.friend-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  font-size: 1.1rem;
}

.friend-username {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.friend-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.friend-card.list-view .friend-badges {
  margin-bottom: 0;
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge.top-host {
  background: rgba(255, 215, 0, 0.2);
  color: #B7791F;
}

.badge.frequent-player {
  background: rgba(72, 187, 120, 0.2);
  color: var(--success);
}

.badge.new-friend {
  background: rgba(66, 153, 225, 0.2);
  color: var(--info);
}

.badge.cooking-master {
  background: rgba(255, 107, 53, 0.2);
  color: var(--primary);
}

.friend-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.friend-card.list-view .friend-stats {
  margin-bottom: 0;
  margin-right: 1rem;
}

.stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-weight: 600;
  color: var(--primary);
  font-size: 1rem;
}

.friend-actions {
  display: flex;
  gap: 0.75rem;
}

.friend-card.list-view .friend-actions {
  margin-left: auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
  font-size: 0.85rem;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 4px rgba(255, 107, 53, 0.25);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(255, 107, 53, 0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid rgba(0,0,0,0.2);
}

.btn-secondary:hover {
  background: var(--background);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #38A169;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  background: #e53e3e;
}

.btn-icon-only {
  padding: 0.5rem;
  min-width: auto;
}

/* Pending Requests */
.request-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--background);
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  transition: var(--transition);
  margin-bottom: 1rem;
}

.request-item:hover {
  border-color: var(--primary-light);
  background: var(--surface);
}

.request-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
}

.request-info {
  flex: 1;
}

.request-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.request-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.request-actions {
  display: flex;
  gap: 0.5rem;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  color: var(--text-tertiary);
}

.empty-state h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.empty-state p {
  max-width: 400px;
  margin: 0 auto 2rem;
}

/* Mutual Friends */
.mutual-friends {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.mutual-avatars {
  display: flex;
  margin-right: 0.5rem;
}

.mutual-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid white;
  margin-left: -8px;
}

.mutual-avatar:first-child {
  margin-left: 0;
}

.mutual-text {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* Toast Notification */
.toast {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--success);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transform: translateX(100%);
  transition: var(--transition);
  max-width: 300px;
}

.toast.show {
  display: block;
  transform: translateX(0);
}

.toast.error {
  background: var(--error);
}

/* Animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .friends-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .recent-users-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

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

  /* === PAGE HEADER: compact === */
  .friends-container {
    padding: 1.5rem 0;
  }

  .page-header {
    margin-bottom: 1.5rem;
  }

  .page-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
  }

  .page-subtitle {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }

  /* Stats inline as pills */
  .stats-summary {
    flex-direction: row;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
  }

  .stat-item {
    padding: 0.5rem 0.85rem;
    gap: 0.5rem;
    border-radius: 50px;
  }

  .stat-icon {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .stat-number {
    font-size: 1rem;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .stat-content {
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  /* === SEARCH: compact === */
  .search-section {
    padding: 1rem;
    margin-bottom: 1.25rem;
  }

  .search-header {
    margin-bottom: 0.75rem;
  }

  .search-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .search-title {
    font-size: 1.1rem;
  }

  .search-input {
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    font-size: 0.9rem;
  }

  /* === FILTER BAR: horizontal scroll === */
  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
  }

  .filter-bar::-webkit-scrollbar {
    display: none;
  }

  .filter-label {
    display: none;
  }

  .filter-tag {
    flex-shrink: 0;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
  }

  /* === SECTIONS: compact === */
  .friends-section {
    padding: 1rem;
    margin-bottom: 1.25rem;
  }

  .section-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  .section-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .section-title {
    font-size: 1.15rem;
  }

  .section-count {
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
  }

  /* Hide view toggle on mobile */
  .view-toggle {
    display: none;
  }

  /* === FRIENDS GRID: 1 col === */
  .friends-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .friend-card {
    padding: 1rem;
  }

  .friend-avatar {
    width: 48px;
    height: 48px;
  }

  .avatar-placeholder {
    width: 48px;
    height: 48px;
    font-size: 1rem;
  }

  .friend-name {
    font-size: 1rem;
  }

  .friend-stats {
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
  }

  /* Buttons side by side */
  .friend-actions {
    gap: 0.5rem;
  }

  .friend-actions .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  /* === REQUEST ITEMS: keep inline === */
  .request-item {
    flex-direction: row;
    text-align: left;
    padding: 0.75rem;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .request-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .request-name {
    font-size: 0.9rem;
  }

  .request-meta {
    font-size: 0.75rem;
  }

  .request-actions {
    flex-shrink: 0;
  }

  .request-actions .btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    min-height: 36px;
    min-width: 36px;
  }

  /* === LIST VIEW: stack on mobile === */
  .friend-card.list-view {
    flex-direction: column;
    text-align: center;
  }

  .friend-card.list-view .friend-header {
    flex-direction: column;
  }

  .friend-card.list-view .friend-stats {
    margin-right: 0;
    margin-bottom: 0.75rem;
  }

  .friend-card.list-view .friend-actions {
    margin-left: 0;
    justify-content: center;
  }

  /* === RECENT USERS: 2 cols === */
  .recent-users-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .recent-user-card {
    padding: 0.75rem;
  }

  .recent-user-avatar {
    width: 48px;
    height: 48px;
  }

  .recent-user-name {
    font-size: 0.85rem;
  }

  /* === TOAST: full width === */
  .toast {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
    transform: translateY(-120%);
  }

  .toast.show {
    display: block;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .friends-container {
    padding: 1rem 0;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .page-subtitle {
    font-size: 0.85rem;
  }

  .stats-summary {
    gap: 0.4rem;
  }

  .stat-item {
    padding: 0.4rem 0.65rem;
  }

  .stat-number {
    font-size: 0.9rem;
  }

  .stat-label {
    font-size: 0.65rem;
  }

  .search-section {
    padding: 0.75rem;
  }

  .search-header {
    display: none;
  }

  .friends-section {
    padding: 0.75rem;
    margin-bottom: 1rem;
  }

  .section-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
  }

  .section-title-wrapper {
    gap: 0.5rem;
  }

  .section-icon {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }

  .section-title {
    font-size: 1rem;
  }

  .friend-card {
    padding: 0.75rem;
  }

  .friend-header {
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .friend-avatar {
    width: 42px;
    height: 42px;
  }

  .avatar-placeholder {
    width: 42px;
    height: 42px;
    font-size: 0.9rem;
  }

  .friend-name {
    font-size: 0.95rem;
  }

  .friend-username {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
  }

  .friend-badges {
    margin-bottom: 0.5rem;
  }

  .recent-users-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .recent-user-avatar {
    width: 40px;
    height: 40px;
  }

  .recent-user-name {
    font-size: 0.8rem;
  }

  .recent-user-username {
    font-size: 0.7rem;
  }

  .empty-state {
    padding: 2rem 1rem;
  }

  .empty-state-icon {
    font-size: 2.5rem;
  }

  .empty-state h3 {
    font-size: 1.1rem;
  }
}
/* Loading states */
.loading-state {
  opacity: 0.8;
  pointer-events: none;
}

.loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  text-align: center;
  color: var(--text-tertiary);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--background);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Empty states */
.friends-grid:empty::after,
.pending-requests:empty::after,
.recent-users-grid:empty::after {
  content: "Loading...";
  display: block;
  text-align: center;
  color: var(--text-tertiary);
  padding: 2rem;
  font-style: italic;
}



/* Clickable cards (Search + Recently Active Users) */
.request-item.clickable,
.recent-user-card.clickable {
  cursor: pointer;
}

.request-item.clickable:hover,
.recent-user-card.clickable:hover {
  background: rgba(0,0,0,0.02);
}

.request-item.clickable:active,
.recent-user-card.clickable:active {
  background: rgba(0,0,0,0.04);
}

/* Mobile-friendly tap targets */
.request-actions .btn,
.recent-user-actions .btn {
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
}

/* Keep actions above the clickable card area */
.request-actions,
.recent-user-actions {
  position: relative;
  z-index: 2;
}
