/* ===== STRUCTURE PRINCIPALE ===== */
html, body {
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-4);
  min-height: 100vh;
}

.app {
  display: flex;
  gap: var(--space-3);
  width: 100%;
  max-width: 1500px;
  height: 900px; /* Fixed height for the red rectangle */
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ===== SIDEBAR (Navigation Menu - Outside Red Rectangle) ===== */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4) 0;
  flex-shrink: 0;
}

/* ===== MAIN CONTAINER (Red Rectangle) ===== */
.main-container {
  display: flex;
  flex: 1;
  height: 100%;
  background: var(--color-bg-card);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ===== PROFILE CARD (Left side of Red Rectangle) ===== */
.profile-card {
  width: 280px;
  height: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #E9ECF1;
  border-radius: var(--card-radius) 0 0 var(--card-radius);
  overflow: hidden;
}

.profile-image.hidden {
  display: none !important;
}

.profile-description {
  padding: var(--space-3) 0;
  margin: var(--space-3) 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  text-align: left;
  display: none; /* Caché par défaut, JS gère l'affichage */
}

.profile-description p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.profile-description.hidden {
  display: none !important;
}

.profile-nav-cards {
  display: none; /* Caché par défaut, JS gère l'affichage */
  flex-direction: column;
  gap: 0.75rem;
  padding: var(--space-3) 0;
  margin-top: var(--space-2);
}

.profile-nav-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  color: var(--color-text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.25s ease;
  cursor: pointer;
  min-height: 44px;
}

.profile-nav-card i {
  font-size: 1rem;
  color: var(--primary-color);
  transition: all 0.25s ease;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.profile-nav-card span {
  flex: 1;
  text-align: left;
  line-height: 1.3;
}

.profile-nav-card:hover {
  border-color: var(--color-accent);
  background: rgba(79, 195, 247, 0.1);
  color: var(--color-accent-dark);
  transform: translateX(3px);
  box-shadow: 0 2px 8px rgba(79, 195, 247, 0.15);
}

.profile-nav-card:hover i {
  color: var(--color-accent);
  transform: scale(1.05);
}

.profile-nav-card.active {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(79, 195, 247, 0.3);
}

.profile-nav-card.active i {
  color: white;
}

.profile-nav-cards.hidden {
  display: none !important;
}

.profile-image {
  width: 100%;
  flex-shrink: 0;
  overflow: hidden;
  margin-bottom: 0;
}

/* When inside profile-card-content and news-feed is hidden, take available space */
.news-feed.hidden ~ .profile-card-content .profile-image {
  /* CRITICAL FOR SAFARI: flex: 1 1 auto permet à l'image de grandir naturellement
     Ne JAMAIS modifier cette valeur via JavaScript - Safari ne recalcule pas toujours le layout
     Voir docs/safari-compatibility-guide.md pour plus de détails */
  flex: 1 1 auto;
  /* CRITICAL FOR SAFARI: min-height: 0 est un hack flexbox nécessaire
     Empêche l'image de déborder de son conteneur flex
     Sans cela, Safari peut mal calculer les hauteurs */
  min-height: 0;
}

.profile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.profile-card-content {
  padding: var(--space-4);
  text-align: center;
  background-color: #E9ECF1 !important;
  /* CRITICAL FOR SAFARI: flex-shrink: 0 empêche la compression du contenu
     Le contenu garde sa taille naturelle basée sur son contenu
     Safari utilise cela pour calculer l'espace restant pour .profile-image
     Ne JAMAIS ajouter max-height ou height fixe ici */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* When news-feed is hidden (About tab), profile-card-content takes remaining space */
.news-feed.hidden ~ .profile-card-content {
  flex: 1;
  padding: 0 0 var(--space-4) 0;
}

.profile-name {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-1);
  margin-top: var(--space-4);
  color: var(--color-text-primary);
}

.profile-title {
  color: var(--color-accent);
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-3);
}

.profile-card .highlight {
  color: var(--color-accent);
}

.profile-social {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.profile-social a {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  transition: all var(--transition-base);
}

.profile-social a:hover {
  transform: translateY(-2px);
  color: var(--color-accent);
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.profile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2);
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: 9px;
  font-weight: 600;
  transition: all var(--transition-base);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.profile-btn:first-child {
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.profile-btn:hover {
  background: rgba(79, 195, 247, 0.08);
  color: var(--color-accent);
}

.profile-btn i {
  font-size: 10px;
  color: var(--color-accent);
}

/* ===== DYNAMIC BLOCK (Right side of Red Rectangle) ===== */
.dynamic-block {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
  border-left: 1px solid var(--color-border);
  position: relative;
}

/* Ligne bleue décorative en haut du dynamic-block */
.dynamic-block::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #6FC0F2 0%, #A7D9F2 100%);
  z-index: 100;
}

.dynamic-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-5);
  scrollbar-width: thin;
  scrollbar-color: var(--color-accent) var(--color-bg-off-white);
  position: relative;
  min-height: 0;
  contain: layout style;
}

.dynamic-content::-webkit-scrollbar {
  width: 8px;
}

.dynamic-content::-webkit-scrollbar-track {
  background: var(--color-bg-off-white);
}

.dynamic-content::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border-radius: var(--radius-full);
}

.dynamic-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent-hover);
}

/* ===== SECTIONS ===== */
.section {
  display: none;
  padding: 0;
  background: transparent;
}

.section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* ===== GRILLES ===== */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== FLEXBOX UTILITAIRES ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
