/* ================================================================
   PhotoGallery — Feuille de style principale
   Thème sombre moderne avec glassmorphisme
================================================================ */

/* ----------------------------------------------------------------
   Variables CSS
---------------------------------------------------------------- */
:root {
  /* Couleurs de fond — thème sombre slate/navy, nettement plus lisible */
  --bg-base:        #111827;   /* slate-900 : sombre mais pas noir pur */
  --bg-surface:     #1a2438;   /* bleu-ardoise foncé */
  --bg-card:        #1f2d45;   /* carte avec légère teinte bleue */
  --bg-card-hover:  #263554;   /* survol légèrement plus clair */
  --bg-glass:       rgba(26, 36, 56, 0.92);
  --bg-overlay:     rgba(0, 0, 0, 0.70);
  --success-dim:    rgba(16, 185, 129, 0.12);

  /* Couleurs primaires */
  --primary:        #6366f1;
  --primary-light:  #818cf8;
  --primary-dark:   #4f46e5;
  --primary-glow:   rgba(99, 102, 241, 0.20);

  /* Couleurs secondaires */
  --secondary:      #a855f7;
  --accent:         #ec4899;

  /* Textes — contraste nettement amélioré */
  --text-primary:   #f0f4f8;   /* quasi-blanc, très lisible */
  --text-secondary: #b8cce0;   /* gris-bleu clair, lisible */
  --text-muted:     #8ea3c2;   /* clair mais garde le rôle "secondaire" */

  /* Bordures */
  --border:         rgba(255, 255, 255, 0.10);
  --border-hover:   rgba(255, 255, 255, 0.16);
  --border-focus:   rgba(99, 102, 241, 0.55);

  /* États */
  --success:  #10b981;
  --warning:  #f59e0b;
  --error:    #ef4444;
  --info:     #0ea5e9;

  /* Dimensions */
  --sidebar-w:    280px;
  --topbar-h:     64px;
  --radius-xs:    4px;
  --radius-sm:    6px;
  --radius-md:    12px;
  --radius-lg:    18px;
  --radius-full:  9999px;

  /* Ombres — adoucies (backgrounds plus clairs) */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.25);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.35);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.50);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.20);

  /* Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.4s ease;

  /* Échelle d'espacement */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  /* Échelle typographique */
  --text-xs:   11px;
  --text-sm:   12px;
  --text-md:   13px;
  --text-base: 14px;
  --text-lg:   16px;
  --text-xl:   20px;
  --text-2xl:  24px;
  --text-3xl:  32px;
}

/* ----------------------------------------------------------------
   Thème clair — mêmes noms de variables, valeurs adaptées.
   Activé via [data-theme="light"] sur <html> (cf. thème dans app.js).
   --bg-overlay volontairement non redéfini : le fond du lightbox reste
   sombre dans les deux thèmes (meilleure lecture des photos).
---------------------------------------------------------------- */
[data-theme="light"] {
  --bg-base:        #f4f6fb;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-card-hover:  #eef1f8;
  --bg-glass:       rgba(255, 255, 255, 0.85);
  --success-dim:    rgba(16, 185, 129, 0.10);

  --primary-glow:   rgba(99, 102, 241, 0.12);

  --text-primary:   #0f172a;
  --text-secondary: #47536b;
  --text-muted:     #6b7891;

  --border:         rgba(15, 23, 42, 0.10);
  --border-hover:   rgba(15, 23, 42, 0.16);
  --border-focus:   rgba(99, 102, 241, 0.55);

  --shadow-sm:   0 2px 8px rgba(15,23,42,0.06);
  --shadow-md:   0 6px 20px rgba(15,23,42,0.08);
  --shadow-lg:   0 12px 40px rgba(15,23,42,0.12);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
}

/* ----------------------------------------------------------------
   Reset & Base
---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Supprime le flash bleu au tap sur iOS/Android */
* { -webkit-tap-highlight-color: transparent; }

/* html + body en hauteur fixe : le scroll se fait dans .content-area, pas dans la page */
/* 100dvh = dynamic viewport height (exclut la barre d'adresse mobile) */
html {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-base);
  color-scheme: dark;
}
[data-theme="light"] {
  color-scheme: light;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  display: flex;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }

button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, select, textarea { font-family: inherit; }

img { max-width: 100%; display: block; }

/* Anneau de focus clavier cohérent — les quelques champs qui gèrent déjà
   leur propre style de focus (border-color/box-shadow) le redéfinissent
   plus loin et prennent le dessus. */
:focus-visible {
  outline: 2.5px solid var(--primary-light);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Respecte la préférence système de réduction des animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ----------------------------------------------------------------
   Sidebar
---------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 200;
  transition: width var(--transition-slow), transform var(--transition-slow);
  overflow: hidden;
  overscroll-behavior: contain;
}

.sidebar.collapsed {
  width: 68px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.logo-icon i { color: white; width: 18px; height: 18px; }

.logo-text {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-slow);
}

.sidebar.collapsed .logo-text { opacity: 0; pointer-events: none; }

.sidebar-toggle {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.sidebar-toggle:hover { background: var(--bg-card); color: var(--text-primary); }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }
.sidebar-toggle i { transition: transform var(--transition-slow); }

/* Nav */
.sidebar-nav {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item i { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item span { transition: opacity var(--transition-slow); }
.sidebar.collapsed .nav-item span { opacity: 0; }

.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active {
  background: var(--primary-glow);
  color: var(--primary-light);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

/* Wrapper scrollable (nav + albums + tags) */
.sidebar-scroll {
  flex: 1;
  min-height: 0;        /* indispensable pour que flex:1 soit contraint */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Sections sidebar */
.sidebar-section {
  padding: 12px 8px 8px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 8px 6px;
  white-space: nowrap;
  transition: opacity var(--transition-slow);
}
/* En mode réduit : masque les sections albums/tags mais garde la nav (icônes seules) */
.sidebar.collapsed .sidebar-section { display: none; }
.sidebar.collapsed .sidebar-scroll { overflow: hidden; }

/* ----------------------------------------------------------------
   Vignette/texte d'album ou de photo réutilisés par le widget
   "Top 10" du tableau de bord admin (dashboard.js)
---------------------------------------------------------------- */
.album-nav-thumb {
  width: 28px; height: 28px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-card);
}

.album-nav-info { overflow: hidden; flex: 1; }
.album-nav-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-nav-count { font-size: 11px; color: var(--text-muted); }

/* Tags cloud */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 4px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  border: 1.5px solid currentColor;
  letter-spacing: 0.02em;
}
.tag-chip:hover { opacity: 0.75; transform: translateY(-1px); }

/* Top 10 des photos/albums les plus vus (sidebar + dashboard admin) */
.top-viewed-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-viewed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.top-viewed-item:hover { background: var(--bg-card); }

/* Pastille de classement — dorée/argentée/bronze pour le podium, neutre ensuite */
.top-viewed-rank {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  background: var(--bg-card-hover);
  color: var(--text-muted);
}
.top-viewed-rank.rank-1 {
  background: linear-gradient(135deg, #ffd75e, #f59e0b);
  color: #3a2400;
}
.top-viewed-rank.rank-2 {
  background: linear-gradient(135deg, #e4e9f2, #a7b3c4);
  color: #24303f;
}
.top-viewed-rank.rank-3 {
  background: linear-gradient(135deg, #e3a874, #b3703f);
  color: #351d0a;
}

/* Vignette + texte, agrandis et un peu plus respirants que l'arbre d'albums
   dont ce composant réutilise les classes (.album-nav-thumb/-info/-name/-count) */
.top-viewed-item .album-nav-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.top-viewed-item .album-nav-name { color: var(--text-secondary); }
.top-viewed-item:hover .album-nav-name { color: var(--text-primary); }
.top-viewed-item .album-nav-count {
  display: flex;
  align-items: center;
  margin-top: 2px;
}

/* ----------------------------------------------------------------
   Tableau de bord admin (statistiques)
---------------------------------------------------------------- */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.stat-card-icon {
  width: 40px; height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--primary-glow);
  color: var(--primary-light);
}
.stat-card-icon i { width: 20px; height: 20px; }

.stat-card-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-card-label { font-size: 12px; color: var(--text-muted); }

.stats-chart-section {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.stats-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.stats-chart-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.stats-granularity-switcher {
  display: flex;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.stats-gran-btn {
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.stats-gran-btn:hover { color: var(--text-primary); }
.stats-gran-btn.active { background: var(--primary-glow); color: var(--primary-light); }

.stats-chart-wrapper {
  position: relative;
  height: 320px;
}

.stats-top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.stats-top-block {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

@media (max-width: 768px) {
  .stats-chart-wrapper { height: 260px; }
}

/* Footer sidebar — reste collé en bas naturellement grâce à .sidebar-scroll { flex:1 } */
.sidebar-footer {
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar.collapsed .sidebar-footer .btn span { display: none; }

/* Skeletons */
.skeleton-list { display: flex; flex-direction: column; gap: 6px; padding: 4px; }
.skeleton-item {
  height: 32px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ----------------------------------------------------------------
   Main content
---------------------------------------------------------------- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ----------------------------------------------------------------
   Navigation mobile (barre du bas)
   Masquée par défaut — activée uniquement ≤768px (voir media query
   plus bas). Réutilise .nav-item pour hériter la liaison de clic et
   la logique d'état actif déjà écrites dans app.js.
---------------------------------------------------------------- */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  min-height: 60px; /* doit rester cohérent avec --bottom-nav-h (réservation d'espace dans .content-area) */
  z-index: 450; /* sous le tiroir (500) et le fond assombri (499), au-dessus du contenu */
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav .bottom-nav-item {
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px 6px;
  border-radius: 0;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.bottom-nav .bottom-nav-item i { width: 21px; height: 21px; }
/* Cible tactile confortable : occupe toute la hauteur du bouton, pas seulement l'icône */
.bottom-nav .bottom-nav-item span { line-height: 1.2; }

.bottom-nav .bottom-nav-item.active { color: var(--primary-light); }
/* La sidebar utilise un liseré à gauche (::before) — inadapté ici, on désactive */
.bottom-nav .bottom-nav-item.active::before { display: none; }
.bottom-nav .bottom-nav-item:active { background: var(--bg-card); }

/* ----------------------------------------------------------------
   Topbar
---------------------------------------------------------------- */
.topbar {
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;   /* aligne les boutons en bas du topbar élargi */
  gap: 12px;
  padding: env(safe-area-inset-top, 0px) 20px 0;
  padding-bottom: 0;
  flex-shrink: 0;
  z-index: 300;
  position: sticky;
  top: 0;
}

.menu-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: none;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}
.menu-btn:hover { background: var(--bg-card); color: var(--text-primary); }

/* Recherche */
.search-container {
  flex: 1;
  /* Sans ça, un flex-item ne peut jamais rétrécir sous sa largeur intrinsèque :
     sur petit écran, avec les boutons d'action à largeur fixe à côté, la barre
     de recherche pousserait la topbar en overflow horizontal au lieu de rétrécir. */
  min-width: 0;
  position: relative;
  max-width: 640px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.search-icon { color: var(--text-muted); width: 16px; height: 16px; flex-shrink: 0; }

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  padding: 10px 0;
}
.search-input::placeholder { color: var(--text-muted); }

.search-filter-btn, .search-clear {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.search-filter-btn:hover, .search-clear:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.search-filter-btn.active { color: var(--primary-light); }

/* Panneau filtres */
.filters-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: fadeDown 0.15s ease;
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.filter-group-full { grid-column: 1 / -1; }

.filter-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.filter-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}
.filter-input:focus { border-color: var(--border-focus); }

.filters-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Actions topbar droite */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.view-switcher {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-btn {
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.view-btn:hover { color: var(--text-primary); }
.view-btn.active { background: var(--primary-glow); color: var(--primary-light); }
.view-btn i { width: 15px; height: 15px; }

.sort-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}
.sort-select:focus { border-color: var(--border-focus); }
/* Caché par défaut, affiché uniquement en mobile via media query */
.sort-select-mobile { display: none; }
/* Doublon compact du sélecteur mosaïque/grille/liste — cf. #viewSwitcherTop, masqué en mobile faute de place */
.view-switcher-mobile { display: none; }

/* ----------------------------------------------------------------
   Thème clair / sombre
---------------------------------------------------------------- */
.theme-toggle {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.theme-toggle:hover { background: var(--bg-card); color: var(--text-primary); }
.theme-toggle i { width: 18px; height: 18px; }
.theme-toggle .theme-icon-dark  { display: none; }
.theme-toggle .theme-icon-light { display: block; }
[data-theme="light"] .theme-toggle .theme-icon-light { display: none; }
[data-theme="light"] .theme-toggle .theme-icon-dark  { display: block; }

/* ----------------------------------------------------------------
   Sélecteur de langue
---------------------------------------------------------------- */
.lang-select-wrapper {
  display: flex;
  align-items: center;
}
.lang-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
  min-width: 72px;
}
.lang-select:focus,
.lang-select:hover { border-color: var(--border-focus); color: var(--text-primary); }

/* ----------------------------------------------------------------
   Zone de contenu
---------------------------------------------------------------- */
.content-area {
  flex: 1;
  min-height: 0;    /* indispensable : sans ça, min-height:auto empêche overflow-y de scroller */
  overflow-y: auto;
  padding: 24px;
  -webkit-overflow-scrolling: touch;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.view-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.photo-count {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

/* ----------------------------------------------------------------
   Galerie — disposition mosaïque
---------------------------------------------------------------- */
.gallery {
  column-gap: 12px;
}

/* Layout masonry */
.gallery[data-layout="masonry"] {
  columns: 4;
  column-fill: balance;
}

/* Layout grille */
.gallery[data-layout="grid"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

/* Layout liste */
.gallery[data-layout="list"] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ================================================================
   Barre de sélection multiple (admin)
================================================================ */
.selection-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(20px + env(safe-area-inset-left, 0px));
  padding-right: calc(20px + env(safe-area-inset-right, 0px));
  background: var(--bg-surface);
  border-top: 1px solid var(--primary);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.35);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.selection-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.selection-bar-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* Carte en mode sélection */
.gallery.selection-mode .photo-card { cursor: default; }
.gallery.selection-mode .photo-card:active { transform: none; }

/* Checkbox de sélection sur chaque carte */
.photo-select-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.45);
  border: 2px solid rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  pointer-events: none;
}
.photo-select-check svg { display: none; width: 13px; height: 13px; color: #fff; }

/* Carte sélectionnée */
.photo-card.selected .photo-select-check {
  background: var(--primary);
  border-color: var(--primary);
}
.photo-card.selected .photo-select-check svg { display: block; }
.photo-card.selected {
  outline: 2.5px solid var(--primary);
  outline-offset: -2px;
}
.photo-card.selected .photo-img { opacity: 0.75; }

/* Ajustement bas de page quand la barre est visible */
body.selection-active #contentArea {
  padding-bottom: 68px;
}

/* Photo card */
.photo-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--bg-card);
  user-select: none;
  -webkit-user-select: none;
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  break-inside: avoid;
  margin-bottom: 12px;
}

.gallery[data-layout="masonry"] .photo-card { display: inline-block; width: 100%; }
.gallery[data-layout="grid"] .photo-card    { margin-bottom: 0; }
.gallery[data-layout="list"]  .photo-card  {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px;
  margin-bottom: 0;
  border-radius: var(--radius-sm);
}

.photo-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.photo-img-wrapper {
  position: relative;
  overflow: hidden;
  background: var(--bg-card-hover);
}

.gallery[data-layout="list"] .photo-img-wrapper {
  width: 70px; height: 70px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.photo-img {
  width: 100%;
  display: block;
  transition: transform 0.4s ease;
  object-fit: cover;
}

.gallery[data-layout="list"] .photo-img { height: 70px; }
.gallery[data-layout="grid"] .photo-img { height: 200px; object-fit: cover; }

.photo-card:hover .photo-img { transform: scale(1.04); }

/* ================================================================
   Photo à la une (accueil) — bannière aléatoire au-dessus de la grille
================================================================ */
.featured-hero {
  position: relative;
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.featured-hero-link {
  position: relative;
  display: block;
  color: inherit;
}

.featured-hero-img {
  width: 100%;
  height: 340px;
  object-fit: cover;
  display: block;
  background: var(--bg-card);
}

.featured-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.80) 0%, rgba(0,0,0,0.25) 55%, transparent 85%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px 24px;
  /* Le contenu de l'overlay est décoratif : les clics doivent atteindre le lien parent */
  pointer-events: none;
}

.featured-hero-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(99, 102, 241, 0.85);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
}
.featured-hero-badge i { width: 12px; height: 12px; }

.featured-hero-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.featured-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.featured-hero-shuffle {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.featured-hero-shuffle:hover { background: rgba(15, 23, 42, 0.85); transform: rotate(90deg); }
.featured-hero-shuffle i { width: 18px; height: 18px; }

@media (max-width: 768px) {
  .featured-hero-img   { height: 220px; }
  .featured-hero-title { font-size: 17px; }
}

/* Overlay au survol */
.photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 40%,
    rgba(0,0,0,0.75) 100%
  );
  opacity: 0;
  transition: opacity var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  /* Laisse passer les clics/taps vers .photo-card — le contenu est purement décoratif.
     Critique sur iOS Safari : sans ça le tap sur l'overlay ne remonte pas à la carte. */
  pointer-events: none;
}

.photo-card:hover .photo-overlay { opacity: 1; }

.gallery[data-layout="list"] .photo-overlay { display: none; }

.overlay-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.overlay-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overlay-meta {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  margin-top: 2px;
}

.overlay-meta i { width: 11px; height: 11px; vertical-align: middle; }

/* Boutons d'action sur les cartes photos (déplacer / supprimer) */
.photo-card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 3;
}
.photo-card:hover .photo-card-actions { opacity: 1; }

/* En mode sélection multiple : masque les boutons d'action pour éviter les conflits */
body.selection-active .photo-card-actions { opacity: 0 !important; pointer-events: none !important; }

/* En vue liste, les actions sont toujours visibles à droite */
.gallery[data-layout="list"] .photo-card-actions {
  position: static;
  opacity: 1;
  margin-left: auto;
  padding-right: 8px;
}

/* Infos en liste */
.photo-list-info { flex: 1; overflow: hidden; }
.photo-list-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-list-meta  { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 12px; }
.photo-list-tags  { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }

/* Petit tag dans les cartes */
.mini-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1.5px solid currentColor;
}

/* Badge GPS */
.gps-badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  background: rgba(0,0,0,0.6);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  backdrop-filter: blur(4px);
}
.gps-badge i { width: 12px; height: 12px; }

/* ----------------------------------------------------------------
   Albums grid
---------------------------------------------------------------- */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.album-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  user-select: none;
  -webkit-user-select: none;
}

.album-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.album-cover {
  height: 180px;
  background: var(--bg-card-hover);
  overflow: hidden;
  position: relative;
}

.album-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.album-card:hover .album-cover img { transform: scale(1.06); }

.album-cover-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-card-hover));
  color: var(--text-muted);
}
.album-cover-placeholder i { width: 48px; height: 48px; opacity: 0.4; }

.album-info {
  padding: 14px 16px;
}

.album-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.album-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ----------------------------------------------------------------
   Tags grid
---------------------------------------------------------------- */
.tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.tag-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
}

.tag-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.tag-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tag-card-name { font-weight: 500; font-size: 14px; }
.tag-card-count { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ----------------------------------------------------------------
   Carte
---------------------------------------------------------------- */
.map-container {
  height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px) - 80px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

#photoMap {
  width: 100%; height: 100%;
}

/* ----------------------------------------------------------------
   Pagination
---------------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 32px;
  padding: 16px 0;
}

.page-btn {
  min-width: 36px; height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 12px rgba(99,102,241,0.4);
}
.page-btn:disabled { opacity: 0.3; pointer-events: none; }

/* ----------------------------------------------------------------
   État vide & Loader
---------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.empty-state i { width: 64px; height: 64px; margin: 0 auto 16px; opacity: 0.3; }
.empty-state p { font-size: 16px; margin-bottom: 6px; color: var(--text-secondary); }
.empty-state small { font-size: 13px; }

.loader {
  display: flex;
  justify-content: center;
  padding: 60px 0;
}
.loader.hidden { display: none; }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------
   Lightbox
---------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex !important;
  align-items: stretch;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox[style*="display:none"],
.lightbox[style*="display: none"] { display: none !important; }

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(8px);
}

.lightbox-content {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Stage image */
.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 60px 80px;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  animation: zoomIn 0.2s ease;
  user-select: none;
}

@keyframes zoomIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.lightbox-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Boutons navigation */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
  backdrop-filter: blur(4px);
}
.lightbox-nav:hover { background: rgba(255,255,255,0.18); }
.lightbox-nav.prev { left: max(16px, env(safe-area-inset-left, 16px)); }
.lightbox-nav.next { right: max(16px, env(safe-area-inset-right, 16px)); }
.lightbox-nav i { width: 22px; height: 22px; }
.lightbox-nav:disabled { opacity: 0.2; pointer-events: none; }

/* Bouton infos — masqué sur desktop, fixed sur mobile */
.lightbox-info-btn {
  display: none;
}

/* Fermer */
.lightbox-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top, 16px)); right: max(16px, env(safe-area-inset-right, 16px));
  z-index: 20;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  backdrop-filter: blur(4px);
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* Panneau infos */
.lightbox-panel {
  width: 340px;
  background: var(--bg-glass);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition: width var(--transition-slow), height var(--transition-slow);
}

/* Desktop : collapsed = largeur 0 */
.lightbox-panel.collapsed { width: 0; overflow: hidden; }

.panel-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
}

.panel-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition-slow);
}
.panel-close:hover { background: var(--bg-card); color: var(--text-primary); }
.lightbox-panel.collapsed .panel-close i { transform: rotate(180deg); }

.panel-title {
  font-size: 16px;
  font-weight: 600;
  padding-right: 32px;
  color: var(--text-primary);
}

.panel-album {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Ligne partage dans le header du panneau */
.panel-share-row {
  margin-top: 12px;
  display: flex;
  gap: 6px;
}
.panel-share-btn {
  font-size: 11px;
  padding: 4px 10px;
  gap: 5px;
  color: var(--text-secondary);
  border-color: var(--border);
}
.panel-share-btn:hover {
  color: var(--primary-light);
  border-color: var(--primary-light);
  background: var(--primary-glow);
}
.panel-share-btn.copied {
  color: var(--success) !important;
  border-color: var(--success) !important;
  background: rgba(34,197,94,.12) !important;
}
.panel-share-btn i { width: 12px; height: 12px; }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.panel-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-section:last-child { border-bottom: none; }

/* Édition description/tags (admin) — textarea/input réutilisent .form-control,
   affichés à la place du texte en lecture seule pendant l'édition. */
#lightboxDescInput { margin-top: 8px; resize: vertical; }
#lightboxTagsInput { margin-top: 8px; }

.panel-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

/* Section actions dans le panneau lightbox */
.panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
.panel-actions .btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  min-width: unset;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.panel-actions .btn span { display: none; }
.panel-actions .btn svg  { width: 14px; height: 14px; flex-shrink: 0; }
/* Supprimer poussé à droite */
.panel-actions #lightboxDeleteBtn { margin-left: auto; }

.panel-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.panel-section-title i { width: 13px; height: 13px; }

/* Tags dans lightbox */
.tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid currentColor;
  letter-spacing: 0.02em;
}

/* EXIF */
.exif-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.exif-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.exif-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.exif-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exif-camera {
  grid-column: 1 / -1;
}

/* Localisation lightbox */
.location-address {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.map-preview {
  height: 180px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.photo-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ----------------------------------------------------------------
   Modals
---------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[style*="display:none"], .modal[style*="display: none"] { display: none !important; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

.modal-sm { max-width: 420px; }
.modal-md { max-width: 620px; }

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-header h2 i { width: 18px; height: 18px; color: var(--primary-light); }

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.modal-body { padding: 24px; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Formulaires */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; }

/* ----------------------------------------------------------------
   Combobox album (arborescence + autocomplétion) — modal "Déplacer"
---------------------------------------------------------------- */
.album-combobox { position: relative; }

.album-combobox-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  -webkit-overflow-scrolling: touch;
}

.album-combobox-item {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.album-combobox-item:hover,
.album-combobox-item.highlighted {
  background: var(--primary-glow);
  color: var(--primary-light);
}

.album-combobox-indent {
  color: var(--text-muted);
  white-space: pre;
}

.album-combobox-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-muted);
}

/* .modal-body a overflow-y:auto (pour les modals à contenu long) : ça
   rognerait la liste déroulante de la combobox si elle dépasse la hauteur
   du corps de CE modal-ci, dont le contenu tient toujours en une vue. */
#movePhotoModal .modal-body { overflow: visible; }
#bulkTagsModal  .modal-body { overflow: visible; }

/* ----------------------------------------------------------------
   Saisie de tags par puces (modal "Ajout de tags en masse")
---------------------------------------------------------------- */
.tag-input-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.tag-input-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.tag-input-box input {
  flex: 1;
  min-width: 100px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-primary);
  padding: 4px;
}

.tag-input-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid currentColor;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
/* Tag pas encore existant : sera créé à la soumission — bordure pointillée
   pour prévenir visuellement l'utilisateur avant l'envoi. */
.tag-input-chip.is-new { border-style: dashed; }

.tag-input-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  opacity: .7;
}
.tag-input-chip button:hover { opacity: 1; }
.tag-input-chip button i { width: 12px; height: 12px; }

.album-combobox-item.bulk-tags-create {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--primary-light);
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  margin-bottom: 20px;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-glow);
}
.upload-icon {
  width: 42px; height: 42px;
  color: var(--text-muted);
  margin: 0 auto 12px;
  display: block;
}
.upload-zone p { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.upload-zone small { font-size: 12px; color: var(--text-muted); display: block; margin: 3px 0; }
.upload-hint { color: var(--text-muted) !important; }

.link-btn {
  color: var(--primary-light);
  text-decoration: underline;
  font-size: inherit;
}

.upload-config { margin-bottom: 16px; }

/* File queue */
.upload-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.queue-item-icon { width: 32px; height: 32px; border-radius: var(--radius-xs); object-fit: cover; flex-shrink: 0; }
.queue-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item-size { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.queue-item-status { width: 16px; height: 16px; flex-shrink: 0; }
.queue-item-status.ok { color: var(--success); }
.queue-item-status.err { color: var(--error); }
.queue-item-status.loading i { animation: spin 0.8s linear infinite; }

.upload-progress { margin-top: 12px; }

.progress-bar {
  height: 6px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.3s ease;
}

#progressText { font-size: 12px; color: var(--text-muted); }

/* ----------------------------------------------------------------
   Boutons
---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn i { width: 15px; height: 15px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-light); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.btn-primary:disabled { opacity: 0.4; pointer-events: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-danger {
  background: var(--error);
  color: #fff;
  border: none;
}
.btn-danger:hover { background: #dc2626; box-shadow: 0 4px 12px rgba(239,68,68,0.35); }
.btn-danger:disabled { opacity: 0.4; pointer-events: none; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; }

/* ----------------------------------------------------------------
   Clé API — champ avec boutons intégrés
---------------------------------------------------------------- */
.apikey-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.apikey-input-row .form-control { flex: 1; font-family: monospace; font-size: 13px; }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-icon i { width: 15px; height: 15px; }
.btn-icon.copied { color: var(--success); border-color: var(--success); }

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.apikey-status {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-left: 6px;
  vertical-align: middle;
}
.apikey-status.found    { background: var(--success-dim, #10b98122); color: var(--success); }
.apikey-status.notfound { background: #f59e0b22; color: #f59e0b; }
.apikey-status.loading  { background: var(--bg-card); color: var(--text-muted); }
.apikey-status.error    { background: #ef444422; color: var(--error, #ef4444); }

/* Modal clé API générée */
.apikey-success-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(168,85,247,0.12));
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
}
.apikey-success-banner i { width: 28px; height: 28px; color: var(--primary-light); flex-shrink: 0; margin-top: 2px; }
.apikey-success-banner strong { display: block; font-size: 15px; margin-bottom: 4px; }
.apikey-success-banner p { font-size: 13px; color: var(--text-secondary); }

.apikey-mono { font-family: 'Courier New', monospace !important; letter-spacing: 0.04em; }

.apikey-usage-example {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 12px;
}
.apikey-usage-example code {
  display: block;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: var(--primary-light);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.7;
}

/* ----------------------------------------------------------------
   Toasts
---------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: slideInRight 0.25s ease;
  font-size: 13px;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.toast.leaving {
  animation: slideOutRight 0.25s ease forwards;
}

@keyframes slideOutRight {
  to { transform: translateX(110%); opacity: 0; }
}

.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--error); }
.toast.info    .toast-icon { color: var(--info); }
.toast.warning .toast-icon { color: var(--warning); }

.toast-msg { flex: 1; line-height: 1.4; }

/* ================================================================
   RESPONSIVE — compatibilité mobile complète
================================================================ */

/* ≤ 1200px ─ Grands tablettes / petits laptops */
@media (max-width: 1200px) {
  .gallery[data-layout="masonry"] { columns: 3; }
}

/* ≤ 900px ─ Tablettes */
@media (max-width: 900px) {
  .gallery[data-layout="masonry"] { columns: 2; }

  .lightbox-panel {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    z-index: 10;
    box-shadow: var(--shadow-lg);
  }
}

/* ≤ 1150px ─ La sidebar (280px) + tous les contrôles desktop de la topbar
   (recherche, thème, langue, connexion, vue, tri, diaporama) ne tiennent
   plus sur une seule ligne : recherche se retrouve écrasée à quelques
   pixels et le reste chevauche. Même filet de sécurité que ≤768px (la
   topbar s'empile sur 2 lignes), mais sans toucher au reste du mobile
   (sidebar en tiroir, bottom-nav, etc.), qui ne commence qu'à 768px. */
@media (max-width: 1150px) and (min-width: 769px) {
  .topbar {
    height: auto;
    min-height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    flex-wrap: wrap;
    row-gap: 8px;
    padding-bottom: 8px;
    align-items: center;
  }
  .topbar-actions {
    flex-basis: 100%;
    flex-wrap: wrap;
    flex-shrink: 1;
    row-gap: 8px;
    justify-content: flex-end;
  }
}

/* ≤ 768px ─ Mobile paysage / petite tablette */
@media (max-width: 768px) {
  :root { --topbar-h: 56px; --bottom-nav-h: 60px; }

  /* Sidebar en tiroir */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 500;
    width: min(var(--sidebar-w), 85vw);
    transition: transform var(--transition-slow);
    box-shadow: none;
    /* Décale le contenu de la sidebar si le notch est à gauche (paysage) */
    padding-left: env(safe-area-inset-left, 0px);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  /* Backdrop semi-transparent derrière la sidebar */
  body.sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 499;
  }

  /* Hamburger visible, toggle-collapse masqué */
  .menu-btn        { display: flex; }
  .sidebar-toggle  { display: none; }

  /* Topbar : masque le tri et le nom utilisateur (espace limité) */
  .sort-select-wrapper { display: none; }
  .user-display-name   { display: none; }
  .user-chevron        { display: none; }

  /* Prévient le zoom iOS sur les inputs (font-size < 16px → zoom) */
  .search-input,
  .form-control,
  .filter-input,
  select,
  textarea {
    font-size: 16px;
  }

  /* Sélecteur de tri mobile (visible seulement ≤ 768px) */
  .sort-select-mobile {
    display: block;
    font-size: 13px;
    padding: 5px 8px;
  }

  /* Panneau filtres pleine largeur, 1 colonne */
  .filters-panel { left: 0; right: 0; }
  .filters-grid  { grid-template-columns: 1fr; }

  /* Zone de contenu */
  .content-area { padding: 16px; }

  /* En-tête de vue */
  .view-header { flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
  .view-title  { font-size: 18px; }

  /* Galerie */
  .gallery[data-layout="masonry"] { columns: 2; column-gap: 8px; }
  .gallery[data-layout="grid"] {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
  }
  .gallery[data-layout="grid"] .photo-img { height: 150px; }
  .photo-card { margin-bottom: 8px; }

  /* Albums / tags */
  .albums-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
  .tags-grid   { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

  /* Lightbox — bottom sheet sur tout mobile */

  /* Panneau caché par défaut — s'affiche avec .panel-open ajouté par JS */
  .lightbox-panel {
    display: none;
    width: 100%;
    max-width: 100%;
    position: absolute;
    left: 0; right: 0;
    bottom: 0; top: auto;
    height: 56%;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 10;
    overflow: hidden;
  }
  .lightbox-panel.panel-open {
    display: flex;
  }

  /* Stage : réserve la place du panneau quand il est ouvert */
  .lightbox-stage         { padding: 48px 16px 8%; }
  .lightbox-stage.panel-open { padding-bottom: 58%; }
  .lightbox-nav   { width: 40px; height: 40px; }
  .lightbox-nav.prev { left: max(8px, env(safe-area-inset-left, 8px)); }
  .lightbox-nav.next { right: max(8px, env(safe-area-inset-right, 8px)); }
  .lightbox-close { top: max(8px, env(safe-area-inset-top, 8px)); right: max(8px, env(safe-area-inset-right, 8px)); width: 36px; height: 36px; }

  /* Bouton info : position fixed sur mobile — rien ne peut le couvrir */
  .lightbox-info-btn {
    display: flex;
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    right: calc(24px + env(safe-area-inset-right, 0px));
    z-index: 1010;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(20, 20, 40, 0.80);
    border: 2px solid rgba(255, 255, 255, 0.30);
    color: #fff;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    transition: background var(--transition), border-color var(--transition);
    cursor: pointer;
    font-family: inherit;
  }
  .lightbox-info-btn i { width: 22px; height: 22px; }
  .lightbox-info-btn:active { background: rgba(99, 102, 241, 0.70); }
  .lightbox-info-btn.panel-open {
    background: rgba(99, 102, 241, 0.75);
    border-color: var(--primary-light);
  }

  /* Modals : feuille bas de page */
  .modal { padding: 0; align-items: flex-end; }
  .modal-content {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  @keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* Formulaires : colonnes en une seule colonne */
  .form-row { flex-direction: column; gap: 0; }

  /* Tableau admin scrollable tactile */
  .users-table-wrap { -webkit-overflow-scrolling: touch; }

  /* Toasts centrés en bas (pas hors écran à droite) — au-dessus de la bottom-nav */
  .toast-container {
    left: 16px;
    right: 16px;
    bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom, 0px));
    align-items: stretch;
  }
  .toast { min-width: 0; width: 100%; }
  @keyframes slideInRight {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  @keyframes slideOutRight {
    to { transform: translateY(16px); opacity: 0; }
  }

  /* Safe area — paddings pour encoche/Dynamic Island, + hauteur de la bottom-nav */
  .content-area {
    padding-bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom, 0px));
    padding-left: calc(16px + env(safe-area-inset-left, 0px));
    padding-right: calc(16px + env(safe-area-inset-right, 0px));
  }

  /* Barre de navigation mobile (bottom-nav) */
  .bottom-nav {
    display: flex;
    align-items: stretch;
  }

  /* Corrige le bug d'origine : cette classe était référencée en HTML (bouton
     Diaporama) sans jamais être définie — le libellé restait visible et
     participait à la saturation de la topbar sur petit écran. */
  .hide-mobile { display: none; }

  /* Le sélecteur mosaïque/grille/liste de la topbar n'a plus la place ;
     un doublon compact est affiché dans l'en-tête de la vue à la place
     (#viewSwitcherMobile, cf. règle .view-switcher-mobile plus haut). */
  #viewSwitcherTop     { display: none; }
  .view-switcher-mobile { display: inline-flex; }

  /* Filet de sécurité : si un élément de la topbar n'est pas masqué comme prévu
     (icône manquante, contenu long, ancien cache…), il passe à la ligne au lieu
     de chevaucher ses voisins. .topbar avait une hauteur fixe + nowrap, et
     .topbar-actions un flex-shrink:0 : sur un écran étroit avec tous les
     contrôles desktop encore présents, ça les forçait à se tasser/superposer
     plutôt qu'à s'empiler proprement.
     Rangée 1 = hamburger + recherche (la recherche rétrécit grâce à min-width:0).
     Rangée 2 = tout le reste (langue, connexion, tri, diaporama…), en dessous,
     qui se met elle-même sur plusieurs lignes si besoin. */
  .topbar {
    height: auto;
    min-height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    flex-wrap: wrap;
    row-gap: 8px;
    padding-bottom: 8px;
    align-items: center;
  }
  .topbar-actions {
    flex-basis: 100%;
    flex-wrap: wrap;
    flex-shrink: 1;
    row-gap: 8px;
    justify-content: flex-end;
  }
}

/* ≤ 480px ─ Smartphones portrait */
@media (max-width: 480px) {
  /* Galerie */
  .gallery[data-layout="masonry"] { columns: 1; }
  .gallery[data-layout="grid"]    { grid-template-columns: 1fr 1fr; gap: 6px; }
  .gallery[data-layout="grid"] .photo-img { height: 120px; }

  /* Albums */
  .albums-grid    { grid-template-columns: 1fr; }
  .subalbums-grid { grid-template-columns: 1fr 1fr !important; }
  .subalbums-grid .album-cover { height: 100px; }

  /* Topbar — le shorthand ne doit pas écraser le padding-bottom ajouté par la
     media query ≤768px (respiration sous la 2e ligne quand ça wrap). */
  .topbar     { padding: env(safe-area-inset-top, 0px) 12px 8px; gap: 8px; }
  .view-title { font-size: 16px; }

  /* Contenu — le shorthand ci-dessous ne doit pas écraser la réservation
     d'espace pour la bottom-nav faite par la media query ≤768px (même propriété,
     mais celle-ci est déclarée après dans la feuille de style donc prioritaire). */
  .content-area {
    padding: 12px;
    padding-bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom, 0px));
  }

  /* Lightbox petits téléphones : ajustements fins */
  .lightbox-stage              { padding: 44px 8px 6%; }
  .lightbox-stage.panel-open   { padding-bottom: 60%; }
  .lightbox-panel              { height: 60%; }

  /* Boutons nav */
  .lightbox-nav      { top: 25%; width: 36px; height: 36px; }
  .lightbox-nav i    { width: 18px; height: 18px; }
  .lightbox-nav.prev { left: max(4px, env(safe-area-inset-left, 4px)); }
  .lightbox-nav.next { right: max(4px, env(safe-area-inset-right, 4px)); }

  /* Boutons de pagination */
  .page-btn { min-width: 32px; height: 32px; padding: 0 8px; font-size: 12px; }

  /* Actions en-tête de vue */
  .view-header-actions { gap: 6px; flex-wrap: wrap; }
}

/* ──────────────────────────────────────────────────────────────
   Appareils tactiles — actions toujours visibles (hover absent)
────────────────────────────────────────────────────────────── */
@media (hover: none) {
  /* Boutons d'action sur les cartes */
  .photo-card-actions { opacity: 1; }
  .album-card-actions { opacity: 1; }
  .tag-card-actions   { opacity: 1; }

  /* Overlay photo : gradient bas toujours visible */
  .photo-overlay {
    opacity: 1;
    background: linear-gradient(to bottom, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
  }

  /* Cibles tactiles agrandies (recommandé ≥ 44 px) */
  .lightbox-nav    { width: 48px; height: 48px; }
  .card-action-btn { width: 32px; height: 32px; }

  /* Désactive les effets de survol qui s'activent malencontreusement au tap */
  .photo-card:hover  { transform: none; box-shadow: none; border-color: var(--border); }
  .album-card:hover  { transform: none; box-shadow: none; border-color: var(--border); }
  .tag-card:hover    { transform: none; box-shadow: none; }
  .tag-chip:hover    { transform: none; opacity: 1; }

  /* Retour visuel au tap via :active */
  .photo-card:active  { transform: scale(0.97); box-shadow: none; transition: transform 0.08s ease; }
  .album-card:active  { transform: scale(0.97); box-shadow: none; transition: transform 0.08s ease; }
}

/* ──────────────────────────────────────────────────────────────
   Global : supprime le délai de 300ms sur les éléments cliquables
────────────────────────────────────────────────────────────── */
a, button, [role="button"], label, select,
.photo-card, .album-card, .tag-card, .tag-chip,
.nav-item, .album-tree-row, .breadcrumb-item,
.page-btn, .view-btn, .card-action-btn {
  touch-action: manipulation;
}

/* Défilement fluide dans le panneau lightbox sur iOS */
.panel-body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Poignée visuelle du panneau lightbox en feuille (mobile) */
@media (max-width: 768px) {
  .lightbox-panel.panel-open::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    margin: 10px auto 6px;
    flex-shrink: 0;
  }
  /* Empêche le rebond (pull-to-refresh) dans la zone de contenu */
  .content-area { overscroll-behavior-y: contain; }
}

/* ----------------------------------------------------------------
   Lightbox caption — description toujours visible sur mobile
---------------------------------------------------------------- */

/* Caption masquée par défaut — JS la montre uniquement sur mobile */
.lightbox-caption {
  display: none;
}

@media (max-width: 768px) {
  /* Sur mobile : caption affichée dans le stage, sous l'image */
  /* display géré par JS (block / none) selon présence de description */
  .lightbox-caption {
    display: none; /* valeur par défaut ; JS met 'block' si description existe */
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 14px 16px;
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.93);
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
    text-align: center;
    pointer-events: none;
    z-index: 2;
  }
}

/* ----------------------------------------------------------------
   Leaflet overrides (dark theme)
---------------------------------------------------------------- */
.leaflet-container {
  background: var(--bg-surface) !important;
  font-family: 'Inter', sans-serif;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.leaflet-popup-tip { background: var(--bg-card); }

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}

.leaflet-tile-pane { filter: brightness(0.75) saturate(0.8); }
/* En thème clair, les tuiles OSM sont déjà claires : pas besoin de les assombrir */
[data-theme="light"] .leaflet-tile-pane { filter: none; }

/* ================================================================
   Albums & sous-albums — vue album, breadcrumb, arbre
================================================================ */

/* ----------------------------------------------------------------
   Fil d'Ariane
---------------------------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;        /* une seule ligne */
  overflow: hidden;         /* masque le surplus */
  gap: 2px;
  padding: 8px 0 16px;
  font-size: 13px;
  min-width: 0;             /* autorise la réduction dans un flex parent */
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;           /* items intermédiaires ne se réduisent pas */
}
.breadcrumb-item:hover { background: var(--bg-card); color: var(--text-primary); }
.breadcrumb-item.current {
  color: var(--text-primary);
  font-weight: 600;
  cursor: default;
  flex-shrink: 1;           /* le dernier élément seul peut se réduire */
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.breadcrumb-item i { width: 14px; height: 14px; flex-shrink: 0; }

.breadcrumb-sep { color: var(--text-muted); display: flex; align-items: center; flex-shrink: 0; }
.breadcrumb-sep i { width: 14px; height: 14px; }

/* Conteneur dynamique des items (span#breadcrumbItems) */
#breadcrumbItems {
  display: contents; /* ses enfants participent directement au flex parent */
}

/* ----------------------------------------------------------------
   En-tête de vue avec actions
---------------------------------------------------------------- */
.view-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Toggle "Inclure les sous-albums" */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: border-color var(--transition), color var(--transition);
}
.toggle-label:hover { border-color: var(--border-focus); color: var(--text-primary); }
.toggle-label input[type="checkbox"] { accent-color: var(--primary); width: 14px; height: 14px; }

/* ----------------------------------------------------------------
   Section sous-albums dans la galerie
---------------------------------------------------------------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.section-title i { width: 17px; height: 17px; }

.section-divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* Grille de sous-albums (plus compacte que la grille principale) */
.subalbums-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  margin-bottom: 0 !important;
}

.subalbums-grid .album-cover { height: 130px; }

/* Badge "sous-album" sur les cartes */
.album-depth-badge {
  position: absolute;
  top: 8px; left: 8px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(0,0,0,0.55);
  color: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  letter-spacing: 0.04em;
}

/* ----------------------------------------------------------------
   Indentation dans la vue Albums (liste plate enrichie)
---------------------------------------------------------------- */
.album-card[data-depth="1"] { border-left: 3px solid var(--primary); }
.album-card[data-depth="2"] { border-left: 3px solid var(--secondary); }
.album-card[data-depth="3"] { border-left: 3px solid var(--accent); }

/* ----------------------------------------------------------------
   Modal — prévisualisation du chemin parent
---------------------------------------------------------------- */
.album-parent-preview {
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.album-parent-preview i { width: 12px; height: 12px; color: var(--primary-light); }

/* ================================================================
   Auth — User Menu, Login Modal, Admin Panel, Role Badges
================================================================ */

/* ── Bouton Connexion (invité) ─────────────────────────────── */
.btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Icône seule (le libellé "Se connecter" reste dans title/aria-label) :
     padding symétrique pour un bouton rond plutôt qu'une pilule ovale. */
  width: 34px;
  height: 34px;
  background: var(--primary-glow);
  color: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.btn-login:hover { background: var(--primary); color: #fff; }
.btn-login i { width: 15px; height: 15px; }

/* ── Menu utilisateur connecté ─────────────────────────────── */
.user-menu-wrapper {
  display: flex;
  align-items: center;
  margin-right: 8px;
  position: relative;
}
.user-menu { position: relative; }

.user-avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.user-avatar-btn:hover { background: var(--bg-card-hover); border-color: var(--primary); }

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-display-name { font-size: 13px; font-weight: 500; color: var(--text-primary); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chevron { width: 14px; height: 14px; color: var(--text-muted); transition: transform var(--transition); }
.user-avatar-btn[aria-expanded="true"] .user-chevron { transform: rotate(180deg); }

/* ── Dropdown ─────────────────────────────────────────────── */
.user-dropdown {
  position: fixed;
  /* top / right calculés dynamiquement par auth.js */
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 9500;
  overflow: hidden;
  animation: fadeSlideDown .15s ease;
}
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.user-dropdown-header {
  padding: 14px 16px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.user-dropdown-name { font-size: 14px; font-weight: 600; color: var(--text-primary); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-align: left;
}
.user-dropdown-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.user-dropdown-item i { width: 15px; height: 15px; flex-shrink: 0; }
.user-dropdown-danger { color: var(--error) !important; }
.user-dropdown-danger:hover { background: rgba(239,68,68,.1) !important; }

/* ── Badge de rôle ─────────────────────────────────────────── */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.role-badge.admin { background: rgba(99,102,241,.2); color: #a5b4fc; border: 1px solid rgba(99,102,241,.4); }
.role-badge.user  { background: rgba(16,185,129,.2); color: #6ee7b7; border: 1px solid rgba(16,185,129,.4); }

/* ── Modal Connexion ──────────────────────────────────────── */
.login-welcome { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.login-guest-note { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.login-error {
  padding: 10px 14px;
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius-sm);
  color: #f87171;
  font-size: 13px;
  margin-top: 12px;
}

/* ── Vue Administration — tableau utilisateurs ─────────────── */
.users-table-wrap { overflow-x: auto; margin-top: 8px; }
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.users-table th {
  background: var(--bg-surface);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.users-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
.users-table tr:hover td { background: var(--bg-card-hover); }
.users-table tr:last-child td { border-bottom: none; }

.user-row-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-row-name { font-weight: 600; color: var(--text-primary); }
.user-row-sub  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.user-actions  { display: flex; gap: 6px; justify-content: flex-end; }
.user-inactive { opacity: .5; }

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}
.status-badge.active   { background: rgba(16,185,129,.15); color: #6ee7b7; }
.status-badge.inactive { background: rgba(239,68,68,.15);  color: #f87171; }

/* form-row pour 2 colonnes dans les modals */
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ----------------------------------------------------------------
   Boutons d'action admin sur les cards albums / tags
---------------------------------------------------------------- */

/* Overlay sur la couverture d'un album */
.album-card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
  z-index: 2;
}
.album-card:hover .album-card-actions { opacity: 1; }

/* Boutons d'action sur les tag-cards */
.tag-card { position: relative; }
.tag-card-actions {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity .15s;
  z-index: 2;
}
.tag-card:hover .tag-card-actions { opacity: 1; }

/* Bouton générique (partagé albums et tags) */
.card-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(15, 15, 26, .82);
  color: #e2e8f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: background .15s, transform .1s;
  flex-shrink: 0;
  padding: 0;
}
.card-action-btn:hover              { background: rgba(99, 102, 241, .9); transform: scale(1.1); }
.card-action-btn.danger:hover       { background: rgba(239, 68, 68, .85); }
.card-action-btn.copied             { background: rgba(34, 197, 94, .85) !important; }
.card-action-btn svg,
.card-action-btn i[data-lucide]     { width: 12px; height: 12px; pointer-events: none; }

/* ----------------------------------------------------------------
   Bannière changement de mot de passe forcé
---------------------------------------------------------------- */
.forced-change-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(245, 158, 11, .1);
  border: 1px solid rgba(245, 158, 11, .35);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  color: #fbbf24;
}
.forced-change-note > i[data-lucide] {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}
.forced-change-note strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #fde68a;
}
.forced-change-note p {
  font-size: 12px;
  color: #fcd34d;
  line-height: 1.5;
  margin: 0;
}

/* Indicateur « doit changer MDP » dans le tableau des utilisateurs */
.must-change-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(245,158,11,.15);
  color: #fbbf24;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ----------------------------------------------------------------
   Section permissions utilisateur (modal admin)
---------------------------------------------------------------- */
.permissions-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  margin: 20px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.permissions-section-label i { width: 14px; height: 14px; }

.permissions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Toggle checkbox pill */
.perm-toggle { cursor: pointer; }
.perm-toggle input[type="checkbox"] { display: none; }

.perm-toggle-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  font-size: 13px;
  color: var(--text-secondary);
  transition: border-color .2s, background .2s, color .2s;
}
.perm-toggle-box i { width: 16px; height: 16px; flex-shrink: 0; }

.perm-toggle input:checked + .perm-toggle-box {
  border-color: var(--primary);
  background: rgba(99,102,241,.12);
  color: var(--primary-light);
}

/* Badge permissions dans le tableau des utilisateurs */
.perm-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.perm-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  background: rgba(99,102,241,.15);
  color: var(--primary-light);
  white-space: nowrap;
}
.perm-badge i { width: 10px; height: 10px; }

/* ----------------------------------------------------------------
   Modal "Mes clés API"
---------------------------------------------------------------- */
.apikeys-intro {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* Zone de révélation de la nouvelle clé */
.apikey-reveal {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.apikey-reveal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 10px;
}
.apikey-reveal-title i { width: 16px; height: 16px; }
.apikey-reveal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.apikey-value {
  flex: 1;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 12px;
  color: #a5f3d0;
  word-break: break-all;
  user-select: all;
}
.apikey-reveal-warn {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11px;
  color: #fcd34d;
  margin-top: 10px;
  margin-bottom: 0;
  line-height: 1.5;
}
.apikey-reveal-warn i { width: 13px; height: 13px; flex-shrink: 0; margin-top: 1px; }

/* Formulaire de création */
.apikey-create-form {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}

/* Liste des clés */
.apikey-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  margin-bottom: 8px;
  transition: border-color .2s;
}
.apikey-item:hover { border-color: var(--border-hover); }
.apikey-item-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: rgba(99,102,241,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary-light);
}
.apikey-item-icon i { width: 16px; height: 16px; }
.apikey-item-body { flex: 1; min-width: 0; }
.apikey-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.apikey-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.apikey-item-meta .perms {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.apikey-item-inactive .apikey-item-name {
  color: var(--text-muted);
  text-decoration: line-through;
}
.apikey-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ----------------------------------------------------------------
   Drag & Drop pour déplacement d'album (future feature)
---------------------------------------------------------------- */
.album-card.drag-over {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* ============================================================
   Rating (étoiles)
============================================================ */
.panel-rating {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border);
}
.rating-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rating-avg-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 2px;
}
.rating-avg-value {
  color: #f59e0b;
  font-weight: 700;
  font-size: 13px;
}
.rating-avg-count {
  font-size: 11px;
  color: var(--text-muted);
}
.panel-rating-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  white-space: nowrap;
}
.rating-stars {
  display: flex;
  gap: 2px;
}
.star-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color .15s, transform .1s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.star-btn:hover,
.star-btn.active {
  color: #f59e0b;
  transform: scale(1.15);
}
/* Lucide remplace <i> par <svg> — cibler les deux */
.star-btn i,
.star-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}
.star-btn.active i,
.star-btn.active svg {
  fill: #f59e0b;
  stroke: #f59e0b;
}
/* Survol : contour ambré sans remplissage */
.star-btn:hover:not(.active) svg {
  fill: none;
  stroke: #f59e0b;
}

/* Badge étoiles sur les cartes */
.rating-badge {
  position: absolute;
  bottom: 36px;
  left: 8px;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  color: #f59e0b;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  pointer-events: none;
  z-index: 2;
}

/* Nombre de vues — affiché uniquement dans la vue "Plus vues" */
.views-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  pointer-events: none;
  z-index: 2;
}
.views-badge i { width: 11px; height: 11px; }

/* Liste : note inline */
.photo-list-rating {
  font-size: 12px;
  color: #f59e0b;
  margin-top: 2px;
  letter-spacing: 1px;
}
.rating-count {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0;
}

/* ============================================================
   Diaporama (slideshow)
============================================================ */
/* Contrôles flottants en bas de la lightbox */
.slideshow-controls {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 40px;
  padding: 6px 14px;
  z-index: 20;
}
.ss-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ss-btn:hover { background: rgba(255,255,255,.15); }
.ss-btn i { width: 20px; height: 20px; }
.ss-speed {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 12px;
  cursor: pointer;
}
.ss-speed option { background: #1e1e2e; color: #fff; }

/* Barre de progression en bas de l'image */
.slideshow-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,.15);
  z-index: 15;
}
.slideshow-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent, #6366f1);
  transition: none;
}

/* En mode diaporama : cache le panneau et ajuste le stage */
#lightbox.slideshow-mode #lightboxPanel {
  display: none !important;
}
#lightbox.slideshow-mode #lightboxStage {
  width: 100% !important;
}

/* Bouton diaporama dans la barre d'actions lightbox */
.lb-action-btn {
  position: absolute;
  top: 12px;
  right: 48px;
  background: rgba(0,0,0,.5);
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.lb-action-btn:hover { background: rgba(0,0,0,.8); }
.lb-action-btn i { width: 20px; height: 20px; }

/* Bouton diaporama dans la barre galerie */
#startSlideshowBtn {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Responsive */
@media (max-width: 768px) {
  .slideshow-controls {
    bottom: 80px;
    padding: 5px 10px;
    gap: 4px;
  }
  .ss-btn i { width: 18px; height: 18px; }
}

/* ── Outils de maintenance admin ───────────────────────────── */
.admin-tools-section { margin-top: 8px; }
.admin-tool-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 12px;
}
.admin-tool-card strong { font-size: 14px; font-weight: 600; }
