/* Photo reprend volontairement la grille de la Galerie. Seuls le dossier
   source et les outils d'import changent. */
.photos-page .gallery-page-main { padding-bottom: 5rem; }
.photo-filter-panel .photo-page-filters { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: .95rem 1rem; }
.photo-filter-panel .gallery-sort-field { grid-column: 1 / -1; display: grid; gap: .35rem; }
.photo-filter-panel .gallery-range { grid-column: 1 / -1; }
.photo-filter-panel #photoPageCount { color: var(--text-muted); font-size: .72rem; }
.photo-gallery-card { position: relative; }
.photo-gallery-preview { background-color: #050506; background-position: center center !important; background-size: cover !important; }
.photo-gallery-preview .gallery-generated-preview { width: 100%; height: 100%; object-fit: cover; object-position: center center; }
.photo-score-badge { position: absolute; z-index: 3; right: .45rem; bottom: .45rem; padding: .24rem .42rem; border: 1px solid rgba(255,255,255,.24); border-radius: 999px; background: rgba(8,8,10,.76); color: #fff; font-size: .66rem; font-weight: 800; line-height: 1; text-shadow: 0 1px 2px #000; backdrop-filter: blur(5px); }
.photo-drop-zone { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: .45rem; width: min(27rem, calc(100% - 2.5rem)); min-height: 2.7rem; margin: .75rem 1.25rem 0; padding: .45rem .65rem; border: 1px dashed rgba(242,242,242,.4); border-radius: var(--radius-md); background: rgba(255,255,255,.025); color: rgba(242,242,242,.82); font-size: .74rem; font-weight: 700; cursor: pointer; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.photo-drop-zone:hover, .photo-drop-zone:focus-visible, .photo-drop-zone.is-dragging { border-color: #fff; background: rgba(255,255,255,.09); outline: none; }.photo-drop-zone.is-dragging { transform: scale(1.01); }.photo-drop-zone.is-uploading { opacity: .58; pointer-events: none; }.photo-drop-zone > i { font-size: 1rem; }.photo-drop-zone small { color: var(--text-muted); font-size: .67rem; font-weight: 600; }.photo-drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }.photo-import-status { min-height: 1rem; margin: .32rem 1.25rem 0; color: var(--text-muted); font-size: .68rem; }
.photo-lightbox[hidden] { display: none !important; }.photo-lightbox { position: fixed; z-index: 500; inset: 0; display: grid; place-items: center; padding: .75rem; }.photo-lightbox-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.8); backdrop-filter: blur(10px); }.photo-lightbox-dialog { position: relative; z-index: 1; display: grid; width: min(72rem, 100%); max-height: calc(100vh - 1.5rem); overflow: auto; border: 1px solid rgba(242,242,242,.22); border-radius: var(--radius-md); background: #101012; box-shadow: 0 24px 70px rgba(0,0,0,.58); }.photo-lightbox-dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .62rem .8rem; border-bottom: 1px solid var(--border-color); }.photo-lightbox-dialog h2 { margin: 0; font-size: .95rem; }.photo-lightbox-dialog p { max-width: 65vw; margin: .18rem 0 0; overflow: hidden; color: var(--text-muted); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }.photo-lightbox-content { display: grid; min-height: 12rem; max-height: 72vh; place-items: center; padding: .55rem; background: #050506; }.photo-lightbox-content img { display: block; width: auto; max-width: 100%; max-height: 70vh; object-fit: contain; }.photo-lightbox-editor { display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .6rem .75rem; border-top: 1px solid var(--border-color); }.photo-lightbox-editor[hidden] { display: none !important; }.photo-lightbox-editor > label { display: flex; align-items: center; gap: .42rem; color: var(--text-muted); font-size: .74rem; font-weight: 700; }.photo-lightbox-editor select { min-height: 2rem; padding: .3rem .45rem; border: 1px solid var(--border-color); border-radius: .4rem; background: #17171a; color: #fff; font: inherit; }.photo-lightbox-actions { display: flex; gap: .45rem; }.photo-delete-btn { color: #ffb5b5; border-color: rgba(255,120,120,.35); }body.photo-lightbox-open { overflow: hidden; }
@media(max-width:700px){
  .photo-filter-panel .photo-page-filters{grid-template-columns:1fr}
  .photo-drop-zone{grid-template-columns:auto 1fr;width:calc(100% - .8rem);margin:.45rem .4rem 0}
  .photo-drop-zone small{grid-column:2}
  .photo-import-status{margin-left:.4rem}
  .photo-score-badge{right:.25rem;bottom:.25rem;font-size:.58rem}
  .photo-lightbox{padding:.35rem}
  .photo-lightbox-content{max-height:63vh}
  .photo-lightbox-content img{max-height:61vh}
  .photo-lightbox-editor{align-items:stretch;flex-direction:column}
  .photo-lightbox-actions{justify-content:space-between;width:100%}

  /* Même ergonomie que la Galerie : filtre flottant en bas, avec le panneau
     qui s'ouvre au-dessus pour ne pas recouvrir la grille. */
  body.photos-page #btnTogglePhotoFilters {
    position: fixed;
    right: .8rem;
    bottom: calc(max(.8rem, env(safe-area-inset-bottom)) + .48rem);
    z-index: 190;
    margin: 0;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 0;
    gap: 0;
  }
  body.photos-page #btnTogglePhotoFilters i { display: grid; width: 1em; height: 1em; place-items: center; line-height: 1; font-size: 1rem; }
  body.photos-page .photo-filter-panel {
    top: auto;
    right: .8rem;
    bottom: calc(max(.8rem, env(safe-area-inset-bottom)) + 3.8rem);
    max-height: calc(100dvh - 4.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* Même adaptation tactile pour une tablette en mode presque carré. */
@media (min-width:701px) and (max-width:1100px) and (max-aspect-ratio:5/4){
  body.photos-page #btnTogglePhotoFilters {
    position: fixed;
    right: .8rem;
    bottom: calc(max(.8rem, env(safe-area-inset-bottom)) + .48rem);
    z-index: 190;
    margin: 0;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 0;
    gap: 0;
  }
  body.photos-page #btnTogglePhotoFilters i { display: grid; width: 1em; height: 1em; place-items: center; line-height: 1; font-size: 1rem; }
  body.photos-page .photo-filter-panel {
    top: auto;
    right: .8rem;
    bottom: calc(max(.8rem, env(safe-area-inset-bottom)) + 3.8rem);
    max-height: calc(100dvh - 4.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}
