/**
 * Styles pour les pages sociales (Friends + Profile)
 * Mobile-first design - Cohérence avec le style général de Synap'Kids
 * Palette: fond noir, bleus/roses pastel
 */

/* ========================================
   GÉNÉRAL - Espacement pour bottom nav
   ======================================== */

[data-route="/friends"],
[data-route="/profile"] {
  padding-bottom: 80px; /* Espace pour la bottom nav */
}

/* Header de page (cohérent avec le reste du site) */
[data-route="/friends"] .page-header,
[data-route="/profile"] .page-header {
  margin-bottom: 24px;
}

/* ========================================
   PAGE AMIS - Onglets
   ======================================== */

/* Les styles de navigation sont maintenant gérés par .page-tabs-container et .page-tab dans style.css */

/* ========================================
   PAGE AMIS - Contenu
   ======================================== */

.friends-content {
  padding: 0 16px;
}

.tab-content {
  min-height: 200px;
}

.friends-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.friend-item {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 8px;
  border-radius: 12px;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.friend-item:hover {
  background: rgba(138, 182, 255, 0.08);
  border-color: rgba(138, 182, 255, 0.2);
  transform: translateX(4px);
}

.friend-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: linear-gradient(135deg, #8ab6ff 0%, #ffc2d6 100%);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.friend-avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.friend-avatar__initials {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.friend-info {
  flex: 1;
  min-width: 0;
}

.friend-name {
  font-weight: 600;
  margin-bottom: 4px;
  color: #ffffff;
}

.friend-stats {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  gap: 8px;
}

.friend-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.friend-actions .btn {
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(138, 182, 255, 0.3);
  touch-action: manipulation;
  user-select: none;
}

.friend-actions .btn:active {
  transform: scale(0.95);
  opacity: 0.8;
}

/* Barre de recherche */
.search-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
  color: #ffffff;
}

.search-input:focus {
  outline: none;
  border-color: #8ab6ff;
  background: rgba(0, 0, 0, 0.4);
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* ========================================
   PAGE PROFIL - Header
   ======================================== */

.profile-header {
  text-align: center;
  padding: 32px 20px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  margin-bottom: 20px;
}

.profile-avatar-container {
  margin: 0 auto 16px;
  width: 96px;
  height: 96px;
  position: relative;
}

.profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(138, 182, 255, 0.4);
  box-shadow: 0 4px 12px rgba(138, 182, 255, 0.3);
  background: linear-gradient(135deg, #8ab6ff 0%, #ffc2d6 100%);
}

.profile-avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid rgba(138, 182, 255, 0.4);
  box-shadow: 0 4px 12px rgba(138, 182, 255, 0.3);
}

.profile-avatar__initials {
  font-size: 40px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.profile-header h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin: 20px 0;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #8ab6ff;
}

.stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

.profile-actions .btn,
.profile-action-btn {
  min-width: 120px;
  font-size: 14px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(138, 182, 255, 0.3);
  touch-action: manipulation;
  user-select: none;
}

.profile-action-btn:active:not(:disabled) {
  transform: scale(0.95);
  opacity: 0.8;
}

.profile-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.profile-actions .relationship-buttons {
  display: contents;
}

/* Responsive adjustments for profile actions */
@media (max-width: 600px) {
  .profile-actions {
    gap: 8px;
  }

  .profile-action-btn {
    font-size: 13px;
    padding: 8px 12px;
    min-width: 100px;
  }
}

/* ========================================
   PAGE PROFIL - Badges
   ======================================== */

.profile-badges {
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  margin-bottom: 16px;
}

.profile-badges h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 16px;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: rgba(138, 182, 255, 0.08);
  border: 1px solid rgba(138, 182, 255, 0.2);
  border-radius: 12px;
  text-align: center;
  transition: all 0.2s ease;
}

.badge-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(138, 182, 255, 0.3);
  background: rgba(138, 182, 255, 0.12);
}

.badge-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.badge-name {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
}

.badge-level {
  font-size: 10px;
  color: #8ab6ff;
  text-transform: uppercase;
}

/* ========================================
   PAGE PROFIL - Posts
   ======================================== */

.profile-posts {
  padding: 24px 16px;
}

.profile-posts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.profile-posts-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.profile-posts h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-item {
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  transition: all 0.2s ease;
}

.post-item:hover {
  background: rgba(138, 182, 255, 0.08);
  border-color: rgba(138, 182, 255, 0.3);
  box-shadow: 0 4px 16px rgba(138, 182, 255, 0.2);
}

.post-header {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.post-title {
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 8px;
}

.post-content {
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  margin-bottom: 12px;
}

.post-image {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 12px;
}

.post-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.post-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ========================================
   États vides
   ======================================== */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.5);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 14px;
}

/* ========================================
   Responsive - Desktop
   ======================================== */

@media (min-width: 768px) {
  .friends-content {
    max-width: 800px;
    margin: 0 auto;
  }

  .profile-header {
    max-width: 600px;
    margin: 0 auto 20px;
  }

  .profile-badges,
  .profile-posts {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 20px;
  }

  .badges-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

/* ========================================
   Boutons spécifiques
   ======================================== */

.btn-add-friend {
  background: #8ab6ff;
  color: #000000;
}

.btn-add-friend:hover {
  background: #6ea3ff;
}

.btn-following {
  background: #2dc07a;
  color: white;
}

.btn-following:hover {
  background: #059669;
}

.btn-unfollow {
  background: #ef476f;
  color: white;
}

.btn-unfollow:hover {
  background: #dc2626;
}

.btn-accept {
  background: #2dc07a;
  color: white;
}

.btn-reject {
  background: #ef476f;
  color: white;
}

/* ========================================
   Loading states
   ======================================== */

.loading-skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-text {
  height: 16px;
  margin: 8px 0;
}

.skeleton-text.short {
  width: 60%;
}
