/* ==========================================================================
   Foyer Rural de Salles-sur-Mer - Admin Stylesheet
   ========================================================================== */

:root {
  --admin-primary: #1e7d43;
  --admin-primary-dark: #14592f;
  --admin-primary-light: #e8f5ed;
  --admin-danger: #dc2626;
  --admin-danger-light: #fee2e2;
  --admin-warning: #f59e0b;
  --admin-warning-light: #fef3c7;
  --admin-blue: #2563eb;
  --admin-blue-light: #dbeafe;
  --admin-bg: #f3f4f6;
  --admin-card: #ffffff;
  --admin-border: #e5e7eb;
  --admin-text: #1f2937;
  --admin-text-muted: #6b7280;
  --admin-radius: 10px;
}

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--admin-bg);
  color: var(--admin-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #111827;
}

.login-header p {
  color: var(--admin-text-muted);
  font-size: 0.9rem;
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--admin-border);
}

/* Admin Navbar */
.admin-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.1rem;
  color: #111827;
  text-decoration: none;
}

.admin-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Container */
.admin-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

/* Tabs */
.tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  background: #ffffff;
  padding: 0.5rem;
  border-radius: var(--admin-radius);
  border: 1px solid var(--admin-border);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 700;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--admin-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.tab-btn:hover {
  color: var(--admin-primary);
  background: var(--admin-primary-light);
}

.tab-btn.active {
  background: var(--admin-primary);
  color: #ffffff;
}

.tab-badge {
  background: var(--admin-danger);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Cards & Layout */
.card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--admin-border);
}

.card-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #111827;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 0.35rem;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: #ffffff;
  font-family: inherit;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(30, 125, 67, 0.15);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-help {
  font-size: 0.8rem;
  color: var(--admin-text-muted);
  margin-top: 0.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .form-row-2 {
    grid-template-columns: 1fr 1fr;
  }
  .form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--admin-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

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

.btn-primary:hover {
  background: var(--admin-primary-dark);
}

.btn-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.btn-danger {
  background: #ffffff;
  color: #dc2626;
  border: 1px solid #fca5a5;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.04);
}

.btn-danger:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   Boutons d'action dans les tableaux (Design Moderne, Sobre & Épuré)
   ========================================================================== */
.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  white-space: nowrap;
}

.table-actions form {
  margin: 0;
  display: inline-flex;
}

.btn-action {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.btn-action svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: transform 0.15s ease, stroke 0.15s ease;
}

.btn-action:hover {
  transform: translateY(-1px);
}

/* 1. Bouton Modifier (Edit) */
.btn-action-edit {
  color: #475569;
  border-color: #e2e8f0;
  background: #ffffff;
}

.btn-action-edit:hover {
  background: #f0fdf4;
  color: #15803d;
  border-color: #86efac;
  box-shadow: 0 2px 5px rgba(22, 101, 52, 0.08);
}

/* 2. Bouton Consulter / Détails (View) */
.btn-action-view {
  color: #475569;
  border-color: #e2e8f0;
  background: #ffffff;
}

.btn-action-view:hover {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
  box-shadow: 0 2px 5px rgba(29, 78, 216, 0.08);
}

/* 3. Bouton Basculer / Lu (Toggle) */
.btn-action-toggle {
  color: #475569;
  border-color: #e2e8f0;
  background: #ffffff;
}

.btn-action-toggle:hover {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #86efac;
  box-shadow: 0 2px 5px rgba(22, 163, 74, 0.08);
}

/* 4. Bouton Supprimer (Delete) - Discret par défaut, rouge élégant au survol */
.btn-action-delete {
  color: #94a3b8;
  border-color: #e2e8f0;
  background: #ffffff;
}

.btn-action-delete:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
  box-shadow: 0 2px 5px rgba(220, 38, 38, 0.12);
}

/* Fallback sobre pour tout .btn-sm dans un tableau */
.table td .btn-sm {
  border-radius: 6px;
  font-weight: 600;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.table th {
  background: #f9fafb;
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: #374151;
  border-bottom: 1px solid var(--admin-border);
}

.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}

.table tr:hover td {
  background: #fafafa;
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--admin-radius);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.alert-success {
  background: var(--admin-primary-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-danger {
  background: var(--admin-danger-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-warning {
  background: var(--admin-warning-light);
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Media Gallery Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.media-item {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.media-thumb {
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.media-info {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.75rem;
}

.media-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Modal */
.admin-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-modal-overlay.active {
  display: flex;
}

.admin-modal {
  background: #ffffff;
  border-radius: var(--admin-radius);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  padding: 2rem;
}

.admin-modal .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--admin-border);
}

.admin-modal .card-header .btn-secondary {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.admin-modal .card-header .btn-secondary:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* ==========================================================================
   Client-Side Image Optimization Live Badges & Previews
   ========================================================================== */
.client-opt-wrapper {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.client-opt-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.825rem;
  font-weight: 600;
  transition: all 0.2s ease;
  width: fit-content;
}

.client-opt-badge.optimizing {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  animation: optPulse 1.4s infinite ease-in-out;
}

.client-opt-badge.success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.client-opt-preview-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.2rem;
}

.client-opt-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
}

.client-opt-thumb:hover {
  transform: scale(1.1);
}

@keyframes optPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ==========================================================================
   Aide en ligne contextualisée & Guides pas à pas (Pour tous les utilisateurs)
   ========================================================================== */

/* 1. Bouton d'aide dans l'en-tête & Bouton flottant */
.btn-help {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-weight: 800;
}

.btn-help:hover {
  background: #fde68a;
  color: #78350f;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.admin-floating-help {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: #78350f;
  background: linear-gradient(135deg, #fffbeb, #fde68a);
  border: 1.5px solid #f59e0b;
  border-radius: 9999px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-floating-help:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.45);
}

/* 2. Bannière d'aide contextuelle en haut de chaque onglet */
.admin-help-banner {
  background: linear-gradient(135deg, #f0fdf4, #f8fafc);
  border: 1.5px solid #86efac;
  border-radius: 14px;
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(30, 125, 67, 0.06);
  transition: all 0.25s ease;
}

.admin-help-banner.collapsed .help-banner-body {
  display: none;
}

.admin-help-banner.collapsed {
  padding: 0.75rem 1.15rem;
  background: #f8fafc;
  border-color: #cbd5e1;
}

.help-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.help-banner-title {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex: 1;
}

.help-banner-icon {
  font-size: 1.6rem;
  line-height: 1;
  background: #ffffff;
  padding: 0.35rem;
  border-radius: 8px;
  border: 1px solid #bbf7d0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.help-banner-title strong {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: #14532d;
}

.help-banner-desc {
  font-size: 0.84rem;
  color: #334155;
  margin: 0.15rem 0 0 0;
  line-height: 1.4;
}

.help-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.btn-help-open {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #ffffff;
  color: #15803d;
  border: 1.5px solid #22c55e;
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-help-open:hover {
  background: #15803d;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
  transform: translateY(-1px);
}

.btn-help-toggle {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-help-toggle:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.help-banner-body {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed rgba(34, 197, 94, 0.3);
}

.help-steps-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.help-step-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.825rem;
  color: #1e293b;
  font-weight: 600;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #16a34a;
  color: #ffffff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
}

.step-arrow {
  color: #94a3b8;
  font-weight: 800;
  font-size: 0.95rem;
}

.help-btn-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 800;
  border-radius: 6px;
  vertical-align: middle;
}

.help-btn-badge.btn-primary {
  background: var(--admin-primary);
  color: #ffffff;
}

.help-btn-badge.btn-secondary {
  background: #e2e8f0;
  color: #334155;
}

.help-btn-badge.btn-blue {
  background: #2563eb;
  color: #ffffff;
}

.help-btn-badge.btn-danger {
  background: var(--admin-danger);
  color: #ffffff;
}

.help-lexique-inline {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.785rem;
  color: #475569;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

.help-lexique-inline strong {
  color: #0f172a;
}

/* 3. Tiroir d'Aide Latéral (Drawer) */
.admin-help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.admin-help-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.admin-help-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 95%;
  max-width: 580px;
  background: #ffffff;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-help-drawer.active {
  transform: translateX(0);
}

.help-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #1e7d43, #15803d);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.help-drawer-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.help-drawer-header p {
  margin: 0.2rem 0 0 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.9);
}

.help-drawer-close {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.help-drawer-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.08);
}

.help-drawer-search-box {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.help-search-input {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s ease;
}

.help-search-input:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(30, 125, 67, 0.15);
}

.help-drawer-nav {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.75rem 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.help-nav-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.help-nav-pill:hover, .help-nav-pill.active {
  background: var(--admin-primary);
  border-color: var(--admin-primary);
  color: #ffffff;
}

.help-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* 4. Cartes des Guides Pas à Pas */
.help-guide-card {
  display: none;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.help-guide-card.active {
  display: block;
}

.help-guide-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.help-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1.5px solid #f1f5f9;
}

.help-guide-header h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.help-guide-role-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
}

.help-guide-role-tag.admin {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.help-guide-intro {
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.help-step-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.help-step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 10px;
  padding: 0.75rem 0.95rem;
}

.help-step-item .step-badge {
  background: var(--admin-primary);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.help-step-content {
  flex: 1;
  font-size: 0.86rem;
  color: #1e293b;
  line-height: 1.5;
}

.help-step-content strong {
  color: #0f172a;
}

/* Boutons interactifs avec mise en valeur directe sur la page */
.help-action-highlight {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #ffffff;
  border: 1.5px solid var(--admin-primary);
  color: var(--admin-primary);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  vertical-align: middle;
}

.help-action-highlight:hover {
  background: var(--admin-primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(30, 125, 67, 0.3);
}

.help-tip-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: #92400e;
  line-height: 1.45;
  margin-top: 0.75rem;
}

.help-def-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: #1e40af;
  line-height: 1.45;
  margin-top: 0.75rem;
}

/* 5. Le Petit Dictionnaire / Glossaire */
.help-dico-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.help-dico-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  transition: border-color 0.2s ease;
}

.help-dico-card:hover {
  border-color: #94a3b8;
}

.help-dico-term {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.help-dico-def {
  font-size: 0.84rem;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 0.35rem;
}

.help-dico-analogy {
  font-size: 0.79rem;
  color: #047857;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  margin-top: 0.35rem;
}

/* 6. Effet de pulsation visuelle sur l'élément de la page ciblé par l'aide */
@keyframes helpPulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(30, 125, 67, 0.7), 0 0 0 4px rgba(245, 158, 11, 0.8);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(30, 125, 67, 0), 0 0 0 8px rgba(245, 158, 11, 0.9);
    transform: scale(1.04);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(30, 125, 67, 0), 0 0 0 4px rgba(245, 158, 11, 0.8);
    transform: scale(1);
  }
}

.help-target-highlight {
  animation: helpPulseGlow 0.8s ease-in-out 3 forwards !important;
  outline: 3px solid #f59e0b !important;
  outline-offset: 3px !important;
  border-radius: 8px !important;
  position: relative !important;
  z-index: 50 !important;
}

/* ==========================================================================
   7. Rich Text Formatting Toolbar & Live Preview
   ========================================================================== */
.rich-text-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--admin-border);
  border-bottom: none;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  padding: 0.4rem 0.65rem;
  margin-top: 0.25rem;
}

.rich-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.rich-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
  line-height: 1.2;
  user-select: none;
}

.rich-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.rich-btn.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.rich-btn strong {
  font-weight: 900;
  font-size: 0.95rem;
}

.rich-btn em {
  font-style: italic;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: Georgia, serif;
}

.rich-toolbar-hint {
  font-size: 0.76rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.rich-toolbar-hint code {
  background: #e2e8f0;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.74rem;
  color: #334155;
}

/* Attach textarea directly beneath toolbar */
.rich-text-toolbar + textarea.form-textarea {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  margin-top: 0 !important;
}

/* Rich text live preview */
.rich-text-preview-box {
  background: #ffffff;
  border: 1px dashed #93c5fd;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.rich-preview-header {
  font-size: 0.75rem;
  font-weight: 800;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rich-preview-content a {
  color: #2563eb;
  text-decoration: underline;
  font-weight: 600;
}

.rich-preview-content .text-enlarged {
  font-size: 1.25em;
  font-weight: 700;
  line-height: 1.35;
}

.rich-preview-content .text-enlarged.text-h2 {
  font-size: 1.38em;
  font-weight: 800;
  display: block;
  margin: 0.5rem 0 0.25rem 0;
}

.rich-preview-content .text-enlarged.text-h3 {
  font-size: 1.22em;
  font-weight: 800;
  display: block;
  margin: 0.4rem 0 0.2rem 0;
}

/* ==========================================================================
   Form Builder & Smooth Signature Styles (Admin)
   ========================================================================== */
.form-palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-palette {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.5rem;
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e3a8a;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-align: center;
  gap: 0.25rem;
}

.btn-palette:hover {
  background: #dbeafe;
  border-color: #3b82f6;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15);
}

.btn-palette-icon {
  font-size: 1.25rem;
}

.btn-palette-highlight {
  background: #fdf2f8;
  border-color: #f472b6;
  color: #9d174d;
}

.btn-palette-highlight:hover {
  background: #fce7f3;
  border-color: #ec4899;
}

.form-builder-elements-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fb-element-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.fb-element-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.fb-element-card.fb-is-heading {
  border-left: 4px solid #3b82f6;
  background: #f8fafc;
}

.fb-element-card.fb-is-info {
  border-left: 4px solid #06b6d4;
  background: #f0fdfa;
}

.fb-element-card.fb-is-signature {
  border-left: 4px solid #ec4899;
  background: #fdf2f8;
}

.fb-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  gap: 0.5rem;
}

.fb-card-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
}

.fb-type-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: #e2e8f0;
  color: #475569;
}

.fb-card-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.fb-btn-order,
.fb-btn-delete {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  color: #334155;
  transition: all 0.15s ease;
}

.fb-btn-order:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.fb-btn-delete {
  color: #ef4444;
  border-color: #fecaca;
}

.fb-btn-delete:hover {
  background: #fee2e2;
  border-color: #ef4444;
}

.fb-card-body {
  padding: 0.85rem;
}

.smooth-sig-canvas-wrap {
  position: relative;
  background: #ffffff;
  border: 2px dashed #94a3b8;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 0.35rem;
  touch-action: none;
}

.smooth-sig-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 160px;
  background: transparent;
  cursor: crosshair;
  touch-action: none;
}

.smooth-sig-canvas-wrap .sig-hint-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  color: #94a3b8;
  pointer-events: none;
  user-select: none;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.smooth-sig-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #64748b;
}



