@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'IBM Plex Mono', monospace;
  background: #fff;
  color: #000;
  font-size: 13px;
  line-height: 1.4;
}

/* ========================================
   HEADER PERMANENT
======================================== */

.site-header {
  background: #000;
  color: #fff;
  border-bottom: 1px solid #000;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 1px;
}

.site-nav {
  display: flex;
  gap: 0;
  border: 1px solid #fff;
}

.nav-link {
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: all 0.1s;
  border-right: 1px solid #fff;
}

.nav-link:last-child {
  border-right: none;
}

.nav-link:hover {
  background: #fff;
  color: #000;
}

.nav-link.active {
  background: #fff;
  color: #000;
}

/* ========================================
   MODALE À PROPOS
======================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.2s;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: #fff;
  border: 1px solid #000;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: 1px solid #000;
  width: 32px;
  height: 32px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  z-index: 10;
}

.modal-close:hover {
  background: #000;
  color: #fff;
}

.modal-body {
  padding: 40px 32px;
}

.modal-body h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 32px;
  letter-spacing: 2px;
  border-bottom: 1px solid #000;
  padding-bottom: 16px;
}

.about-section {
  margin-bottom: 24px;
}

.about-section h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #666;
  margin-bottom: 8px;
}

.about-section p {
  font-size: 13px;
  line-height: 1.6;
}

.about-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid #000;
}

.about-footer p {
  font-size: 11px;
  color: #666;
  letter-spacing: 0.5px;
}

/* ========================================
   BARRE DE FILTRES
======================================== */

.filter-bar {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid #000;
  z-index: 50;
}

/* Tags des filtres actifs + contrôles (EN HAUT - STICKY) */
.active-filters {
  max-width: 1600px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #000;
  background: #fff;
}

.filters-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.result-count {
  font-size: 12px;
  color: #000;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.active-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  background: #000;
  color: #fff;
  padding: 4px 10px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag:hover {
  background: #333;
}

.tag-remove {
  font-size: 14px;
  line-height: 1;
  font-weight: bold;
}

/* Contrôles de vue et tri */
.view-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Dropdown de tri */
.sort-dropdown {
  position: relative;
}

.sort-btn {
  background: #fff;
  border: 1px solid #000;
  padding: 8px 14px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sort-btn:hover {
  background: #000;
  color: #fff;
}

.sort-menu {
  position: absolute;
  top: calc(100% + 1px);
  right: 0;
  background: #fff;
  border: 1px solid #000;
  padding: 0;
  min-width: 220px;
  display: none;
  z-index: 100;
}

.sort-dropdown.open .sort-menu {
  display: block;
}

.sort-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 12px;
  border-bottom: 1px solid #e0e0e0;
}

.sort-option:last-child {
  border-bottom: none;
}

.sort-option:hover {
  background: #f5f5f5;
}

.sort-option .check {
  opacity: 0;
  color: #000;
  font-weight: bold;
}

.sort-option.active {
  background: #000;
  color: #fff;
}

.sort-option.active .check {
  opacity: 1;
}

/* Toggle de vue */
.view-toggle {
  display: flex;
  gap: 0;
  border: 1px solid #000;
}

.view-btn {
  background: #fff;
  border: none;
  border-right: 1px solid #000;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
}

.view-btn:last-child {
  border-right: none;
}

.view-btn:hover {
  background: #f0f0f0;
}

.view-btn.active {
  background: #000;
  color: #fff;
}

.view-btn svg {
  display: block;
}

/* Filtres dropdowns (EN BAS) */
.filter-bar-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filter-dropdowns {
  display: flex;
  gap: 0;
}

.filter-dropdown {
  position: relative;
  border-right: 1px solid #000;
}

.filter-dropdown:first-child {
  border-left: 1px solid #000;
}

.filter-btn {
  background: #fff;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-btn:hover {
  background: #000;
  color: #fff;
}

.filter-btn.active {
  background: #000;
  color: #fff;
}

.filter-btn .arrow {
  font-size: 10px;
}

.filter-menu {
  position: absolute;
  top: calc(100% + 1px);
  left: -1px;
  background: #fff;
  border: 1px solid #000;
  padding: 0;
  min-width: 220px;
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 100;
}

.filter-dropdown.open .filter-menu {
  display: block;
}

.filter-option {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
  border-bottom: 1px solid #e0e0e0;
}

.filter-option:last-child {
  border-bottom: none;
}

.filter-option:hover {
  background: #f5f5f5;
}

.filter-option input[type="checkbox"] {
  margin-right: 10px;
  cursor: pointer;
}

.filter-option-label {
  flex: 1;
  font-size: 12px;
}

.filter-option-count {
  color: #666;
  font-size: 11px;
  margin-left: 8px;
}

.reset-btn {
  background: #fff;
  border: 1px solid #000;
  padding: 8px 16px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  transition: all 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reset-btn:hover {
  background: #000;
  color: #fff;
}

/* ========================================
   CONTAINER & GALERIE
======================================== */

.main-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

/* Vue grille */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1px;
  background: #000;
  border: 1px solid #000;
}

/* Vue liste */
.gallery-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid #000;
}

/* Vue groupée par série */
.gallery-series {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.series-group {
  border: 1px solid #000;
}

.series-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #000;
  color: #fff;
  border-bottom: 1px solid #000;
}

.series-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.series-count {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1px;
  background: #000;
}

/* Wrapper pour chaque image */
.image-wrapper {
  position: relative;
  cursor: pointer;
  background: #fff;
  overflow: hidden;
  transition: none;
}

.image-wrapper::before {
  content: '';
  display: block;
  padding-top: 133.33%; /* 4/3 = 1.3333 → format portrait 3:4 */
}

.image-wrapper:hover {
  background: #f5f5f5;
  z-index: 2;
}

.image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: none;
}

/* Overlay avec titre au survol */
.image-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.95);
  padding: 8px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.image-wrapper:hover .image-overlay {
  opacity: 1;
}

.overlay-title {
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.overlay-meta {
  color: rgba(255,255,255,0.7);
  font-size: 10px;
  margin-top: 2px;
  line-height: 1.2;
  letter-spacing: 0.3px;
}

/* Vue liste - layout horizontal */
.gallery-list .image-wrapper {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 0;
  padding: 0;
  align-items: stretch;
  border-bottom: 1px solid #000;
  background: #fff;
}

.gallery-list .image-wrapper:last-child {
  border-bottom: none;
}

.gallery-list .image-wrapper:hover {
  background: #f5f5f5;
  transform: none;
}

.gallery-list .image-wrapper:hover img {
  transform: none;
}

.gallery-list .image-wrapper img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  flex-shrink: 0;
  border-right: 1px solid #000;
}

.gallery-list .image-overlay {
  display: none;
}

.list-info {
  flex: 1;
  display: grid;
  grid-template-columns: 200px 150px 150px 1fr 80px;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  font-size: 12px;
}

.list-title {
  font-size: 12px;
  font-weight: 600;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.list-meta {
  display: contents;
}

.list-meta-item {
  display: flex;
  align-items: center;
}

.list-meta-label {
  display: none;
}

/* Bouton + */
.select-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 14px;
  font-weight: bold;
  color: #000;
  background: #fff;
  border: 1px solid #000;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
  z-index: 2;
}

.select-btn:hover {
  background: #000;
  color: #fff;
}

.select-btn.selected {
  background: #000;
  color: #fff;
}

.gallery-list .select-btn {
  position: relative;
  top: auto;
  right: auto;
  margin: 0 16px;
}

/* ========================================
   VUE DÉTAIL
======================================== */

.detail-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  z-index: 100;
  overflow-y: auto;
  transition: opacity 0.2s ease;
  display: flex;
  flex-direction: column;
}

.detail-view.hidden {
  opacity: 0;
  pointer-events: none;
}

.detail-view.visible {
  opacity: 1;
  pointer-events: all;
}

.detail-header {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid #000;
  padding: 12px 20px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-back {
  background: #fff;
  border: 1px solid #000;
  font-size: 12px;
  cursor: pointer;
  padding: 8px 16px;
  transition: all 0.1s;
  font-family: 'IBM Plex Mono', monospace;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-back:hover {
  background: #000;
  color: #fff;
}

.detail-nav-info {
  font-size: 12px;
  color: #666;
  font-family: 'IBM Plex Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-actions {
  display: flex;
  gap: 12px;
}

.detail-add-btn {
  background: #000;
  color: #fff;
  border: 1px solid #000;
  padding: 8px 16px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-add-btn:hover {
  background: #333;
}

.detail-add-btn.added {
  background: #fff;
  color: #000;
}

.detail-inner {
  flex: 1;
  display: flex;
  gap: 40px;
  max-width: 1400px;
  margin: 40px auto;
  padding: 0 20px;
  align-items: flex-start;
}

.detail-carousel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.detail-image-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  border: 1px solid #000;
  background: #f5f5f5;
}

.detail-carousel img {
  max-width: 100%;
  max-height: calc(100vh - 320px);
  object-fit: contain;
}

.carousel-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border: 1px solid #000;
  font-size: 18px;
  cursor: pointer;
  user-select: none;
  padding: 12px 10px;
  color: #000;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  z-index: 101;
}

.carousel-btn:hover {
  background: #000;
  color: #fff;
}

#prevImg {
  left: 20px;
}

#nextImg {
  right: 20px;
}

.carousel-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.carousel-btn:disabled:hover {
  opacity: 0.2;
  background: #fff;
  color: #000;
}

.carousel-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  background: #ccc;
  transition: all 0.1s;
  cursor: pointer;
}

.carousel-dot:hover {
  background: #666;
}

.carousel-dot.active {
  background: #000;
  width: 20px;
}

/* Métadonnées */
.detail-text {
  width: 320px;
  font-size: 12px;
  line-height: 1.6;
  flex-shrink: 0;
}

.detail-text h2 {
  margin-bottom: 16px;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  border: 1px solid #000;
  padding: 12px;
}

.detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-meta-label {
  font-size: 10px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

.detail-meta-value {
  font-size: 12px;
  color: #000;
}

.detail-serie-info {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #000;
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.keyboard-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  padding: 10px 16px;
  font-size: 11px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 101;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.keyboard-hint.show {
  opacity: 1;
}

.keyboard-hint kbd {
  background: #fff;
  color: #000;
  padding: 2px 6px;
  margin: 0 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
}

/* ========================================
   PANNEAU DE SÉLECTION
======================================== */

.selection-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #000;
  color: #fff;
  border: 1px solid #000;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'IBM Plex Mono', monospace;
  z-index: 999;
  transition: all 0.1s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.selection-toggle:hover {
  background: #333;
}

.selection-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 340px;
  height: 100vh;
  background: #fff;
  border-left: 1px solid #000;
  padding: 0;
  overflow-y: auto;
  z-index: 1000;
  transform: translateX(0);
  transition: transform 0.2s ease;
}

.selection-panel.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

.selection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #000;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
}

.selection-header h3 {
  font-size: 14px;
  flex: 1;
  text-align: center;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.close-selection {
  position: absolute;
  right: 16px;
  top: 16px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  transition: transform 0.1s;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-selection:hover {
  transform: scale(1.2);
}

.selection-actions {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid #000;
}

.export-pdf-btn {
  width: 100%;
  background: #000;
  color: #fff;
  border: 1px solid #000;
  padding: 10px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.export-pdf-btn:hover {
  background: #333;
}

.export-pdf-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

#clearSelection {
  width: 100%;
  background: #fff;
  color: #000;
  border: 1px solid #000;
  padding: 10px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  transition: all 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#clearSelection:hover {
  background: #000;
  color: #fff;
}

#selectionList {
  padding: 16px;
}

.selection-item {
  position: relative;
  margin-bottom: 16px;
  border: 1px solid #000;
}

.selection-item img {
  width: 100%;
  height: auto;
  display: block;
}

.remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #fff;
  color: #000;
  border: 1px solid #000;
  width: 24px;
  height: 24px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}

.remove-btn:hover {
  background: #000;
  color: #fff;
}

/* ========================================
   RESPONSIVE
======================================== */

@media (max-width: 1024px) {
  .detail-inner {
    flex-direction: column;
    align-items: center;
  }

  .detail-text {
    width: 100%;
    max-width: 600px;
  }
}

@media (max-width: 768px) {
  .filter-bar-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-dropdowns {
    width: 100%;
  }

  .active-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .view-controls {
    width: 100%;
    justify-content: space-between;
  }

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

  .selection-panel {
    width: 100%;
  }

  .list-info {
    grid-template-columns: 1fr;
    gap: 8px;
    font-size: 11px;
  }

  .carousel-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  #prevImg {
    left: 10px;
  }

  #nextImg {
    right: 10px;
  }
}