.friends-icon-wrapper {
  position: relative;
  display: inline-block;
  margin-right: 8px;
}

.friends-icon-wrapper-mobile {
  position: relative;
  display: inline-block;
  margin-right: 8px;
}

.friends-icon {
  font-size: 1.2rem;
  color: #6c757d;
  cursor: pointer;
  transition: color 0.3s ease;
}

.friends-icon:hover {
  color: #667eea;
}

.friends-icon.has-requests {
  color: #f39c12;
}

.friends-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
  display: none;
  animation: pulse 2s infinite;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

.friends-dropdown,
.friends-dropdown-mobile {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  width: 380px;
  max-height: 600px;
  display: none;
  z-index: 1001;
  border: 1px solid rgba(226, 232, 240, 0.8);
  overflow: hidden;
  animation: slideDown 0.3s ease;
}

.friends-dropdown.show,
.friends-dropdown-mobile.show {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.friends-dropdown-header {
  padding: 15px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.friends-dropdown-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.friends-dropdown-title i {
  font-size: 18px;
}

.friends-toolbar {
  padding: 12px 15px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  gap: 10px;
}

.friends-toolbar-btn {
  flex: 1;
  padding: 8px 12px;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  color: #495057;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: all;
}

.friends-toolbar-btn:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.friends-search-box {
  position: relative;
  padding: 15px;
  background: white;
  border-bottom: 1px solid #e9ecef;
  display: none;
}

.friends-search-box.show {
  display: block;
}

.friends-search-input {
  width: 100%;
  padding: 10px 40px 10px 15px;
  border: 2px solid #e9ecef;
  border-radius: 25px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.friends-search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.friends-search-icon {
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  color: #adb5bd;
  font-size: 16px;
  pointer-events: none;
}

.friends-search-results {
  position: absolute;
  top: calc(100% + 5px);
  left: 15px;
  right: 15px;
  max-height: 300px;
  overflow-y: auto;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
  display: none;
}

.friends-search-results.show {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease;
  position: relative;
}

.search-result-item:hover {
  background: #f8f9fa;
}

.search-result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 12px;
}

.search-result-info {
  flex: 1;
}

.search-result-name {
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 2px;
}

.search-result-uid {
  font-size: 12px;
  color: #6c757d;
}

.search-result-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.search-action-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  pointer-events: all;
}

.search-action-btn.add-friend {
  background: #28a745;
  color: white;
}

.search-action-btn.add-friend:hover {
  background: #218838;
}

.search-action-btn.blacklist {
  background: #6c757d;
  color: white;
}

.search-action-btn.blacklist:hover {
  background: #5a6268;
}

.friends-list-container {
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
}

.friends-list-container::-webkit-scrollbar {
  width: 6px;
}

.friends-list-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.friends-list-container::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

.friends-list-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.friends-group {
  margin-bottom: 15px;
}

.friends-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  pointer-events: all;
}

.friends-group-header:hover {
  background: #e9ecef;
}

.friends-group-title {
  font-size: 13px;
  font-weight: 600;
  color: #495057;
  display: flex;
  align-items: center;
  gap: 8px;
}

.friends-group-count {
  background: #6c757d;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
}

.friends-group-arrow {
  color: #6c757d;
  transition: transform 0.3s ease;
}

.friends-group.collapsed .friends-group-arrow {
  transform: rotate(-90deg);
}

.friends-group-content {
  padding: 8px 4px;
  display: block;
}

.friends-group.collapsed .friends-group-content {
  display: none;
}

.friend-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  margin-bottom: 8px;
  background: white;
  border: 1px solid transparent;
  pointer-events: all;
}

.friend-item:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  border-color: rgba(102, 126, 234, 0.2);
  transform: translateX(4px);
}

.friend-user-info {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  min-height: 45px;
  padding: 5px;
}

.friend-user-info::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: var(--user-rank-bg);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.8;
  border-radius: 6px;
  z-index: 0;
}

.friend-avatar-container {
  position: relative;
  width: 40px;
  height: 40px;
  margin-right: 12px;
  z-index: 2;
}

.friend-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.9);
  position: relative;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.friend-avatar-rainbow {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    #ff0080,
    #ff0040,
    #ff4000,
    #ff8000,
    #ffbf00,
    #ffff00,
    #bfff00,
    #80ff00,
    #40ff00,
    #00ff00,
    #00ff40,
    #00ff80,
    #00ffbf,
    #00ffff,
    #00bfff,
    #0080ff,
    #0040ff,
    #0000ff,
    #4000ff,
    #8000ff,
    #bf00ff,
    #ff00ff,
    #ff00bf,
    #ff0080
  );
  animation: friend-rainbow-rotate 4s linear infinite;
  z-index: 1;
  filter: brightness(1.3) saturate(1.4);
  box-shadow: 
    0 0 10px rgba(255, 0, 128, 0.5),
    0 0 20px rgba(255, 0, 128, 0.3),
    0 0 30px rgba(255, 0, 128, 0.2);
}

.friend-avatar-rainbow::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background: inherit;
  filter: blur(6px);
  opacity: 0.6;
  z-index: -1;
  animation: friend-rainbow-pulse 2s ease-in-out infinite;
}

@keyframes friend-rainbow-rotate {
  0% { 
    transform: rotate(0deg);
    filter: brightness(1.3) saturate(1.4) hue-rotate(0deg);
  }
  50% {
    filter: brightness(1.4) saturate(1.5) hue-rotate(180deg);
  }
  100% { 
    transform: rotate(360deg);
    filter: brightness(1.3) saturate(1.4) hue-rotate(360deg);
  }
}

@keyframes friend-rainbow-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

.friend-info {
  flex: 1;
  position: relative;
  z-index: 2;
}

.friend-name {
  font-size: 14px;
  font-weight: 600;
  color: white;
  margin-bottom: 2px;
  text-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.7),
    0 2px 4px rgba(0, 0, 0, 0.4);
}

.friend-status {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  top: 3px;
  text-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 2px 3px rgba(0, 0, 0, 0.3);
}

.friend-state-icon {
  position: absolute;
  bottom: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  z-index: 3;
}

.friend-rank-icon {
  position: absolute;
  right: 5px;
  top: 35%;
  transform: translateY(-50%);
  width: 35px;
  height: 35px;
  object-fit: contain;
  z-index: 1;
}

.request-item {
  padding: 12px;
  background: linear-gradient(135deg, #fff3cd 0%, #ffecd2 100%);
  border-left: 3px solid #f39c12;
  border-radius: 8px;
  margin-bottom: 10px;
}

.request-info {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.request-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 12px;
}

.request-details {
  flex: 1;
}

.request-name {
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 4px;
}

.request-time {
  font-size: 12px;
  color: #6c757d;
}

.request-message {
  padding: 8px;
  background: white;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #495057;
  font-style: italic;
}

.request-actions {
  display: flex;
  gap: 10px;
}

.request-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: all;
}

.request-btn.accept {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
}

.request-btn.accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.request-btn.reject {
  background: #e9ecef;
  color: #6c757d;
}

.request-btn.reject:hover {
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.blacklist-item {
  background: #f8f9fa;
  opacity: 0.8;
}

.blacklist-item:hover {
  opacity: 1;
}

.blacklist-actions {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  z-index: 3;
}

.unblock-btn {
  padding: 6px 12px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: all;
}

.unblock-btn:hover {
  background: #c82333;
  transform: scale(1.05);
}

.friends-empty {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
}

.friends-empty i {
  font-size: 48px;
  color: #dee2e6;
  margin-bottom: 15px;
}

.friends-empty p {
  font-size: 14px;
  margin: 0;
}

.friends-loading {
  text-align: center;
  padding: 40px 20px;
}

.friends-loading i {
  font-size: 32px;
  color: #667eea;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .friends-icon-wrapper-mobile {
    position: relative;
    display: inline-block;
    margin-right: 8px;
  }

  .friends-dropdown-mobile {
    position: fixed !important;
    top: 60px;
    right: 10px;
    left: auto !important;
    width: calc(100vw - 20px);
    max-width: 360px;
    transform: none !important;
    z-index: 9999;
  }

  .friends-dropdown-mobile.show {
    display: block;
    animation: slideDown 0.3s ease;
  }

  .friend-item {
    padding: 8px;
  }
  
  .friend-avatar-container {
    width: 35px;
    height: 35px;
  }

  .friend-avatar-rainbow {
    top: -2px;
    left: -2px;
    width: 39px;
    height: 39px;
  }

  .friend-avatar-rainbow::before {
    top: -1.5px;
    left: -1.5px;
    right: -1.5px;
    bottom: -1.5px;
    filter: blur(4px);
  }

  .friend-avatar {
    border-width: 1.5px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  }

  .friend-state-icon {
    width: 16px;
    height: 16px;
    bottom: 1px;
    left: 1px;
  }

  .online-indicator {
    width: 8px;
    height: 8px;
    border-width: 1.5px;
    bottom: 1px;
    right: 1px;
  }
  
  
  .friend-name {
    font-size: 13px;
    text-shadow: 
      0 1px 3px rgba(0, 0, 0, 0.7),
      0 2px 4px rgba(0, 0, 0, 0.4);
  }
  
  .friend-status {
    font-size: 11px;
    text-shadow: 
      0 1px 2px rgba(0, 0, 0, 0.6),
      0 2px 3px rgba(0, 0, 0, 0.3);
  }
  
  .friend-rank-icon {
    width: 30px;
    height: 30px;
  }
  
  .search-action-btn {
    padding: 4px 8px;
    font-size: 11px;
  }

  .friends-list-container {
    max-height: calc(100vh - 200px);
  }

  .friends-search-results {
    position: fixed;
    top: 150px;
    left: 10px;
    right: 10px;
    max-width: calc(100vw - 20px);
  }

  .request-item {
    padding: 10px;
  }
  
  .request-avatar {
    width: 40px;
    height: 40px;
  }
}

@media (min-width: 769px) {
  .friends-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
  }
}

.privacy-settings-card {
  margin-top: 20px;
}

.privacy-option {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
}

.privacy-option-title {
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.privacy-option-title i {
  color: #667eea;
}

.privacy-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.privacy-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.privacy-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.privacy-checkbox label {
  font-size: 14px;
  color: #495057;
  cursor: pointer;
  margin: 0;
}

.privacy-radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.privacy-radio {
  display: flex;
  align-items: center;
  gap: 8px;
}

.privacy-radio input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.privacy-radio label {
  font-size: 14px;
  color: #495057;
  cursor: pointer;
  margin: 0;
}

.privacy-save-btn {
  margin-top: 20px;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.privacy-save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.friends-dropdown button,
.friends-dropdown-mobile button,
.friends-dropdown input,
.friends-dropdown-mobile input {
  pointer-events: all !important;
}

.friends-dropdown *,
.friends-dropdown-mobile * {
  pointer-events: auto;
}

.friend-actions-menu {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  overflow: hidden;
}

.friend-action-btn {
  display: block;
  width: 100%;
  padding: 8px 16px;
  background: white;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.3s ease;
  font-size: 13px;
  color: #495057;
  white-space: nowrap;
}

.friend-action-btn:hover {
  background: #f8f9fa;
}

.friend-action-btn i {
  margin-right: 8px;
  width: 16px;
  text-align: center;
}

.friend-action-btn.delete-btn:hover {
  background: #fff5f5;
  color: #dc3545;
}

.privacy-option {
  margin-bottom: 25px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #e9ecef;
}

.privacy-option-title {
  font-size: 15px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.privacy-option-title i {
  color: #667eea;
  font-size: 18px;
}

.privacy-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.privacy-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.privacy-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #667eea;
}

.privacy-checkbox label {
  font-size: 14px;
  color: #495057;
  cursor: pointer;
  margin: 0;
  user-select: none;
}

.privacy-radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.privacy-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: white;
  border-radius: 8px;
  transition: background 0.3s ease;
}

.privacy-radio:hover {
  background: #f1f3f5;
}

.privacy-radio input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #667eea;
}

.privacy-radio label {
  font-size: 14px;
  color: #495057;
  cursor: pointer;
  margin: 0;
  user-select: none;
  flex: 1;
}

#save-privacy-btn {
  margin-top: 25px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

#save-privacy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

#save-privacy-btn:active {
  transform: translateY(0);
}

.online-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid white;
  z-index: 4;
}

.online-indicator.online {
  background: #4caf50;
  animation: pulse-green 2s infinite;
}

.online-indicator.offline {
  background: #9e9e9e;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
  50% { box-shadow: 0 0 0 4px rgba(76, 175, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

.friend-item.online .online-status {
  color: #4caf50;
  font-weight: 600;
}

.friend-item.offline .online-status {
  color: #9e9e9e;
}

.friends-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.friends-toolbar {
    display: flex;
    padding: 8px;
    gap: 4px;
    border-bottom: 1px solid #e4e6eb;
}

.friends-toolbar-btn {
    flex: 1;
    padding: 8px 12px;
    background: #f0f2f5;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.friends-toolbar-btn.active {
    background: #667eea;
    color: white;
}

.friends-toolbar-btn:hover:not(.active) {
    background: #e4e6eb;
}

.friends-messages-notification {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}