/* ── Fonts ──────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'HossRound';
  /* chemin relatif à ce fichier (public/css/) : la police est dans public/fonts/ */
  src: url('../fonts/HossRound-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

:root {
  --primary:        #E72685;
  --primary-dark:   #c91d73;
  --primary-light:  #fdf0f6;
  --orange:         #F06030;
  --yellow:         #FAC911;
  --gradient:       linear-gradient(135deg, #E72685 0%, #F06030 50%, #FAC911 100%);
  --gradient-hover: linear-gradient(135deg, #c91d73 0%, #d94e25 50%, #e0b40e 100%);
  --bg:             #fdf5f9;
  --surface:        #ffffff;
  --border:         #f0d6e8;
  --text:           #1e1426;
  --text-muted:     #7a5470;
  --radius:         12px;
  --shadow:         0 4px 24px rgba(231,38,133,.08);
  --shadow-lg:      0 12px 40px rgba(231,38,133,.16);
  /* compat aliases */
  --c-primary:      #E72685;
  --c-primary-dark: #c91d73;
  --c-primary-light:#fdf0f6;
  --c-gradient:     linear-gradient(135deg, #E72685 0%, #F06030 50%, #FAC911 100%);
  --c-gradient-hover:linear-gradient(135deg, #c91d73 0%, #d94e25 50%, #e0b40e 100%);
  --c-blue:         #E72685;
  --c-blue-hover:   #c91d73;
  --c-blue-light:   #fdf0f6;
  --c-bg:           #fdf5f9;
  --c-bg-card:      #ffffff;
  --c-text:         #1e1426;
  --c-text-muted:   #7a5470;
  --c-border:       #f0d6e8;
  --c-red:          #DE350B;
  --c-green:        #36B37E;
  --c-purple:       #6554C0;
  --c-amber:        #F59E0B;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --shadow-sm:      0 1px 3px rgba(231,38,133,.07);
  --shadow-md:      0 4px 24px rgba(231,38,133,.12);
  --font:           'Nunito', system-ui, -apple-system, sans-serif;
  --font-heading:   'HossRound', 'Nunito', system-ui, sans-serif;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.main-content { min-height: calc(100vh - 64px - 80px); }

/* ── Navigation ────────────────────────────────────────────────────────────── */
.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(231,38,133,.06);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  flex-shrink: 0;
}
.logo img { height: 40px; width: auto; object-fit: contain; }
.logo-badge {
  font-size: .68rem;
  font-weight: 700;
  background: var(--gradient);
  color: white;
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: .5px;
  font-family: var(--font-heading);
  white-space: nowrap;
}
.logo-badge--dark {
  background: var(--text);
  color: #fff;
}

/* Search bar inside nav */
.nav-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: .45rem 1rem;
  flex: 1;
  max-width: 380px;
  transition: border-color .15s;
}
.nav-search:focus-within { border-color: var(--primary); }
.nav-search input {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: .875rem;
  color: var(--text);
  width: 100%;
}
.nav-search-icon { font-size: 1rem; flex-shrink: 0; line-height: 1; }

/* Nav actions */
.nav-actions { display: flex; align-items: center; gap: .75rem; }

/* Buttons */
.btn-nav, .btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: 8px;
  font: 600 .875rem var(--font);
  border: none;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-nav:hover, .btn:hover { text-decoration: none; }
.btn-ghost, .btn-nav--ghost, .btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover, .btn-nav--ghost:hover, .btn--ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.btn-primary, .btn-nav--primary, .btn--primary {
  background: var(--gradient);
  color: white;
  border: none;
}
.btn-primary:hover, .btn-nav--primary:hover, .btn--primary:hover {
  background: var(--gradient-hover);
  transform: translateY(-1px);
}
.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn--secondary:hover { background: var(--bg); border-color: var(--primary); }
.btn--full { width: 100%; justify-content: center; }
.btn--sm { padding: .3rem .75rem; font-size: .8rem; }

/* Avatar */
.nav-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .8rem;
  flex-shrink: 0;
  cursor: pointer;
}
.nav-avatar--lg { width: 42px; height: 42px; font-size: 1rem; }

/* Nav user dropdown */
.nav-dropdown { position: relative; }
.nav-avatar-btn {
  display: flex; align-items: center; gap: .5rem;
  background: none; border: 1.5px solid var(--border);
  border-radius: 50px; padding: .3rem .75rem .3rem .3rem;
  cursor: pointer; transition: all .15s; color: var(--text);
  font: 600 .875rem var(--font);
}
.nav-avatar-btn:hover,
.nav-dropdown.open .nav-avatar-btn { border-color: var(--primary); background: var(--primary-light); }
.nav-avatar-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-avatar-caret { font-size: .7rem; color: var(--text-muted); transition: transform .2s; }
.nav-dropdown.open .nav-avatar-caret { transform: rotate(180deg); }

.nav-dropdown__menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 220px; overflow: hidden; z-index: 500;
  animation: dropIn .15s ease;
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nav-dropdown.open .nav-dropdown__menu { display: block; }
.nav-dropdown__header {
  display: flex; align-items: center; gap: .75rem;
  padding: .9rem 1rem; background: var(--bg);
}
.nav-dropdown__name { font-weight: 700; font-size: .875rem; }
.nav-dropdown__email { font-size: .75rem; color: var(--text-muted); margin-top: .1rem; }
.nav-dropdown__divider { border: none; border-top: 1px solid var(--border); margin: .25rem 0; }
.nav-dropdown__item {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem 1rem; font-size: .875rem; font-weight: 600;
  color: var(--text-muted); text-decoration: none; transition: background .12s, color .12s;
}
.nav-dropdown__item i { width: 14px; text-align: center; font-size: .8rem; }
.nav-dropdown__item:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-dropdown__item--danger:hover { background: #fef2f2; color: var(--c-red); }

/* ── Flash / Alerts (fallback non-JS) ──────────────────────────────────────── */
.flash-zone { display: none; }

/* ── Hero ──────────────────────────────────────────────────────────────────── */
.hero {
  background: var(--gradient);
  color: white;
  padding: 48px 2rem 40px;
  text-align: center;
}
.hero h1 {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: .75rem;
}
.hero p {
  font-size: 1rem;
  opacity: .88;
  margin-bottom: 1.75rem;
  font-family: var(--font);
  font-weight: 500;
}
.hero-search {
  display: flex;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}
.hero-search input {
  flex: 1;
  border: none;
  outline: none;
  padding: .9rem 1.25rem;
  font-family: var(--font);
  font-size: .95rem;
  color: var(--text);
}
.hero-search button {
  padding: .9rem 1.5rem;
  background: var(--text);
  color: white;
  border: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: .875rem;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.hero-search button:hover { background: var(--primary-dark); }

/* ── Category grid ─────────────────────────────────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .75rem;
  margin-bottom: 2rem;
}
.cat-tile {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem .75rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: .8rem;
  color: var(--text);
  text-decoration: none;
  display: block;
}
.cat-tile:hover, .cat-tile.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.cat-tile .cat-icon { font-size: 1.75rem; margin-bottom: .5rem; display: block; }

/* ── Publication grid ──────────────────────────────────────────────────────── */
.pub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  padding-bottom: 3rem;
}

.pub-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all .2s;
  box-shadow: var(--shadow);
  position: relative;
}
.pub-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

/* Cover area */
.pub-card__cover {
  display: block;
  position: relative;
  height: 200px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pub-card__cover img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s;
}
.pub-card:hover .pub-card__cover img { transform: scale(1.04); }

.pub-card__placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: .5rem;
}
.pub-card__placeholder-icon {
  font-size: 2.25rem;
  opacity: .25;
}
.pub-card__placeholder-text {
  color: #4a4458;
  font-size: .8rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.3;
  padding: 0 .75rem;
}
.pub-card__placeholder-sub {
  color: #9e96aa;
  font-size: .7rem;
  margin-top: .25rem;
  text-align: center;
}

/* Catégorie pill rose (style ASTRID) */
.pub-cat {
  font-size: .7rem;
  background: #fdf0f6;
  color: var(--primary);
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
}

/* Cover color variants */
.cover-1 { background: #f0eff0; }
.cover-2 { background: #eeedf0; }
.cover-3 { background: #f2f0ee; }
.cover-4 { background: #eff0ee; }
.cover-5 { background: #f0eeef; }
.cover-6 { background: #edeef0; }

/* Read overlay */
.pub-card__overlay {
  position: absolute;
  inset: 0;
  background: rgba(231,38,133,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
}
.pub-card:hover .pub-card__overlay { opacity: 1; }
.pub-card__read-btn {
  background: var(--gradient);
  color: white;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: .8rem;
  padding: .6rem 1.25rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

/* Badge on card */
.pub-badge {
  position: absolute;
  top: .625rem;
  right: .625rem;
  font-size: .65rem;
  font-weight: 700;
  padding: .2rem .55rem;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(4px);
  border-radius: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.pub-badge--private { background: rgba(0,0,0,.55); color: #fff; }
.pub-badge--cat {
  position: static;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 10px;
  font-size: .7rem;
  font-weight: 700;
  padding: .15rem .5rem;
}

/* Card body */
.pub-card__body, .pub-info {
  padding: .875rem;
}
.pub-card__body h2, .pub-info h4 {
  font-size: .875rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: .5rem;
  line-height: 1.35;
}
.pub-card__body h2 a { color: var(--text); }
.pub-card__body h2 a:hover { color: var(--primary); text-decoration: none; }
.pub-card__desc { font-size: .775rem; color: var(--text-muted); margin-bottom: .5rem; }
.pub-card__meta, .pub-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  font-size: .7rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.pub-views { display: flex; align-items: center; gap: .2rem; font-size: .7rem; color: var(--text-muted); }

/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: .4rem; justify-content: center; margin: 2rem 0; }
.pagination__item {
  padding: .4rem .75rem; border-radius: 8px;
  border: 1.5px solid var(--border);
  color: var(--text); font-size: .875rem; text-decoration: none;
  transition: all .15s;
}
.pagination__item:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination__item--active { background: var(--gradient); color: #fff; border-color: transparent; }

/* ── Auth pages ────────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: calc(100vh - 144px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg);
}
.auth-card {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border);
  animation: modalIn .2s ease;
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.auth-card h1 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text);
}
.auth-alt {
  text-align: center;
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
}

/* ── Form fields ───────────────────────────────────────────────────────────── */
.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  margin-bottom: .35rem;
  color: var(--text-muted);
}
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=datetime-local],
.field input[type=number],
.field input[type=file],
.field select,
.field textarea {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.field label.toggle-switch input:focus { outline: none; box-shadow: none; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(231,38,133,.12);
}
.field .req { color: var(--c-red); }
.checkbox-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; }
.checkbox-label input { width: auto; }

/* Toggle switch */
label.toggle-switch {
  display: inline-flex; align-items: center; gap: .75rem;
  cursor: pointer; user-select: none;
  position: relative; margin-bottom: 0; color: inherit;
  font-size: inherit; font-weight: inherit;
}
label.toggle-switch input {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.toggle-switch__track {
  position: relative; width: 44px; height: 24px; flex-shrink: 0;
  background: #d1d5db; border-radius: 99px; transition: background .22s ease;
}
label.toggle-switch input:checked ~ .toggle-switch__track { background: var(--gradient); }
.toggle-switch__thumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25);
  transition: transform .22s ease;
}
label.toggle-switch input:checked ~ .toggle-switch__track .toggle-switch__thumb {
  transform: translateX(20px);
}
.toggle-switch__label {
  font-size: .9rem; font-weight: 600; color: var(--text);
  display: flex; flex-direction: column; gap: .1rem;
}
.toggle-switch__desc { font-size: .78rem; font-weight: 400; color: var(--text-muted); }

/* Custom select */
.custom-select { position: relative; width: 100%; }
.custom-select__trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .65rem .9rem; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); font: inherit; font-size: .9rem; color: var(--text);
  cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s;
}
.custom-select__trigger:hover { border-color: var(--primary); }
.custom-select.open .custom-select__trigger {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(231,38,133,.12);
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.custom-select__value { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.custom-select__value--placeholder { color: var(--text-muted); }
.custom-select__arrow { font-size: .75rem; color: var(--text-muted); flex-shrink: 0; transition: transform .2s ease; }
.custom-select.open .custom-select__arrow { transform: rotate(180deg); }
.custom-select__menu {
  display: none; position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); border: 1.5px solid var(--primary); border-top: none;
  border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;
  box-shadow: 0 8px 24px rgba(231,38,133,.1); z-index: 300; overflow: hidden;
  max-height: 280px; overflow-y: auto;
}
.custom-select.open .custom-select__menu { display: block; }
.custom-select__option {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .9rem; font-size: .9rem; cursor: pointer;
  color: var(--text); transition: background .1s;
}
.custom-select__option:hover { background: var(--primary-light); color: var(--primary); }
.custom-select__option--selected { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.custom-select__option--selected::after {
  content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
  margin-left: auto; font-size: .75rem;
}
.custom-select__option--empty { color: var(--text-muted); font-style: italic; }
.custom-select__divider { height: 1px; background: var(--border); margin: .25rem 0; }

/* Password toggle */
.pw-wrap { position: relative; display: block; }
.pw-wrap input[type=password], .pw-wrap input[type=text] { width: 100%; padding-right: 2.8rem; }
.pw-toggle {
  position: absolute; right: 0; top: 0; bottom: 0; width: 2.6rem;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: .95rem;
  border-radius: 0 8px 8px 0; transition: color .15s;
  user-select: none; -webkit-user-select: none;
}
.pw-toggle:hover { color: var(--primary); }

/* ── Admin hero ────────────────────────────────────────────────────────────── */
.admin-hero {
  background: linear-gradient(135deg, #E72685 0%, #F06030 50%, #FAC911 100%);
  color: #fff;
  padding: 2rem 1.5rem;
  text-align: center;
}
.admin-hero h1 {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 1.25rem;
}
.admin-hero__actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-admin-hero {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.5rem;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn-admin-hero--primary {
  background: #fff;
  color: #E72685;
}
.btn-admin-hero--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.btn-admin-hero--outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,.6);
}
.btn-admin-hero--outline:hover {
  background: rgba(255,255,255,.12);
  border-color: #fff;
}

/* ── Admin navigation ──────────────────────────────────────────────────────── */
.admin-tabs-bar {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 64px;
  z-index: 90;
  box-shadow: 0 1px 8px rgba(0,0,0,.04);
}
.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 0 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .875rem 1.1rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  text-decoration: none;
  transition: all .15s;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
}
.admin-tab:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.admin-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 800;
}

/* Admin page content */
.admin-page {
  padding: 2rem 1.5rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
}
.page-title, .admin-page-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: .35rem;
  color: var(--text);
}
.page-subtitle, .admin-page-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

/* Admin toolbar */
.admin-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.admin-toolbar-left, .admin-toolbar-right {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.admin-search {
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 8px; padding: .5rem .9rem; width: 260px;
  transition: border-color .15s;
}
.admin-search:focus-within { border-color: var(--primary); }
.admin-search i { color: var(--text-muted); font-size: .85rem; }
.admin-search input {
  border: none; outline: none; font: inherit; font-size: .875rem;
  background: transparent; width: 100%; color: var(--text);
}

/* Admin table */
.admin-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .875rem; background: var(--surface); }
.admin-table th {
  text-align: left; padding: .75rem 1rem;
  background: var(--bg); border-bottom: 2px solid var(--border);
  font-weight: 700; white-space: nowrap; color: var(--text-muted);
  font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
}
.admin-table td { padding: .875rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--primary-light); }
.table-actions { display: flex; gap: .4rem; flex-wrap: nowrap; align-items: center; }
.table-actions a {
  font-size: .8rem; font-weight: 600; padding: .25rem .65rem;
  border-radius: 6px; border: 1.5px solid var(--border);
  color: var(--text-muted); text-decoration: none;
  transition: all .15s; white-space: nowrap;
}
.table-actions a:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); text-decoration: none; }
.action-danger { color: var(--c-red) !important; border-color: #fca5a5 !important; }
.action-danger:hover { background: #fef2f2 !important; border-color: var(--c-red) !important; }
/* ── Lien d'accès privé (formulaire publication) ───────────────────────────── */
.private-access-box {
  background: #fdf0f9;
  border: 1.5px solid #f0b8df;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.private-access-box__header {
  display: flex; align-items: center; gap: .5rem;
  color: #c0147c; font-size: .9rem; margin-bottom: .4rem;
}
.private-access-box__desc {
  font-size: .8rem; color: var(--c-text-muted); margin: 0 0 .75rem;
}
.private-access-box__link {
  display: flex; gap: .5rem; align-items: center;
}
.private-access-box__link input {
  flex: 1; padding: .45rem .75rem; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .8rem; background: #fff;
  color: var(--text); font-family: ui-monospace, monospace;
}

.btn-private-link {
  font-size: .8rem; font-weight: 600; padding: .25rem .65rem;
  border-radius: 6px; border: 1.5px solid #fbb6e0;
  color: #c0147c; background: none; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn-private-link:hover { background: #fdf0f9; border-color: var(--primary); }

/* Stat cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
}
.stat-card__icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; flex-shrink: 0;
}
.stat-card__icon--blue   { background: #eff6ff; color: #2563eb; }
.stat-card__icon--green  { background: #f0fdf4; color: #16a34a; }
.stat-card__icon--orange { background: #fff7ed; color: #ea580c; }
.stat-card__icon--purple { background: #faf5ff; color: #9333ea; }
.stat-card__icon--pink   { background: var(--primary-light); color: var(--primary); }
.stat-card__info { flex: 1; min-width: 0; }
.stat-card__value { font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-card__label { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }

/* Admin actions */
.admin-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 2rem; }

/* Dashboard — sections supplémentaires */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 2rem; }
.dash-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.dash-panel__title { font-size: .85rem; font-weight: 700; padding: .85rem 1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .5rem; }
.dash-panel .admin-table th, .dash-panel .admin-table td { padding: .6rem .875rem; }
.dash-ftbar { display: flex; align-items: center; gap: .65rem; padding: .45rem 0; }
.dash-ftbar__icon { width: 1rem; text-align: center; flex-shrink: 0; }
.dash-ftbar__label { font-size: .8rem; font-weight: 600; width: 80px; flex-shrink: 0; }
.dash-ftbar__track { flex: 1; height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.dash-ftbar__fill { height: 100%; border-radius: 99px; transition: width .4s ease; }
.dash-ftbar__count { font-size: .8rem; font-weight: 700; width: 2rem; text-align: right; color: var(--c-text-muted); flex-shrink: 0; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .6rem; border-radius: 50px; font-size: .75rem; font-weight: 700;
}
.badge--green  { background: #ECFDF5; color: #065F46; }
.badge--red    { background: #FEF2F2; color: #7F1D1D; }
.badge--gray   { background: var(--bg); color: var(--text-muted); }
.badge--blue   { background: var(--primary-light); color: var(--primary); }
.badge--purple { background: #F3F0FF; color: var(--c-purple); }

/* Admin form */
.admin-form { max-width: 900px; }
.form-grid { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* Chart card */
.chart-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
  border: 1px solid var(--border); margin-bottom: 1.5rem;
}
.chart-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }

/* Search header */
.search-header {
  display: flex; align-items: center; gap: 1rem; margin: 2rem 0;
}
.search-header__icon {
  width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.search-header__title { font-size: 1.5rem; font-weight: 800; margin: 0 0 .2rem; }
.search-header__query { color: var(--primary); }
.search-header__meta  { font-size: .875rem; color: var(--text-muted); margin: 0; }

/* Private card */
.private-card {
  background: var(--surface); border-radius: 18px;
  box-shadow: var(--shadow-lg); padding: 2.5rem;
  width: 100%; max-width: 440px; text-align: center;
  border: 1px solid var(--border);
}
.private-card__icon {
  width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 1.25rem;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
}
.private-card__title { font-size: 1.4rem; margin: 0 0 .5rem; }
.private-card__desc  { color: var(--text-muted); font-size: .9rem; margin: 0 0 1.5rem; }
.private-card__form  { text-align: left; }
.private-card__error {
  color: var(--c-red); font-size: .85rem; margin: .5rem 0 1rem;
  display: flex; align-items: center; gap: .4rem;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 2.5rem 1.5rem; text-align: center; cursor: pointer;
  background: var(--bg); transition: all .2s; position: relative;
}
.drop-zone:hover, .drop-zone--over { border-color: var(--primary); background: var(--primary-light); }
.drop-zone--filled   { border-color: var(--c-green); background: #f0fdf4; border-style: solid; }
.drop-zone--uploading{ border-color: var(--primary); background: var(--primary-light); border-style: solid; pointer-events: none; }
.drop-zone__input  { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop-zone__icon   { font-size: 2.5rem; color: var(--primary); margin-bottom: .75rem; }
.drop-zone__text   { font-weight: 700; font-size: 1rem; margin-bottom: .3rem; }
.drop-zone__sub    { font-size: .85rem; color: var(--text-muted); }
.file-types        { display: flex; gap: .45rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.file-type-tag {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: .25rem .6rem;
  font-size: .75rem; font-weight: 700; color: var(--text-muted);
  letter-spacing: .02em;
}
.drop-zone__file   { margin-top: .75rem; font-size: .875rem; font-weight: 700; color: var(--c-green); }
.drop-zone__progress { display: none; margin-top: 1.25rem; width: 100%; }
.drop-zone--uploading .drop-zone__progress { display: block; }
.drop-zone__progress-track {
  height: 6px; background: rgba(231,38,133,.15); border-radius: 99px; overflow: hidden;
}
.drop-zone__progress-fill {
  height: 100%; width: 0%; background: var(--gradient);
  border-radius: 99px; transition: width .15s ease;
}
.drop-zone__progress-label {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: .5rem; font-size: .8rem; font-weight: 700; color: var(--primary);
}
.drop-zone--processing .drop-zone__progress-fill {
  width: 100% !important;
  animation: progressPulse 1s ease-in-out infinite alternate;
}
@keyframes progressPulse { from { opacity: 1; } to { opacity: .5; } }

/* File current (edit mode) */
.file-current {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .75rem 1rem; border: 1.5px solid var(--border); border-radius: 8px; background: var(--bg);
}
.file-current__info { display: flex; align-items: center; gap: .65rem; min-width: 0; flex: 1; }
.file-current__icon { font-size: 1.4rem; flex-shrink: 0; }
.file-current__meta { min-width: 0; }
.file-current__type {
  display: inline-flex; align-items: center;
  background: var(--primary-light); color: var(--primary);
  border-radius: 4px; padding: .15rem .45rem;
  font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  margin-bottom: .2rem;
}
.file-current__pages { font-size: .8rem; color: var(--text-muted); }

/* Visibility selector */
.visibility-opts { display: flex; flex-direction: column; gap: .5rem; }
.visibility-opt {
  display: flex; align-items: center; gap: .85rem;
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: .75rem 1rem; cursor: pointer; transition: all .15s;
}
.visibility-opt input[type=radio] { display: none; }
.visibility-opt i { font-size: 1rem; color: var(--text-muted); width: 18px; text-align: center; flex-shrink: 0; }
.visibility-opt:hover, .visibility-opt--active {
  border-color: var(--primary); background: var(--primary-light);
}
.visibility-opt:hover i, .visibility-opt--active i { color: var(--primary); }
.visibility-opt__label { font-size: .875rem; font-weight: 700; color: var(--text); }
.visibility-opt__desc  { font-size: .75rem; color: var(--text-muted); margin-top: .1rem; }
.visibility-opt--active .visibility-opt__label { color: var(--primary); }

/* ── Display mode selector ──────────────────────────────────────────────────── */
.display-mode-opts { display: flex; gap: .75rem; }
.display-mode-opt {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .7rem;
  border: 1.5px solid var(--border); border-radius: 12px;
  padding: 1rem .75rem; cursor: pointer; transition: all .15s; text-align: center;
}
.display-mode-opt input[type=radio] { display: none; }
.display-mode-opt:hover, .display-mode-opt--active {
  border-color: var(--primary); background: var(--primary-light);
}
/* Mini prévisualisation du livre */
.display-mode-opt__preview {
  display: flex; align-items: center; gap: 2px;
  height: 44px; border-radius: 4px; overflow: hidden;
}
.display-mode-opt__preview--double { gap: 2px; }
.display-mode-opt__preview--single { }
.dm-page {
  background: #e2e8f0; border-radius: 2px; height: 100%;
  flex: 1; transition: background .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.dm-page--wide { flex: 0 0 60px; border-radius: 3px; }
.dm-spine { width: 3px; background: #94a3b8; height: 100%; flex-shrink: 0; border-radius: 1px; }
.display-mode-opt--active .dm-page { background: linear-gradient(135deg,#E72685,#F06030); }
.display-mode-opt--active .dm-spine { background: #E72685; }
.display-mode-opt__info { }
.display-mode-opt__label { font-size: .85rem; font-weight: 700; color: var(--text); }
.display-mode-opt__desc  { font-size: .72rem; color: var(--text-muted); margin-top: .2rem; line-height: 1.4; }
.display-mode-opt--active .display-mode-opt__label { color: var(--primary); }

/* ── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--text);
  color: rgba(255,255,255,.6);
  padding: 1.75rem 2rem;
  font-family: var(--font);
  font-size: .8rem;
  margin-top: 0;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-inner strong { color: white; }
.footer-inner nav { display: flex; gap: 1.25rem; }
.footer-inner nav a { color: rgba(255,255,255,.5); transition: color .15s; }
.footer-inner nav a:hover { color: white; text-decoration: none; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: white;
  padding: .875rem 1.25rem;
  border-radius: 12px;
  font-size: .9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .65rem;
  box-shadow: 0 8px 32px rgba(0,0,0,.28);
  pointer-events: auto;
  transform: translateY(-16px);
  opacity: 0;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .25s;
  max-width: 560px;
  min-width: 260px;
  white-space: normal;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast--success { background: #16a34a; }
.toast--error   { background: #dc2626; }
.toast__icon { font-size: 1rem; flex-shrink: 0; }
.toast__text { flex: 1; line-height: 1.4; }
.toast__close {
  background: none; border: none; color: rgba(255,255,255,.7);
  cursor: pointer; font-size: 1rem; padding: 0 0 0 .25rem;
  flex-shrink: 0; line-height: 1;
}
.toast__close:hover { color: white; }

/* ── Confirm modal ─────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: #fff;
  border-radius: 18px;
  padding: 2rem 2rem 1.5rem;
  max-width: 380px;
  width: calc(100% - 2rem);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
  transform: scale(.88) translateY(12px);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.modal-overlay.open .modal-box { transform: scale(1) translateY(0); }
.modal-icon {
  font-size: 2.5rem;
  margin-bottom: .75rem;
  line-height: 1;
  display: block;
}
.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 .5rem;
}
.modal-msg {
  font-size: .9rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
}
.modal-actions .btn-modal-cancel {
  flex: 1;
  padding: .6rem 1rem;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 10px;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  color: var(--text);
  transition: background .15s;
}
.modal-actions .btn-modal-cancel:hover { background: var(--bg); }
.modal-actions .btn-modal-confirm {
  flex: 1;
  padding: .6rem 1rem;
  border: none;
  background: #dc2626;
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s;
}
.modal-actions .btn-modal-confirm:hover { background: #b91c1c; }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; display: block; }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Modal publication (popup catalogue) ───────────────────────────────────── */
.pubm-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.pubm-overlay[hidden] { display: none; }
.pubm-box {
  display: flex; flex-direction: column;
  width: 95vw; max-width: 1400px;
  height: 92vh;
  background: #0f0f1a;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.8);
  animation: modalIn .2s ease;
}
.pubm-bar {
  display: flex; align-items: center; justify-content: space-between;
  height: 44px; padding: 0 .75rem;
  background: #16162a;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.pubm-title {
  font-size: .85rem; font-weight: 600; color: #c0c8e0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; padding-right: .5rem;
}
.pubm-bar-actions { display: flex; align-items: center; gap: .35rem; }
.pubm-btn {
  background: rgba(255,255,255,.08); border: none; cursor: pointer;
  color: #9099b2; width: 30px; height: 30px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; text-decoration: none;
  transition: background .15s, color .15s;
}
.pubm-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.pubm-box iframe {
  flex: 1; border: none; width: 100%;
}
@media (max-width: 640px) {
  .pubm-box { width: 100%; height: 100%; border-radius: 0; }
  .pubm-overlay { padding: 0; }
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .site-nav { padding: 0 1rem; }
  .nav-search { display: none; }
  .pub-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .hero h1 { font-size: 1.6rem; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .admin-tabs-bar { top: 64px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-ftbar__label { width: 60px; }
}
