/* --- PAGE GLOBALE --- */
.photo-page {
  max-width: var(--max-width);
  margin: 18px auto;
  padding: 18px;
  width: 100%;
}

main h1 {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- BARRE DE FILTRES --- */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.filter-bar select {
  background: var(--panel);
  border-radius: 8px;
  padding: 8px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

/* --- GRILLE PHOTO RESPONSIVE --- */
.photo-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
  justify-items: center;
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
}

.photo-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow 0.2s ease;
}

.photo-card:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.photo-card img {
  display: block;
  width: 100%;
  height: 230px;
  object-fit: cover;
}

.photo-card .photo-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.6));
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

/* --- RESPONSIVE AJUSTEMENTS --- */
@media (max-width: 1200px) {
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 800px) {
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 500px) {
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* --- PAGINATION --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

.pagination button {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
  background: var(--accent);
  color: white;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- MODAL PHOTO --- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
  opacity: 1;
}

.modal.fade-out {
  opacity: 0;
}

.modal-content {
  background: #181818;
  border-radius: 14px;
  max-width: 900px;
  width: 90%;
  color: white;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.3s ease forwards;
  overflow: hidden;
}

.modal.active .modal-content {
  transform: scale(1);
}

/* --- IMAGE ADAPTÉE À L'ÉCRAN --- */
.modal-inner img {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  margin: 0 auto;
}

/* --- BOUTON FERMETURE --- */
.modal-content .close {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 28px;
  cursor: pointer;
  color: white;
  transition: color 0.2s, transform 0.2s;
  z-index: 2;
}

.modal-content .close:hover {
  color: #ff4d4d;
  transform: scale(1.2);
}

/* --- INFO PHOTO DANS LE MODAL --- */
.modal-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
}

.photo-info {
  max-width: 360px;
  color: #ccc;
  text-align: left;
}

.photo-info h3 {
  margin-top: 0;
  color: #fff;
}

/* --- BOUTON LIKE --- */
#likeButton {
  background: #ff4d4d;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}

#likeButton:hover {
  background: #ff6666;
}

#likeButton.liked {
  background: #444;
  color: #ff4d4d;
}

/* --- ANIMATION --- */
@keyframes fadeIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- MOBILE --- */
@media (max-width: 900px) {
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .modal-inner {
    flex-direction: column;
    align-items: center;
  }

  .modal-inner img {
    max-width: 95vw;
    max-height: 80vh;
  }

  .photo-card img {
    height: 150px;
  }

  .photo-info {
    text-align: center;
  }
}