/* ===================================================
   BDE Archéo - Charte Graphique Archéologie
   Inspirée du logo (Bleu Canard #23738a & Beige Sable #cfb48d)
   Mode Clair & Mode Sombre persistants via Cookies
   =================================================== */

:root {
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-serif: 'Cinzel', 'Playfair Display', Georgia, serif;

  /* Palette BDE Archéo - Minérale, Pierre & Fouilles */
  --bg-body: #ece5d8; /* Calcaire antique chaud & papyrus (fini le blanc aveuglant) */
  --bg-card: #fbf9f4; /* Albâtre / Parchemin noble */
  --bg-card-subtle: #ded3bf; /* Argile & mortier clair */
  --bg-input: #f8f5ee;
  --text-primary: #121e25; /* Noir d'obsidienne */
  --text-secondary: #3f5360;
  --text-muted: #6f828e;

  /* Bleu Canard & Lapis-lazuli Archéologique */
  --primary: #206d82;
  --primary-hover: #165364;
  --primary-light: #d8edf2;
  --primary-contrast: #ffffff;

  /* Sable & Grès de Fouilles (Chat et truelle) */
  --accent-sand: #c4a175;
  --accent-sand-hover: #b49165;
  --accent-sand-light: #f4ede1;
  --accent-sand-dark: #7e5e32;

  /* Terre cuite & Céramique antique */
  --accent-terracotta: #b75737;
  --accent-terracotta-light: #f6e6e0;

  --success: #158064;
  --success-light: #d5f4e9;
  --warning: #be5f26;
  --warning-light: #fbeee4;
  --danger: #be2e2e;
  --danger-light: #fce7e7;

  --border: #cdbeaa; /* Mortier & strate géologique bien visible */
  --border-focus: #206d82;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 6px;

  --shadow-sm: 0 1px 3px 0 rgba(18, 42, 53, 0.08);
  --shadow-md: 0 4px 12px -1px rgba(18, 42, 53, 0.12);
  --shadow-lg: 0 14px 28px -4px rgba(18, 42, 53, 0.16);
  --shadow-card: 0 8px 24px -4px rgba(18, 42, 53, 0.09);

  --header-bg: rgba(236, 229, 216, 0.94);
  --hero-bg: linear-gradient(180deg, rgba(32, 109, 130, 0.08) 0%, rgba(236, 229, 216, 0.2) 100%);
  --bg-pattern: url('egyptian_pattern_light.svg');
  --pill-bg: #d2eaf0;
  --pill-text: #165364;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================= THEME SOMBRE (Basalte & Obsidienne) ================= */
[data-theme="dark"] {
  --bg-body: #0a1216; /* Basalte / Cendre volcanique */
  --bg-card: #121d23; /* Schiste profond */
  --bg-card-subtle: #182831;
  --bg-input: #14232a;
  --text-primary: #f2f7f9;
  --text-secondary: #a1b8c6;
  --text-muted: #67818e;

  --primary: #38a5c2;
  --primary-hover: #298ba5;
  --primary-light: #162b35;
  --primary-contrast: #071217;

  --accent-sand: #d8c19f;
  --accent-sand-hover: #ebd5b6;
  --accent-sand-light: #25201a;
  --accent-sand-dark: #b88d52;

  --accent-terracotta: #d97554;
  --accent-terracotta-light: #301f19;

  --border: #213540;
  --border-focus: #38a5c2;

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5);

  --header-bg: rgba(18, 29, 35, 0.94);
  --hero-bg: linear-gradient(180deg, rgba(19, 36, 44, 0.75) 0%, rgba(10, 18, 22, 0.2) 100%);
  --bg-pattern: url('egyptian_pattern_dark.svg');
  --pill-bg: #18333e;
  --pill-text: #7cd0e6;
}

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

html {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  background-image: var(--bg-pattern);
  background-repeat: repeat;
  background-size: 140px 140px;
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100%;
}

.btn-text-short {
  display: none;
}

body.theme-transitioning,
body.theme-transitioning .site-header,
body.theme-transitioning .stat-card,
body.theme-transitioning .book-card,
body.theme-transitioning .modal-card,
body.theme-transitioning .site-footer {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .container {
    padding: 0 0.85rem;
  }
}

/* ================= ICONS SVG ================= */
.icon {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.18em;
  display: inline-block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.icon-sm {
  width: 0.92em;
  height: 0.92em;
  vertical-align: -0.12em;
}

.icon-lg {
  width: 1.8em;
  height: 1.8em;
  vertical-align: -0.25em;
}

.icon-fill {
  fill: currentColor;
  stroke: none;
}

/* ================= HEADER ================= */
.site-header {
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transition: background 0.3s ease;
}

.header-main-bar {
  width: 100%;
}

.header-main-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.75rem;
  height: 74px;
  flex-wrap: nowrap;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 2.5px solid var(--accent-sand);
  box-shadow: 0 3px 10px rgba(18, 42, 53, 0.2);
  transition: transform 0.25s ease;
  flex-shrink: 0;
  display: block;
}

.logo-area:hover .logo-img {
  transform: rotate(5deg) scale(1.06);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-text h1,
.logo-text .site-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0;
  white-space: nowrap;
}

.tagline {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
  white-space: nowrap;
}

/* ================= FRISE GRECQUE MÉANDRE ANTIQUE ================= */
.greek-frieze-bar {
  width: 100%;
  height: 14px;
  background-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14' viewBox='0 0 28 14'%3E%3Crect width='28' height='14' fill='%23206d82'/%3E%3Cline x1='0' y1='1' x2='28' y2='1' stroke='%230b1317' stroke-width='1.5'/%3E%3Cline x1='0' y1='13' x2='28' y2='13' stroke='%230b1317' stroke-width='1.5'/%3E%3Cpath d='M2 11 H24 V3 H8 V9 H18 V5 H12' fill='none' stroke='%230b1317' stroke-width='1.5' stroke-linecap='square'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 28px 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 40;
}

[data-theme="dark"] .greek-frieze-bar {
  background-color: #15242c;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14' viewBox='0 0 28 14'%3E%3Crect width='28' height='14' fill='%2315242c'/%3E%3Cline x1='0' y1='1' x2='28' y2='1' stroke='%23d8c19f' stroke-width='1.5'/%3E%3Cline x1='0' y1='13' x2='28' y2='13' stroke='%23d8c19f' stroke-width='1.5'/%3E%3Cpath d='M2 11 H24 V3 H8 V9 H18 V5 H12' fill='none' stroke='%23d8c19f' stroke-width='1.5' stroke-linecap='square'/%3E%3C/svg%3E");
  border-top: 1px solid #233742;
  border-bottom: 1px solid #233742;
}

/* ================= NAVIGATION PAR ONGLETS DU HEADER ================= */
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0 !important;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-shrink: 0 !important;
}

/* Onglets mobile masqués sur Desktop */
.header-mobile-tabs {
  display: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  height: 40px;
  max-height: 40px;
  box-sizing: border-box;
  font-family: var(--font-main);
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: var(--transition);
  position: relative;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-card-subtle);
}

.nav-link.active {
  color: var(--primary);
  background: var(--bg-card-subtle);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--primary);
}

[data-theme="dark"] .nav-link.active {
  color: var(--accent-sand);
  box-shadow: inset 0 -2px 0 var(--accent-sand);
}

.auth-btn-short {
  display: none;
}

.auth-btn-full {
  display: inline;
}

.logout-icon {
  display: none;
}

.logout-text {
  display: inline;
}

.btn-text-short {
  display: none;
}

.btn-text-full {
  display: inline;
}

.tab-label-short {
  display: none;
}

.tab-label-full {
  display: inline;
}

/* Bouton Dark Mode */
.btn-theme-toggle {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-theme-toggle:hover {
  transform: rotate(15deg) scale(1.06);
  background: var(--border);
  color: var(--primary);
}

.theme-icon-sun {
  display: none;
  align-items: center;
  justify-content: center;
}

.theme-icon-moon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .theme-icon-sun {
  display: inline-flex;
}

[data-theme="dark"] .theme-icon-moon {
  display: none;
}

/* Espace Utilisateur */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card-subtle);
  padding: 0.25rem 0.5rem 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.user-chip.clickable {
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.user-chip.clickable:hover {
  background: var(--border);
  color: var(--primary);
}

.badge-account-gear {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
}

.user-chip.clickable:hover .badge-account-gear {
  color: var(--primary);
  transform: rotate(45deg);
  transition: transform 0.25s ease;
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-weight: 600;
}

.btn-ghost:hover {
  color: var(--danger);
  background: var(--danger-light);
}

/* ================= BOUTONS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-main);
  font-size: 0.925rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
  box-shadow: 0 4px 12px rgba(35, 115, 138, 0.28);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(35, 115, 138, 0.38);
}

.btn-secondary {
  background: var(--bg-card-subtle);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text-primary);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background: #0f634d;
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: #fecaca;
}

.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-card-subtle);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.825rem;
  border-radius: var(--radius-sm);
}

.full-width {
  width: 100%;
}

/* ================= HERO SECTION (COMPACTE POUR GAGNER DE LA PLACE) ================= */
.hero-section {
  background: var(--hero-bg);
  padding: 1.75rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Ligne d'accentuation archéologique discrète et élégante */
.hero-section::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 5%, var(--accent-sand) 30%, var(--primary) 50%, var(--accent-sand) 70%, transparent 95%);
  opacity: 0.55;
}

.hero-container {
  display: flex;
  justify-content: center;
}

.hero-content-modern {
  max-width: 780px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--pill-bg);
  color: var(--pill-text);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.85rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.5rem;
  border: 1px solid rgba(32, 109, 130, 0.25);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}

.hero-content-modern h2 {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .hero-content-modern h2 {
    font-size: 1.45rem;
  }
}

.hero-content-modern p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.45;
  max-width: 620px;
  margin-bottom: 0.25rem;
}

.hero-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.85rem;
  width: 100%;
}

.stat-card {
  background: var(--bg-card);
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-width: 125px;
  position: relative;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-sand);
}

.stat-num {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

/* ================= BARRE D'ACTION AU-DESSUS DES ANNONCES ================= */
.announcements-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.announcements-header-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.announcements-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  letter-spacing: 0.02em;
}

.announcements-title .icon {
  color: var(--primary);
  width: 1.25rem;
  height: 1.25rem;
}

.announcements-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.btn-deposit-action {
  padding: 0.65rem 1.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: 0 3px 10px rgba(32, 109, 130, 0.25);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  transition: var(--transition);
}

.btn-deposit-action:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(32, 109, 130, 0.35);
}

.stat-card.highlight-green .stat-num {
  color: var(--success);
}

.stat-card.highlight-orange .stat-num {
  color: var(--warning);
}

.stat-card.highlight-blue .stat-num {
  color: #0284c7;
}

[data-theme="dark"] .stat-card.highlight-blue .stat-num {
  color: #38bdf8;
}

.stat-card.highlight-purple .stat-num {
  color: #7c3aed;
}

[data-theme="dark"] .stat-card.highlight-purple .stat-num {
  color: #a78bfa;
}

.clickable-stat {
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.clickable-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.hero-stats-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.hero-stats-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.65rem;
}

/* ================= CONTROLES ET FILTRES ================= */
.main-content {
  padding: 2rem 1.25rem 4rem;
  flex: 1;
}

.controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 100%;
  padding: 0.85rem 2.8rem 0.85rem 2.8rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  font-family: var(--font-main);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-input);
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(35, 115, 138, 0.15);
}

.clear-search {
  position: absolute;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
}

.filters-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .filters-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.status-filters {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.filter-btn {
  background: var(--bg-card-subtle);
  border: 1px solid transparent;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

.filter-btn.active svg {
  color: currentColor !important;
}

[data-theme="dark"] .filter-btn.active:not(.my-books-btn) {
  color: #071217;
}

.my-books-btn svg {
  color: var(--accent-sand-dark);
  fill: currentColor;
}

[data-theme="dark"] .my-books-btn svg {
  color: var(--accent-sand);
  fill: currentColor;
}

.my-books-btn.active {
  background: var(--accent-sand);
  color: #0d1519 !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(207, 180, 141, 0.3);
}

.my-books-btn.active svg {
  color: #0d1519 !important;
  fill: #0d1519 !important;
}

.my-books-btn.active:hover {
  background: var(--accent-sand-hover);
  color: #0d1519 !important;
}

.genre-filter select {
  font-family: var(--font-main);
  font-size: 0.875rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 500;
  width: 100%;
}

@media (min-width: 768px) {
  .genre-filter select {
    width: auto;
    min-width: 200px;
  }
}

/* ================= GRILLE DES LIVRES ================= */
.books-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .books-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* CARTE DE LIVRE */
.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.3s ease, border-color 0.3s ease;
  position: relative;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Couverture virtuelle stylisée aux couleurs archéologiques */
.book-card-cover {
  height: 145px;
  padding: 1.25rem;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #ffffff;
  overflow: hidden;
  box-shadow: inset 8px 0 16px -4px rgba(0, 0, 0, 0.45);
}

.book-card-cover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(14,23,28,0.1) 0%, rgba(14,23,28,0.72) 100%);
  pointer-events: none;
}

/* ================= FONDS ARCHÉOLOGIQUES PAR CATÉGORIE ================= */

/* 1. Égyptologie & Orient Ancien : Bleu Lapis-lazuli & Hiéroglyphes solaires */
.book-card-cover.category-egyptologie {
  background-color: #0e374d;
  background-image:
    radial-gradient(ellipse at 85% 20%, rgba(226, 190, 117, 0.28) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='70' viewBox='0 0 70 70'%3E%3Cg fill='none' stroke='%23e2be75' stroke-width='1.2' opacity='0.25'%3E%3Cellipse cx='18' cy='15' rx='6' ry='8'/%3E%3Cline x1='7' y1='23' x2='29' y2='23'/%3E%3Cline x1='18' y1='23' x2='18' y2='36'/%3E%3Cpath d='M42 18 Q53 10 64 18 Q53 26 42 18 Z'/%3E%3Ccircle cx='53' cy='18' r='3' fill='%23e2be75'/%3E%3Cpath d='M10 58 L20 46 L30 58'/%3E%3Cpath d='M44 62 Q54 48 64 62'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(140deg, #0e3448 0%, #1a5675 55%, #15455e 100%);
  background-size: auto, 70px 70px, auto;
}

/* 2. Antiquité grecque & romaine : Bleu Azur d'Égée & Frise de méandres */
.book-card-cover.category-antiquite {
  background-color: #134668;
  background-image:
    radial-gradient(ellipse at 85% 15%, rgba(135, 215, 245, 0.30) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%239cd6ed' stroke-width='1.3' opacity='0.25'%3E%3Cpath d='M4 24 H52 V4 H18 V16 H40 V10 H26'/%3E%3Cpath d='M4 52 H52 V32 H18 V44 H40 V38 H26'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(140deg, #103c5a 0%, #1e5c85 55%, #174b6c 100%);
  background-size: auto, 56px 56px, auto;
}

/* 3. Archéologie de terrain & Fouilles : Terre cuite de Tanagra & Strates géologiques */
.book-card-cover.category-fouilles {
  background-color: #8c3f1f;
  background-image:
    radial-gradient(ellipse at 85% 25%, rgba(250, 185, 125, 0.35) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23f7be92' stroke-width='1.2' opacity='0.28'%3E%3Cpath d='M0 14 Q32 24 64 12'/%3E%3Cpath d='M0 32 Q32 42 64 28'/%3E%3Cpath d='M0 50 Q32 58 64 46'/%3E%3Cline x1='24' y1='0' x2='24' y2='64' stroke-dasharray='3 3'/%3E%3Cline x1='48' y1='0' x2='48' y2='64' stroke-dasharray='3 3'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(140deg, #783416 0%, #ab5028 55%, #8f3e1c 100%);
  background-size: auto, 64px 64px, auto;
}

/* 4. Préhistoire & Protohistoire : Ocre de Lascaux & Silex taillé */
.book-card-cover.category-prehistoire {
  background-color: #693f20;
  background-image:
    radial-gradient(ellipse at 80% 20%, rgba(240, 195, 140, 0.32) 0%, transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23e8c092' stroke-width='1.3' opacity='0.26'%3E%3Cpolygon points='36 6 48 32 36 42 24 32'/%3E%3Cline x1='36' y1='42' x2='36' y2='60'/%3E%3Cpath d='M8 46 Q22 36 36 50 Q50 36 64 46'/%3E%3Ccircle cx='58' cy='18' r='3' fill='%23e8c092'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(140deg, #543015 0%, #7d4d29 55%, #663d1e 100%);
  background-size: auto, 72px 72px, auto;
}

/* 5. Archéologie médiévale & moderne : Carmin d'Enluminure & Ogives gothiques */
.book-card-cover.category-medieval {
  background-color: #6e1c2e;
  background-image:
    radial-gradient(ellipse at 85% 15%, rgba(245, 145, 165, 0.30) 0%, transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='none' stroke='%23f2abbb' stroke-width='1.2' opacity='0.25'%3E%3Cpath d='M10 52 V28 C10 16 30 6 30 6 C30 6 50 16 50 28 V52 Z'/%3E%3Cpath d='M20 52 V36 C20 26 30 18 30 18 C30 18 40 26 40 36 V52'/%3E%3Ccircle cx='30' cy='13' r='2.5'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(140deg, #591523 0%, #87253b 55%, #6c1b2c 100%);
  background-size: auto, 60px 60px, auto;
}

/* 6. Archéométrie & Bioarchéologie : Jade, Malachite & Cristallographie */
.book-card-cover.category-archeometrie {
  background-color: #174d39;
  background-image:
    radial-gradient(ellipse at 80% 20%, rgba(125, 235, 185, 0.30) 0%, transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%2392e6be' stroke-width='1.2' opacity='0.25'%3E%3Ccircle cx='32' cy='32' r='10'/%3E%3Ccircle cx='32' cy='32' r='20' stroke-dasharray='3 3'/%3E%3Ccircle cx='32' cy='32' r='28'/%3E%3Cpolygon points='32 4 54 44 10 44' opacity='0.5'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(140deg, #13402e 0%, #226b4e 55%, #1a553e 100%);
  background-size: auto, 64px 64px, auto;
}

/* 7. Histoire de l'Art & Civilisations : Pourpre Impérial de Tyr & Mosaïque antique */
.book-card-cover.category-histoire-art {
  background-color: #4a215b;
  background-image:
    radial-gradient(ellipse at 85% 20%, rgba(215, 155, 245, 0.32) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='54' height='54' viewBox='0 0 54 54'%3E%3Cg fill='none' stroke='%23ddb5f7' stroke-width='1.2' opacity='0.26'%3E%3Crect x='5' y='5' width='18' height='18' rx='2'/%3E%3Crect x='31' y='5' width='18' height='18' rx='2'/%3E%3Crect x='5' y='31' width='18' height='18' rx='2'/%3E%3Crect x='31' y='31' width='18' height='18' rx='2'/%3E%3Ccircle cx='27' cy='27' r='5'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(140deg, #3d194c 0%, #632e78 55%, #4e235f 100%);
  background-size: auto, 54px 54px, auto;
}

/* 8. Manuels & Méthodologie : Bleu Marine Technique & Rose des vents */
.book-card-cover.category-methodologie {
  background-color: #1a3245;
  background-image:
    radial-gradient(ellipse at 80% 20%, rgba(135, 195, 235, 0.30) 0%, transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%239cd3ee' stroke-width='1.2' opacity='0.26'%3E%3Ccircle cx='32' cy='32' r='24'/%3E%3Cline x1='32' y1='4' x2='32' y2='60'/%3E%3Cline x1='4' y1='32' x2='60' y2='32'/%3E%3Cpolygon points='32 14 36 28 32 32 28 28' fill='%239cd3ee'/%3E%3Cpolygon points='32 50 36 36 32 32 28 36' fill='%239cd3ee'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(140deg, #142736 0%, #274861 55%, #1d374a 100%);
  background-size: auto, 64px 64px, auto;
}

/* 9. Romans historiques & BD : Cuir Ambré de Reliure & Grimoire ancien */
.book-card-cover.category-romans {
  background-color: #703a15;
  background-image:
    radial-gradient(ellipse at 85% 20%, rgba(250, 205, 135, 0.34) 0%, transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='58' height='58' viewBox='0 0 58 58'%3E%3Cg fill='none' stroke='%23f5c98a' stroke-width='1.2' opacity='0.26'%3E%3Cpath d='M6 10 Q29 4 52 10 V48 Q29 42 6 48 Z'/%3E%3Cline x1='29' y1='7' x2='29' y2='45'/%3E%3Cpath d='M12 18 Q27 14 27 18'/%3E%3Cpath d='M12 25 Q27 21 27 25'/%3E%3Cpath d='M31 18 Q46 14 46 18'/%3E%3Cpath d='M31 25 Q46 21 46 25'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(140deg, #5c2e0e 0%, #8c4b1d 55%, #733c16 100%);
  background-size: auto, 58px 58px, auto;
}

/* 10. Autre discipline / Défaut : Basalte Minéral & Quartzite */
.book-card-cover.category-autre {
  background-color: #232f38;
  background-image:
    radial-gradient(ellipse at 80% 20%, rgba(170, 200, 215, 0.28) 0%, transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='54' height='54' viewBox='0 0 54 54'%3E%3Cg fill='none' stroke='%23acc7d6' stroke-width='1.2' opacity='0.22'%3E%3Cpolygon points='27 6 48 18 48 42 27 50 6 42 6 18'/%3E%3Cline x1='27' y1='6' x2='27' y2='50'/%3E%3Cline x1='6' y1='18' x2='48' y2='42'/%3E%3Cline x1='6' y1='42' x2='48' y2='18'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(140deg, #1b252c 0%, #30404b 55%, #25323a 100%);
  background-size: auto, 54px 54px, auto;
}

/* Thèmes Archéo de secours (modernisés et lumineux) */
.cover-blue, .cover-petrol { background: linear-gradient(140deg, #103c5a 0%, #1e5c85 55%, #174b6c 100%); }
.cover-gold, .cover-sand { background: linear-gradient(140deg, #6e4c25 0%, #9e723e 55%, #7f582c 100%); }
.cover-ruby, .cover-terracotta { background: linear-gradient(140deg, #783416 0%, #ab5028 55%, #8f3e1c 100%); }
.cover-emerald, .cover-bronze { background: linear-gradient(140deg, #13402e 0%, #226b4e 55%, #1a553e 100%); }
.cover-purple, .cover-slate { background: linear-gradient(140deg, #3d194c 0%, #632e78 55%, #4e235f 100%); }

/* Bloc de prévisualisation dynamique dans les modales */
.category-preview-box {
  height: 85px;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.category-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.25);
  position: relative;
  z-index: 2;
}

.category-preview-hint {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 2;
}

.cover-badge-top {
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
  z-index: 2;
}

.cover-badge-owner {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2;
  background: rgba(207, 180, 141, 0.45);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.cover-title {
  position: relative;
  z-index: 2;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.65);
  word-break: break-word;
}

.cover-author {
  position: relative;
  z-index: 2;
  font-size: 0.85rem;
  opacity: 0.94;
  margin-top: 0.25rem;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Contenu de la fiche */
.book-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.tag {
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.tag.tag-genre {
  background: var(--primary-light);
  color: var(--primary);
}

.book-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

/* Pied de carte avec statut et bouton */
.book-card-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.book-owner-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* BADGES DE STATUT SUR COUVERTURE */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
}

.badge-available {
  background: rgba(21, 128, 100, 0.9);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .badge-available {
  background: rgba(21, 128, 100, 0.9);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.badge-reserved {
  background: rgba(194, 97, 39, 0.92);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .badge-reserved {
  background: rgba(194, 97, 39, 0.92);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.card-actions-row {
  display: flex;
  gap: 0.5rem;
}

.btn-reserve {
  flex: 1;
}

.btn-owner-manage {
  flex: 1;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.btn-owner-manage:hover {
  background: var(--border);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-reserved-disabled {
  flex: 1;
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: not-allowed;
  font-size: 0.85rem;
}

/* ================= ÉTAT VIDE ================= */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  max-width: 500px;
  margin: 2rem auto;
}

.empty-icon {
  color: var(--primary);
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* ================= MODALES ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 17, 20, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.open {
  opacity: 1 !important;
  visibility: visible !important;
  display: flex !important;
  pointer-events: auto !important;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  transform: scale(0.95);
  transition: transform 0.25s ease;
  box-sizing: border-box;
}

@media (max-width: 540px) {
  .modal-card {
    padding: 1.25rem 1rem;
    max-height: 94vh;
    border-radius: var(--radius-md);
  }
}

.modal-overlay.open .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--text-primary);
}

.modal-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

/* Onglets d'authentification */
.auth-tabs {
  display: flex;
  background: var(--bg-card-subtle);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.auth-tab-btn {
  flex: 1;
  padding: 0.6rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.auth-tab-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Formulaires */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 600px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
  .form-group.full-width {
    grid-column: span 2;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.required {
  color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
  font-family: var(--font-main);
  font-size: 0.9rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-primary);
  background: var(--bg-input);
  transition: var(--transition);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.form-group select {
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(35, 115, 138, 0.16);
}

.helper-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* PIN input */
.pin-box {
  background: var(--bg-card-subtle);
  border: 1px dashed var(--border);
  padding: 1rem;
  border-radius: var(--radius-md);
}

.pin-input-group {
  display: flex;
  gap: 0.5rem;
}

.pin-input-group input {
  flex: 1;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-align: center;
  font-weight: 700;
}

/* Sélecteur de couleur thème aux teintes archéologiques */
.theme-picker {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.theme-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.theme-dot:hover {
  transform: scale(1.15);
}

.theme-dot.active {
  border-color: var(--text-primary);
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Pillule de résumé de livre */
.book-summary-pill {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--bg-card-subtle);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.pill-details {
  display: flex;
  flex-direction: column;
}

.pill-details strong {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.pill-details span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.info-alert {
  background: var(--primary-light);
  border: 1px solid rgba(35, 115, 138, 0.3);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  margin-top: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

/* Modale de succès */
.success-card {
  text-align: center;
}

.success-icon {
  color: var(--primary);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: center;
}

.contact-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 1.25rem 0;
  text-align: left;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--border);
}

.contact-row:last-child {
  border-bottom: none;
}

.contact-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Espace Propriétaire */
.book-status-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.management-actions {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.action-desc {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.highlight-text {
  color: var(--primary);
  font-weight: 700;
}

.account-info-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.edit-zone {
  background: var(--bg-card-subtle);
  border: 1px dashed var(--border);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
}

/* ================= TOASTS ================= */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 200;
  pointer-events: none;
}

.toast {
  background: var(--text-primary);
  color: var(--bg-card);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideIn 0.3s ease forwards;
}

.toast.toast-success {
  background: var(--success);
  color: #ffffff;
}

.toast.toast-error {
  background: var(--danger);
  color: #ffffff;
}

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

/* ================= COMPOSANTS PAGE D'ACCUEIL ================= */
.home-hero .hero-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-lg {
  padding: 0.8rem 1.6rem;
  font-size: 1rem;
}

.btn-nav-cta {
  font-size: 0.85rem;
  padding: 0.5rem 0.95rem;
}

.home-section {
  margin-bottom: 4.5rem;
}

.section-header-center {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 2.5rem;
}

.section-header-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-sand-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 0.35rem;
}

[data-theme="dark"] .section-eyebrow {
  color: var(--accent-sand);
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  color: var(--text-primary);
  line-height: 1.25;
}

.section-desc {
  color: var(--text-secondary);
  margin-top: 0.35rem;
  font-size: 0.975rem;
}

/* Grille des pôles BDE */
.bde-poles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.pole-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.pole-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-sand);
}

.pole-card.highlight-pole {
  border-top: 3px solid var(--primary);
}

.pole-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
}

.pole-icon-box .icon {
  width: 1.45em;
  height: 1.45em;
}

.pole-card h4 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  margin-bottom: 0.65rem;
  color: var(--text-primary);
}

.pole-card p {
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.55;
  flex: 1;
  margin-bottom: 1.25rem;
}

.pole-link {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: gap 0.2s ease;
}

.pole-link:hover {
  gap: 0.5rem;
  color: var(--primary-hover);
}

.pole-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Bannière contact BDE */
.bde-contact-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  background-image: radial-gradient(circle at 100% 0%, rgba(32, 109, 130, 0.08) 0%, transparent 60%);
}

.contact-banner-text h3 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.contact-banner-text p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.home-cta-center {
  text-align: center;
  margin-top: 2.5rem;
}

/* ================= FICHES DE STAGE & RETOURS D'EXPÉRIENCE ================= */
.stages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
}

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

.stage-card-header {
  padding: 1.15rem 1.25rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.badge-stage-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-card-subtle);
  color: var(--primary);
  border: 1px solid rgba(32, 109, 130, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stage-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stage-card-body {
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.75rem;
}

.stage-card-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  margin: 0;
}

.stage-meta-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stage-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stage-meta-item strong {
  color: var(--text-primary);
}

.stage-meta-item .icon {
  width: 0.95em;
  height: 0.95em;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Jauges de critères prédéfinis */
.stage-ratings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  background: var(--bg-card-subtle);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-top: 0.25rem;
}

.rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.rating-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.rating-stars {
  color: #f59e0b;
  letter-spacing: 0.1em;
  font-size: 0.85rem;
}

.stage-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.25rem;
}

.stage-card-footer {
  padding: 0.85rem 1.25rem;
  background: var(--bg-card-subtle);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.stage-author-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stage-author-chip strong {
  color: var(--text-primary);
}

/* Formulaire de publication de stage (Notes interactives) */
.stage-ratings-box {
  background: var(--bg-card-subtle);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ratings-box-title {
  font-size: 0.95rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.criteria-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--border);
}

.criteria-row:last-child {
  border-bottom: none;
}

.criteria-info {
  display: flex;
  flex-direction: column;
}

.criteria-info strong {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.criteria-info small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.star-picker {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  min-width: 140px;
}

.rating-slider {
  width: 120px;
  cursor: pointer;
  accent-color: var(--primary);
}

.star-display {
  font-size: 0.85rem;
  color: #f59e0b;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.star-display span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Modale détail de fiche de stage */
.detail-stage-badges {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.stage-ratings-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.rating-stat-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.rating-stat-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.rating-stat-score {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
}

.rating-stat-stars {
  color: #f59e0b;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.detail-info-item {
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-section-block {
  margin-bottom: 1.25rem;
}

.detail-section-block h4 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}

.detail-text {
  font-size: 0.925rem;
  color: var(--text-secondary);
  line-height: 1.6;
  background: var(--bg-card-subtle);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  white-space: pre-wrap;
}

.detail-section-block.tips-block .detail-text {
  border-left: 3px solid #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

/* Onglets d'en-tête : labels adaptatifs */
.tab-label-short {
  display: none;
}

.tab-label-full {
  display: inline;
}

/* ================= FOOTER ================= */
.site-footer {
  position: relative;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: auto;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.footer-disclaimer {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.65rem;
  line-height: 1.45;
  letter-spacing: 0.01em;
}

.footer-version-tag {
  position: absolute;
  bottom: 0.5rem;
  right: 1.25rem;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 500;
  color: #888888;
  opacity: 0.8;
  letter-spacing: 0.04em;
  user-select: none;
}

[data-theme="dark"] .footer-version-tag {
  color: #71717a;
}

/* ================= SECTION STAGES ================= */
.stages-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .stages-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .stages-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Carte de Stage */
.stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.3s ease;
}

.stage-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-sand);
}

.stage-card-header {
  padding: 1rem 1.25rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.5rem;
}

.badge-stage-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: rgba(35, 115, 138, 0.12);
  color: var(--primary);
  border: 1px solid rgba(35, 115, 138, 0.25);
}

[data-theme="dark"] .badge-stage-type {
  background: rgba(86, 172, 196, 0.15);
  color: var(--accent-sand);
  border-color: rgba(86, 172, 196, 0.3);
}

.badge-stage-period {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stage-card-body {
  padding: 1.15rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stage-card-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0;
}

.stage-card-structure {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}

.stage-card-supervisor {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Évaluations miniatures dans la carte */
.stage-ratings-mini {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--bg-card-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-top: auto;
}

.rating-mini-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}

.rating-mini-label {
  color: var(--text-secondary);
}

.rating-mini-stars {
  color: #eab308;
  font-weight: 700;
  letter-spacing: 0.05em;
}

[data-theme="dark"] .rating-mini-stars {
  color: #facc15;
}

.stage-card-excerpt {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stage-card-footer {
  padding: 0.75rem 1.25rem;
  background: var(--bg-card-subtle);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stage-card-footer .author-badge {
  font-weight: 600;
  color: var(--text-secondary);
}

.stage-card-footer .view-link {
  color: var(--primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Formulaire de notation des critères */
.stage-ratings-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 0.5rem;
}

.ratings-box-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.85rem 0;
}

.criteria-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.criteria-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.criteria-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.criteria-info strong {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.criteria-info small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ================= ÉTOILES INTERACTIVES & DEMI-ÉTOILES ================= */
.star-interactive-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.75rem;
  user-select: none;
  touch-action: manipulation;
}

.stars-track {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.star-item {
  position: relative;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: inline-block;
}

.star-half {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 5;
  cursor: pointer;
}
.star-half.left {
  left: 0;
}
.star-half.right {
  right: 0;
}

.star-svg-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  fill: #e2e8f0;
  stroke: #cbd5e1;
  stroke-width: 1;
  transition: transform 0.1s ease;
}

[data-theme="dark"] .star-svg-bg {
  fill: #334155;
  stroke: #475569;
}

.star-svg-fg {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  transition: width 0.12s ease-out;
}

.star-svg-fg svg {
  width: 32px;
  height: 32px;
  min-width: 32px;
  fill: #f59e0b;
  stroke: #d97706;
  stroke-width: 1;
}

.star-item:hover .star-svg-bg,
.star-item:active .star-svg-bg {
  transform: scale(1.12);
}

.star-item:hover .star-svg-fg svg,
.star-item:active .star-svg-fg svg {
  transform: scale(1.12);
}

.star-score-badge {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 54px;
  text-align: right;
}

.star-score-badge .score-number {
  font-size: 1.05rem;
  font-weight: 800;
}

/* Affichage universel SVG (pleines, demies, vides) pour cartes et modales */
.star-display-svgs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  vertical-align: middle;
}

.star-unit-view {
  position: relative;
  display: inline-block;
  width: var(--star-size, 16px);
  height: var(--star-size, 16px);
  flex-shrink: 0;
}

.star-unit-view svg {
  width: 100%;
  height: 100%;
  display: block;
}

.star-unit-view.full svg {
  fill: #f59e0b;
  stroke: #d97706;
  stroke-width: 1;
}

.star-unit-view.empty svg {
  fill: #e2e8f0;
  stroke: #cbd5e1;
  stroke-width: 1;
}

[data-theme="dark"] .star-unit-view.empty svg {
  fill: #334155;
  stroke: #475569;
}

.star-unit-view.half {
  position: relative;
}

.star-unit-view.half .star-bg {
  position: absolute;
  top: 0;
  left: 0;
  fill: #e2e8f0;
  stroke: #cbd5e1;
  stroke-width: 1;
}

[data-theme="dark"] .star-unit-view.half .star-bg {
  fill: #334155;
  stroke: #475569;
}

.star-unit-view.half .star-clip-half {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
}

.star-unit-view.half .star-clip-half svg {
  width: var(--star-size, 16px);
  height: var(--star-size, 16px);
  min-width: var(--star-size, 16px);
  fill: #f59e0b;
  stroke: #d97706;
  stroke-width: 1;
}

/* Modale de Détail de Stage */
.detail-stage-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
}

.stage-ratings-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stage-rating-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.rating-card-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 600;
}

.rating-card-stars {
  color: #eab308;
  font-size: 1.1rem;
  line-height: 1;
}

.rating-card-score {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}

.detail-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.info-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.detail-info-item strong {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.detail-section-block {
  margin-bottom: 1.25rem;
}

.detail-section-block h4 {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.5rem 0;
}

.detail-section-block .detail-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  margin: 0;
}

.detail-section-block.tips-block {
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
}

.detail-section-block.tips-block h4 {
  color: #b45309;
}

[data-theme="dark"] .detail-section-block.tips-block {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .detail-section-block.tips-block h4 {
  color: #fbbf24;
}

@media (max-width: 640px) {
  .stage-ratings-summary {
    grid-template-columns: 1fr;
  }
  .detail-info-grid {
    grid-template-columns: 1fr;
  }
  .criteria-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .star-interactive-picker {
    width: 100%;
    justify-content: space-between;
    box-sizing: border-box;
  }
}

/* ================= ADAPTATION INTERMÉDIAIRE TABLETTES & PETITS ÉCRANS (901px à 1120px) ================= */
@media (max-width: 1120px) {
  .header-main-container {
    gap: 1rem;
  }

  .tagline,
  .logo-text .tagline {
    display: none !important;
  }

  .logo-text h1,
  .logo-text .site-title {
    font-size: 1.3rem;
  }
}

@media (max-width: 1020px) {
  .header-main-container {
    gap: 0.6rem;
  }

  .btn-text-full {
    display: none !important;
  }

  .btn-text-short {
    display: inline !important;
  }

  .auth-btn-full {
    display: none !important;
  }

  .auth-btn-short {
    display: inline !important;
  }

  .nav-link {
    padding: 0.4rem 0.75rem;
    font-size: 0.86rem;
  }
}

/* ================= RESPONSIVE MOBILE & TABLETTE PORTRAIT (<= 900px) ================= */
@media (max-width: 900px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
  }

  /* Barre Principale : 1 seule ligne garantie */
  .header-main-bar {
    width: 100%;
  }

  .header-main-container {
    height: 52px;
    padding: 0 0.75rem;
    gap: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    box-sizing: border-box;
  }

  /* Logo compact */
  .logo-area {
    gap: 0.45rem;
    flex-shrink: 1;
    min-width: 0;
  }

  .logo-img {
    width: 34px;
    height: 34px;
    border-width: 2px;
    flex-shrink: 0;
  }

  .logo-text {
    min-width: 0;
  }

  .logo-text h1,
  .logo-text .site-title {
    font-size: 1.12rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Tagline masquée sur mobile */
  .tagline,
  .logo-text .tagline {
    display: none !important;
  }

  /* Navigation Desktop masquée sur mobile */
  .desktop-nav {
    display: none !important;
  }

  /* Actions à droite compactes */
  .header-right {
    gap: 0.3rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    margin-left: auto;
  }

  /* Bouton Connexion / Inscription compact */
  .auth-btn-full {
    display: none !important;
  }

  .auth-btn-short {
    display: inline !important;
  }

  .user-auth-actions .btn {
    padding: 0.35rem 0.55rem !important;
    font-size: 0.78rem !important;
    height: 34px;
  }

  /* Badge Utilisateur connecté compact */
  .user-profile-badge {
    padding: 0.15rem 0.3rem 0.15rem 0.45rem !important;
    gap: 0.2rem !important;
    height: 34px;
    box-sizing: border-box;
    border-radius: var(--radius-full);
  }

  .user-chip {
    padding: 0.1rem 0.2rem !important;
    gap: 0.25rem !important;
  }

  .user-chip .user-name {
    max-width: 65px !important;
    font-size: 0.8rem !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .badge-account-gear {
    display: none !important;
  }

  /* Bouton Déconnexion : icône seule 28x28px */
  #logoutBtn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 0 !important;
    font-size: 0.8rem;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
  }

  .logout-text {
    display: none !important;
  }

  .logout-icon {
    display: inline-block !important;
    width: 15px;
    height: 15px;
  }

  /* Bouton Mode Sombre compact 34x34px */
  .btn-theme-toggle {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    flex-shrink: 0;
  }

  /* Ligne 2 : Barre d'onglets de navigation mobile (Pleine largeur 50%/50%) */
  .header-mobile-tabs {
    display: block !important;
    width: 100%;
    background: var(--bg-card-subtle);
    border-top: 1px solid var(--border);
    padding: 0.25rem 0.75rem;
    box-sizing: border-box;
  }

  .mobile-tabs-container {
    display: flex;
    gap: 0.4rem;
    width: 100%;
    padding: 0 !important;
    box-sizing: border-box;
  }

  .mobile-tab-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: 1px solid transparent;
    text-align: center;
    box-sizing: border-box;
  }

  .mobile-tab-btn .icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
  }

  .mobile-tab-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    border-color: var(--border);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
  }

  .tab-label-short {
    display: inline !important;
  }

  .tab-label-full {
    display: none !important;
  }

  /* Frise grecque méandre antique sur mobile */
  .greek-frieze-bar {
    height: 10px;
    background-size: 20px 10px;
  }

  /* Section Hero Mobile Compacte */
  .hero-section {
    padding: 1.15rem 0 0.85rem;
  }

  .hero-content-modern h2 {
    font-size: 1.35rem;
    line-height: 1.18;
    margin-bottom: 0.25rem;
  }

  .hero-content-modern p {
    font-size: 0.825rem;
    line-height: 1.35;
    margin-bottom: 0.15rem;
  }

  .pill-badge {
    font-size: 0.68rem;
    padding: 0.2rem 0.65rem;
    text-align: center;
    margin-bottom: 0.4rem;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    width: 100%;
    margin-top: 0.65rem;
  }

  .hero-stats-4 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.65rem;
  }

  .hero-stats-5 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.65rem;
  }

  .hero-stats-5 .stat-card:first-child {
    grid-column: 1 / -1;
  }

  .stat-card {
    min-width: 0;
    padding: 0.45rem 0.3rem;
    text-align: center;
    align-items: center;
    border-radius: var(--radius-sm);
  }

  .stat-num {
    font-size: 1.25rem;
  }

  .stat-label {
    font-size: 0.65rem;
    line-height: 1.15;
    margin-top: 0.1rem;
  }

  /* Barre d'action au-dessus des annonces sur mobile */
  .announcements-action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    text-align: center;
    margin-bottom: 1rem;
  }

  .announcements-header-info {
    align-items: center;
  }

  .announcements-title {
    font-size: 1.1rem;
    justify-content: center;
  }

  .announcements-desc {
    font-size: 0.78rem;
  }

  .btn-deposit-action {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }

  /* En-tête de section avec bouton */
  .section-header-between {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }

  .section-header-between .btn {
    width: 100%;
    justify-content: center;
  }

  /* Filtres & Recherche sur /livres */
  .filters-container {
    padding: 1rem;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
  }

  .search-box input {
    font-size: 16px !important;
    padding: 0.75rem 2.6rem 0.75rem 2.5rem;
  }

  .filters-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .status-filters {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
  }

  .status-filters::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  .genre-filter select {
    font-size: 16px !important;
    width: 100%;
  }

  /* Cartes de livres */
  .book-card-cover {
    height: 135px;
    padding: 1rem;
  }

  .cover-title {
    font-size: 1.2rem;
  }

  .book-card-body {
    padding: 1rem;
  }

  .book-card-footer .btn {
    min-height: 42px;
  }

  /* Formulaires & Modales sur mobile */
  .modal-overlay {
    padding: 0.5rem;
    align-items: center;
    justify-content: center;
  }

  .modal-card {
    max-height: 90vh;
    padding: 1.25rem 1rem;
    border-radius: var(--radius-lg);
    width: 100%;
    margin: 0;
    box-sizing: border-box;
  }

  .modal-header h3 {
    font-size: 1.2rem;
  }

  .modal-footer {
    flex-direction: column-reverse;
    gap: 0.5rem;
    margin-top: 1.25rem;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }

  /* Neutralise le zoom automatique iOS Safari sur tous les champs */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Espace compte / pin */
  .pin-input-group {
    display: flex;
    gap: 0.5rem;
  }

  .pin-input-group input {
    font-size: 1.25rem !important;
    letter-spacing: 0.2em;
    text-align: center;
  }

  /* Notification Toast */
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    max-width: 100%;
  }
}

/* Écrans très étroits (< 380px comme iPhone SE / Galaxy Mini) */
@media (max-width: 380px) {
  .header-main-container {
    padding: 0 0.4rem;
    gap: 0.25rem;
  }

  .logo-img {
    width: 30px;
    height: 30px;
  }

  .logo-text h1,
  .logo-text .site-title {
    font-size: 0.98rem;
  }

  .header-right {
    gap: 0.2rem;
  }

  .btn-theme-toggle {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
  }

  .user-auth-actions .btn {
    padding: 0.3rem 0.45rem !important;
    font-size: 0.72rem !important;
    height: 30px;
  }

  .user-profile-badge {
    height: 30px;
    padding: 0.1rem 0.25rem !important;
  }

  .user-chip .user-name {
    max-width: 45px !important;
    font-size: 0.72rem !important;
  }

  #logoutBtn {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
  }

  .mobile-tab-btn {
    font-size: 0.78rem;
    padding: 0.4rem 0.2rem;
    gap: 0.25rem;
  }

  .hero-content-modern h2 {
    font-size: 1.45rem;
  }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
}

/* ================= DASHBOARD D'ADMINISTRATION ================= */

/* Règles de visibilité stricte du bouton et des liens Admin */
.admin-nav-link,
.admin-only {
  display: none !important;
}

.user-is-staff .admin-nav-link,
.user-is-staff .admin-only {
  display: inline-flex !important;
}

.user-is-staff .mobile-tabs-container .admin-nav-link {
  display: flex !important;
}

.nav-admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626 !important;
  border: 1px solid rgba(220, 38, 38, 0.3);
  font-weight: 700 !important;
  border-radius: var(--radius-full);
  padding: 0.32rem 0.75rem !important;
  transition: var(--transition);
}

[data-theme="dark"] .nav-admin-badge {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171 !important;
  border-color: rgba(239, 68, 68, 0.4);
}

.nav-admin-badge:hover,
.nav-admin-badge.active {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.35);
}

.admin-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.3);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.6rem;
}

[data-theme="dark"] .admin-header-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.admin-tabs-nav {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.4rem 0.2rem 0.8rem;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 1.5rem;
}

.admin-tab-btn {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.55rem 1.15rem;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.admin-tab-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.admin-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(32, 109, 130, 0.3);
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.admin-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.admin-kpi-icon.books { background: rgba(32, 109, 130, 0.12); color: var(--primary); }
.admin-kpi-icon.reserved { background: rgba(217, 119, 6, 0.12); color: #d97706; }
.admin-kpi-icon.stages { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.admin-kpi-icon.users { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }

.admin-kpi-content {
  display: flex;
  flex-direction: column;
}

.admin-kpi-val {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.admin-kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.2rem;
}

.admin-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 2rem;
}

.admin-table-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-subtle);
}

.admin-table-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-search-input {
  min-width: 260px;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-main);
  outline: none;
  transition: var(--transition);
}

.admin-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(32, 109, 130, 0.15);
}

#adminMainContent {
  max-width: 1380px;
  width: 96%;
}

.admin-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.admin-table th {
  padding: 0.75rem 0.65rem;
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.admin-contact-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.admin-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  color: var(--text-primary);
}

.admin-count-pill strong {
  font-weight: 700;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-badge.badge-role-admin {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.3);
}

[data-theme="dark"] .admin-badge.badge-role-admin {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.admin-badge.badge-role-moderator {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

[data-theme="dark"] .admin-badge.badge-role-moderator {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
}

.admin-badge.badge-role-user {
  background: var(--bg-card-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.admin-badge.badge-status-available {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.admin-badge.badge-status-reserved {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.3);
}

.admin-actions-cell {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.btn-admin-action {
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-admin-danger {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.3);
}

.btn-admin-danger:hover {
  background: #dc2626;
  color: #ffffff;
}

.btn-admin-warning {
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
  border-color: rgba(217, 119, 6, 0.3);
}

.btn-admin-warning:hover {
  background: #d97706;
  color: #ffffff;
}

.btn-admin-secondary {
  background: var(--bg-card-subtle);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-admin-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.admin-denied-box {
  max-width: 550px;
  margin: 4rem auto;
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.admin-denied-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.admin-denied-box h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.admin-denied-box p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* ================= RESPONSIVE MOBILE DASHBOARD ADMIN ================= */

@media (max-width: 768px) {
  #adminMainContent {
    padding-top: 1rem;
    padding-bottom: 2rem;
  }

  .admin-header-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.65rem;
  }

  .admin-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }

  .admin-kpi-card {
    padding: 0.85rem;
    gap: 0.75rem;
  }

  .admin-kpi-icon {
    width: 38px;
    height: 38px;
  }

  .admin-kpi-val {
    font-size: 1.35rem;
  }

  .admin-kpi-label {
    font-size: 0.75rem;
  }

  /* Onglets défilables horizontalement */
  .admin-tabs-nav {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 1.25rem;
    scrollbar-width: none;
  }

  .admin-tabs-nav::-webkit-scrollbar {
    display: none;
  }

  .admin-tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
  }

  /* En-tête de table et filtres empilés */
  .admin-table-card {
    border-radius: var(--radius-lg);
    overflow: visible;
  }

  .admin-table-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 1rem;
  }

  .admin-table-header-bar > div {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  .admin-table-title {
    font-size: 1.05rem;
  }

  .admin-search-input {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Transformation des tables en cartes mobiles fluides */
  .admin-table-container {
    overflow-x: visible;
    border: none;
  }

  .admin-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table tbody {
    display: block;
    width: 100%;
  }

  .admin-table tbody tr {
    display: block;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.9rem 1rem;
    margin-bottom: 0.9rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
  }

  .admin-table tbody tr:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
  }

  .admin-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 0.85rem;
    text-align: right;
    white-space: normal;
  }

  [data-theme="dark"] .admin-table td {
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }

  .admin-table td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 0.75rem;
    text-align: left;
    flex-shrink: 0;
  }

  .admin-table td:last-child {
    border-bottom: none;
    padding-top: 0.75rem;
    margin-top: 0.25rem;
    justify-content: flex-end;
  }

  /* Lignes de chargement / état vide */
  .admin-table td[colspan] {
    display: block;
    text-align: center;
    padding: 2rem 1rem;
  }

  .admin-table td[colspan]::before {
    display: none;
  }

  .admin-actions-cell {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
  }

  .btn-admin-action {
    padding: 0.42rem 0.7rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .admin-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ================= SYSTÈME D'ACTUALITÉS BDE (STYLE CAMPUS / RENNES 2) ================= */
.news-section-header {
  margin-bottom: 1.5rem;
}

.news-title-wrapper {
  display: inline-block;
  position: relative;
  margin-bottom: 0.25rem;
}

.news-section-title {
  font-family: 'Cinzel', serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.02em;
}

.news-title-bar {
  width: 46px;
  height: 3.5px;
  background-color: #47761E; /* Vert emblématique du campus Rennes 2 */
  border-radius: 2px;
  margin-top: 0.45rem;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1rem;
}

.news-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  cursor: pointer;
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #47761E;
}

.news-card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--bg-secondary);
  overflow: hidden;
}

.news-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

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

/* Badge de catégorie incrusté en haut à gauche (modèle Rennes 2) */
.news-card-badge {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
  background-color: #47761E; /* Vert foncé formation / vie étudiante */
  border-bottom-right-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.02em;
  z-index: 2;
  text-transform: capitalize;
}

/* Couleurs adaptatives selon les catégories */
.news-card-badge.cat-formation,
.news-card-badge.cat-rencontre {
  background-color: #47761E;
}

.news-card-badge.cat-sortie-musee {
  background-color: #2b6cb0;
}

.news-card-badge.cat-soiree-bde {
  background-color: #c05621;
}

.news-card-badge.cat-reunion--ag {
  background-color: #6b46c1;
}

.news-card-badge.cat-chantier--fouilles {
  background-color: #8c531b;
}

.news-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.news-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.news-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.news-card-title {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  margin: 0 0 0.6rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card-summary {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 1rem 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card-action {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: auto;
  transition: gap 0.2s ease;
}

.news-card:hover .news-card-action {
  gap: 0.55rem;
}

/* ================= MODALE DÉTAIL ACTUALITÉ ================= */
.news-detail-modal-card {
  max-width: 680px;
}

.news-modal-badge {
  background-color: #47761E;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
}

.news-modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.4rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.news-modal-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.news-modal-body {
  padding: 1.25rem;
}

.news-modal-img-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1.25rem;
  background: var(--bg-secondary);
}

.news-modal-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-modal-content-text {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-primary);
  white-space: pre-line;
}

.news-modal-author {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ================= TABLE ACTUALITÉS ADMIN ================= */
.admin-news-thumb {
  width: 58px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  display: block;
  background-color: var(--bg-secondary);
}

/* Responsive Actualités */
@media (max-width: 992px) {
  .news-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
}

/* ================= GESTION DU CODE PIN ADMIN ================= */
.admin-pin-card {
  background: linear-gradient(135deg, rgba(162, 94, 43, 0.08) 0%, rgba(71, 118, 30, 0.08) 100%);
  border: 1.5px solid rgba(162, 94, 43, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
}

.admin-pin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.admin-pin-card-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.admin-pin-status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(71, 118, 30, 0.15);
  color: var(--primary);
  border: 1px solid rgba(71, 118, 30, 0.3);
}

.admin-pin-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}

.admin-pin-digits {
  font-family: 'Courier New', Courier, monospace, var(--font-sans);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.35rem;
  color: var(--secondary);
  user-select: all;
}

.admin-pin-tools {
  display: flex;
  gap: 0.4rem;
}

.btn-pin-tool {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-pin-tool:hover {
  background: var(--border);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.admin-pin-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.65rem;
  margin-bottom: 0;
  line-height: 1.4;
}

.admin-pin-change-section {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
}

.admin-pin-change-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.88rem;
  color: var(--text-primary);
}

/* ================= INPUT WITH ACTION / BOUTON ALÉATOIRE ================= */
.input-with-action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.input-with-action input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 0.85rem;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.input-with-action input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(71, 118, 30, 0.15);
}

.btn-input-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 42px;
  padding: 0 1rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-input-action:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(71, 118, 30, 0.25);
}

.btn-input-action:hover .icon {
  stroke: #ffffff;
}

.btn-input-action:active {
  transform: translateY(0);
}

/* ================= MODALE DE CONFIRMATION UNIVERSELLE ================= */
.confirm-modal-card {
  padding: 1.5rem 1.6rem !important;
  text-align: left;
  box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--border);
}

.confirm-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.confirm-modal-icon-bubble {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(190, 46, 46, 0.12);
  color: var(--danger);
  border: 1px solid rgba(190, 46, 46, 0.25);
  flex-shrink: 0;
}

.confirm-modal-icon-bubble.primary {
  background: rgba(71, 118, 30, 0.12);
  color: var(--primary);
  border-color: rgba(71, 118, 30, 0.25);
}

.confirm-modal-icon-bubble.warning {
  background: rgba(162, 94, 43, 0.12);
  color: var(--secondary);
  border-color: rgba(162, 94, 43, 0.25);
}

.confirm-modal-icon-bubble .icon {
  width: 22px;
  height: 22px;
}

.confirm-modal-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.confirm-modal-message {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 1.5rem 0;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.confirm-modal-actions .btn {
  min-width: 110px;
  justify-content: center;
}

[data-theme="dark"] .confirm-modal-card {
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .btn-danger {
  background: rgba(190, 46, 46, 0.2);
  color: #ff7b7b;
  border-color: rgba(190, 46, 46, 0.45);
}

[data-theme="dark"] .btn-danger:hover {
  background: #be2e2e;
  color: #ffffff;
  border-color: #be2e2e;
}

/* ================= ZONE DE DANGER RGPD / MON COMPTE ================= */
.account-danger-zone {
  margin-top: 1.5rem;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius-md);
  background: rgba(190, 46, 46, 0.05);
  border: 1.5px dashed rgba(190, 46, 46, 0.35);
  text-align: left;
}

[data-theme="dark"] .account-danger-zone {
  background: rgba(190, 46, 46, 0.09);
  border-color: rgba(190, 46, 46, 0.45);
}

.account-danger-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 0.4rem;
}

.account-danger-title .icon {
  width: 18px;
  height: 18px;
  color: var(--danger);
}

.account-danger-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
}



