/* ==========================================
   RÉALISATIONS PAGE - OPTIMIZED STYLES
   ========================================== */

/* ==========================================
   MASONRY LAYOUT
   ========================================== */
.masonry-gallery {
  column-count: 3;
  column-gap: 1.25rem;
  padding: 0 0.5rem;
  margin: 0 auto;
  max-width: 1400px;
}

.masonry-gallery > div {
  break-inside: avoid-column;
  margin-bottom: 1.25rem;
  width: 100%;
}

.masonry-gallery img,
.image-card img,
.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
  cursor: pointer;
}

.masonry-gallery img:hover,
.image-card:hover img,
.gallery-item:hover img {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

/* ==========================================
   COMPANY CARDS
   ========================================== */
.company-card {
  background: #fff;
  border-radius: 14px;
  height: 100%;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
  position: relative;
}

.company-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  border: 3px solid transparent;
  transition: border-color 0.3s ease;
  pointer-events: none;
}

.company-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.15);
}

.company-card:hover::before {
  border-color: var(--main-blue);
}

.company-card-header {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.company-logo {
  max-width: 180px;
  height: 80px;
  object-fit: contain;
  transition: filter 0.3s ease, transform 0.3s ease;
}

.company-card:hover .company-logo {
  filter: brightness(1.05);
  transform: scale(1.08);
}

/* ==========================================
   GROUP INDICATOR
   ========================================== */
.group-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--main-blue);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 10;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

.group-indicator i {
  color: white;
  font-size: 18px;
}

.company-card-group:hover .group-indicator {
  transform: scale(1.15);
  background-color: var(--light-blue);
}

/* ==========================================
   GROUP MODAL CLIENT SQUARES
   ========================================== */
#groupModalClients {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.75rem;
  padding: 0.75rem 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--main-blue) #f0f0f0;
}

.group-client-square {
  background: #fff;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 0.75rem;
  min-width: 100px;
  height: 70px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.group-client-square::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  border: 3px solid transparent;
  transition: border-color 0.3s ease;
  pointer-events: none;
}

.group-client-square:hover,
.group-client-square.active {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.group-client-square.active::before {
  border-color: var(--main-blue);
}

.group-client-square:hover::before {
  border-color: var(--light-blue);
}

.group-client-square img {
  max-width: 100%;
  max-height: 50px;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.group-client-square:hover img {
  transform: scale(1.08);
}

.all-clients-icon {
  font-size: 1.5rem;
  color: var(--main-blue);
  transition: transform 0.3s ease, color 0.3s ease;
}

.group-client-square:hover .all-clients-icon,
.group-client-square.active .all-clients-icon {
  transform: scale(1.1);
  color: var(--light-blue);
}

/* ==========================================
   FILTER BUTTONS
   ========================================== */
#categoryFilters {
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-btn {
  padding: 10px 22px;
  border-radius: 50px;
  border: 2px solid #ddd;
  background: #fff;
  color: #333;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-btn:hover {
  background-color: var(--main-blue);
  color: #fff;
  border-color: var(--main-blue);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
  transform: translateY(-2px);
}

.filter-btn.active {
  background-color: var(--main-blue);
  color: #fff;
  border-color: var(--main-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.filter-btn i {
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.filter-btn:hover i {
  transform: scale(1.1);
}

/* ==========================================
   MODALS - SHARED STYLES
   ========================================== */
#groupModal .modal-content,
#clientModal .modal-content,
#imageModal .modal-content {
  border: none;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

#groupModal .modal-header,
#clientModal .modal-header {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  padding: 1.5rem 2rem;
  border-bottom: 2px solid #e9ecef;
}

#groupModal .modal-body,
#clientModal .modal-body {
  padding: 1.5rem 2rem 2rem;
}

.modal-logo {
  max-width: 200px;
  max-height: 80px;
  object-fit: contain;
}

#groupModal .btn-close,
#clientModal .btn-close,
#imageModal .btn-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  opacity: 0.9;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

#groupModal .btn-close:hover,
#clientModal .btn-close:hover,
#imageModal .btn-close:hover {
  opacity: 1;
  transform: scale(1.1);
  background-color: #fff;
}

/* Image Modal Specific */
#imageModal .modal-dialog {
  max-width: 900px;
}

#imageModal .modal-body {
  padding: 2rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

#imageModal img {
  max-height: 65vh;
  object-fit: contain;
  margin: 0 auto 1.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

#imageModalDescription {
  font-size: 1.125rem;
  color: #495057;
  font-weight: 500;
  margin-bottom: 1rem;
  line-height: 1.6;
}

#imageModalVille {
  font-size: 1rem;
  color: #6c757d;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

#imageModalVille::before {
  content: "📍";
  font-size: 1.2rem;
}

#imageModalTags .badge {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Modal Galleries */
#clientModalGallery.masonry-gallery,
#groupModalGallery.masonry-gallery {
  padding: 0;
  background: transparent;
}

.image-card,
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
}

.image-card::after,
.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.4), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.image-card:hover::after,
.gallery-item:hover::after {
  opacity: 1;
}

/* ==========================================
   UTILITIES
   ========================================== */
.badge {
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: transform 0.2s ease;
}

.badge:hover {
  transform: translateY(-1px);
}

#emptyState {
  padding: 4rem 1rem;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#emptyState i {
  color: #adb5bd;
  margin-bottom: 1rem;
  font-size: 3rem;
  opacity: 0.5;
}

#contentGrid.row {
  margin: 0 -0.5rem;
}

#contentGrid.row > [class*="col-"] {
  padding: 0 0.5rem;
  margin-bottom: 1rem;
}

/* Accessibility */
[role="button"]:focus-visible,
.filter-btn:focus-visible,
.company-card:focus-visible,
.image-card:focus-visible,
.gallery-item:focus-visible,
.group-client-square:focus-visible {
  outline: 3px solid var(--main-blue);
  outline-offset: 3px;
}

/* Animations */
.masonry-gallery > div,
#contentGrid.row > [class*="col-"] {
  animation: fadeInUp 0.4s ease-out forwards;
  opacity: 0;
}

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

.masonry-gallery > div:nth-child(n+1) { animation-delay: 0.05s; }
.masonry-gallery > div:nth-child(n+2) { animation-delay: 0.1s; }
.masonry-gallery > div:nth-child(n+3) { animation-delay: 0.15s; }
.masonry-gallery > div:nth-child(n+4) { animation-delay: 0.2s; }
.masonry-gallery > div:nth-child(n+5) { animation-delay: 0.25s; }
.masonry-gallery > div:nth-child(n+6) { animation-delay: 0.3s; }

#contentGrid.row > [class*="col-"]:nth-child(n+1) { animation-delay: 0.05s; }
#contentGrid.row > [class*="col-"]:nth-child(n+2) { animation-delay: 0.1s; }
#contentGrid.row > [class*="col-"]:nth-child(n+3) { animation-delay: 0.15s; }
#contentGrid.row > [class*="col-"]:nth-child(n+4) { animation-delay: 0.2s; }

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 992px) {
  .masonry-gallery { column-count: 2; }
}

@media (max-width: 768px) {
  .masonry-gallery { column-count: 2; }
  
  #categoryFilters {
    margin-bottom: 1.5rem;
    gap: 0.5rem;
  }
  
  .company-card-header {
    height: 100px;
    padding: 1rem;
  }
  
  .company-logo {
    max-width: 140px;
    max-height: 60px;
  }
  
  .group-indicator {
    width: 28px;
    height: 28px;
  }
  
  .group-indicator i {
    font-size: 16px;
  }
  
  #groupModalClients {
    gap: 0.6rem;
    padding: 0.6rem 0;
  }
  
  .group-client-square {
    min-width: 90px;
    height: 65px;
    padding: 0.6rem;
  }
  
  .group-client-square img {
    max-height: 45px;
  }
  
  .all-clients-icon {
    font-size: 1.3rem;
  }
  
  #imageModal .modal-dialog {
    max-width: 95%;
    margin: 1rem auto;
  }
  
  #imageModal .modal-body {
    padding: 1.5rem;
  }
  
  #imageModal img {
    max-height: 50vh;
    margin-bottom: 1rem;
  }
  
  #imageModalDescription {
    font-size: 1rem;
  }
  
  #groupModal .modal-header,
  #clientModal .modal-header {
    padding: 1rem 1.5rem;
  }
  
  #groupModal .modal-body,
  #clientModal .modal-body {
    padding: 1rem 1.5rem 1.5rem;
  }
  
  .modal-logo {
    max-width: 140px;
    max-height: 70px;
  }
}

@media (max-width: 576px) {
  .masonry-gallery {
    column-count: 1;
    column-gap: 0.75rem;
    padding: 0 0.25rem;
  }
  
  .filter-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
  
  .filter-btn i {
    font-size: 0.9rem;
  }
  
  .company-card-header {
    height: 90px;
    padding: 0.75rem;
  }
  
  .company-logo {
    max-width: 120px;
    max-height: 50px;
  }
  
  .company-card:hover {
    transform: translateY(-4px);
  }
  
  .group-indicator {
    width: 26px;
    height: 26px;
    top: 6px;
    right: 6px;
  }
  
  .group-indicator i {
    font-size: 14px;
  }
  
  #groupModalClients {
    gap: 0.5rem;
    padding: 0.5rem 0;
  }
  
  .group-client-square {
    min-width: 80px;
    height: 60px;
    padding: 0.5rem;
  }
  
  .group-client-square img {
    max-height: 40px;
  }
  
  .all-clients-icon {
    font-size: 1.2rem;
  }
  
  #imageModal .modal-body {
    padding: 1rem;
  }
  
  #imageModal img {
    border-radius: 8px;
    margin-bottom: 0.75rem;
  }
  
  #imageModalDescription {
    font-size: 0.95rem;
  }
  
  #imageModalTags .badge {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
  
  .modal-logo {
    max-width: 120px;
    max-height: 60px;
  }
  
  #groupModal .btn-close,
  #clientModal .btn-close,
  #imageModal .btn-close {
    width: 2rem;
    height: 2rem;
    margin: 0.75rem;
  }
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
  .masonry-gallery { column-count: 2; column-gap: 1rem; }
  #categoryFilters, .filter-btn, .modal, footer, .group-indicator { display: none !important; }
  .company-card, .masonry-gallery img { box-shadow: none !important; break-inside: avoid; }
  .company-card::before, .image-card::after, .gallery-item::after { display: none !important; }
  section { page-break-inside: avoid; }
}