/* =========================================
   Styles généraux - Administration
   ========================================= */
body { font-family: system-ui, sans-serif; margin: 0; background: #f5f6f8; color: #1f2937; }
header { background: #1e293b; color: #fff; padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
h1 { margin: 0; font-size: 1.25rem; }
.nav-actions { display: flex; align-items: center; gap: 0.75rem; }
main { max-width: 1100px; margin: 1.5rem auto; background: #fff; padding: 1.5rem 2rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* Utilitaires */
.hidden { display: none !important; }
.admin-panel { margin-bottom: 2.5rem; }

/* Bouton Lien vers le site */
.btn-link-site {
  display: inline-flex; align-items: center; gap: 0.4rem; color: #94a3b8;
  background-color: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.45rem 0.85rem; border-radius: 6px; font-size: 0.875rem; font-weight: 500;
  text-decoration: none; transition: all 0.2s ease;
}
.btn-link-site:hover {
  color: #ffffff; background-color: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3); text-decoration: none;
}

/* Formulaires */
fieldset { border: 1px solid #e5e7eb; border-radius: 6px; padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
legend { font-weight: 600; color: #334155; padding: 0 .35rem; }
label { display: block; font-size: .85rem; margin: .65rem 0 .25rem; color: #374151; }
input[type=text], input[type=date], input[type=time], input[type=number], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: .5rem .6rem; border: 1px solid #cbd5e1; border-radius: 4px; font-size: .95rem; box-sizing: border-box;
}
textarea { min-height: 100px; resize: vertical; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.actions { display: flex; gap: .75rem; margin-top: 1rem; }

/* Boutons */
button { cursor: pointer; padding: .55rem 1.1rem; border-radius: 4px; border: 1px solid transparent; font-size: .95rem; font-weight: 500; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-secondary { background: #e2e8f0; color: #1e293b; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { background: #f8fafc; font-weight: 600; }

/* Feedbacks et divers */
.feedback { margin-top: 1rem; padding: .75rem 1rem; border-radius: 4px; }
.feedback.success { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }
.feedback.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.hint { font-size: .8rem; color: #64748b; }
.checkbox-row { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-top: .5rem; }
.checkbox-row label { display: flex; align-items: center; gap: .4rem; margin: 0; font-size: .9rem; }

/* Modales HTML5 standard */
dialog::backdrop { background: rgba(15, 23, 42, 0.65); backdrop-filter: blur(2px); }
#modal-event { border: none; border-radius: 8px; padding: 0; max-width: 850px; width: 95%; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2); }
#modal-demande-detail { border: none; border-radius: 8px; padding: 1.5rem; max-width: 500px; width: 90%; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.2); }
.modal-header { background: #1e293b; color: #fff; padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.5rem; max-height: 80vh; overflow-y: auto; }
.close-modal-btn { background: transparent; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; padding: 0; line-height: 1; }

/* =========================================
   Vue mobile compacte : cartes repliables
   ========================================= */
@media (max-width: 768px) {
  header { flex-direction: column; gap: 1rem; text-align: center; padding: 1rem; }
  .nav-actions { width: 100%; justify-content: center; flex-wrap: wrap; }
  main { margin: 1rem; padding: 1rem; }
  .admin-panel > div[style*="display: flex"] { flex-direction: column; align-items: flex-start !important; gap: 1rem; }
  button { padding: .65rem 1.2rem; }

  /* La table devient une pile de cartes */
  table, thead, tbody, th, td, tr { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  tbody { width: 100%; }
  tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .35rem .75rem;
    margin: .75rem 0;
    padding: .85rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 5px rgba(15, 23, 42, .07);
    cursor: pointer;
  }
  tbody td {
    display: none;
    min-width: 0;
    padding: 0 !important;
    border: 0;
    text-align: left !important;
    word-break: break-word;
  }

  /* Cellules affichées quand la carte est repliée */
  #admin-events-list tr td:nth-child(1), #admin-events-list tr td:nth-child(2), #admin-events-list tr td:nth-child(6),
  #admin-demandes-list tr td:nth-child(1), #admin-demandes-list tr td:nth-child(2), #admin-demandes-list tr td:nth-child(7),
  #admin-messages-list tr td:nth-child(1), #admin-messages-list tr td:nth-child(2), #admin-messages-list tr td:nth-child(5) { display: block; }

  /* Typographie */
  #admin-events-list tr td:nth-child(1), #admin-demandes-list tr td:nth-child(2), #admin-messages-list tr td:nth-child(2) { font-weight: 650; }
  #admin-events-list tr td:nth-child(2), #admin-demandes-list tr td:nth-child(1), #admin-messages-list tr td:nth-child(1) { color: #64748b; font-size: .88rem; }

  /* Boutons d'actions */
  #admin-events-list tr td:last-child, #admin-demandes-list tr td:last-child, #admin-messages-list tr td:last-child { 
    grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right !important; white-space: normal !important; 
  }

  /* Au clic, afficher le détail de la carte */
  tbody tr.card-expanded { display: block; }
  tbody tr.card-expanded td { display: block !important; padding: .55rem 0 !important; border-bottom: 1px solid #f1f5f9; }
  tbody tr.card-expanded td:last-child { border-bottom: 0; text-align: right !important; }
  tbody tr.card-expanded td::before { content: attr(data-label); display: block; margin-bottom: .2rem; color: #64748b; font-size: .78rem; font-weight: 600; }
  tbody tr.card-expanded td:last-child::before { content: none; }

  /* --- CORRECTION POUR LE TABLEAU DES CONFÉRENCES SUR MOBILE --- */
  #conferences-tbody tr {
    display: flex; flex-direction: column; gap: 0.5rem; padding: 1rem; border: 1px solid #cbd5e1;
    border-radius: 8px; margin-bottom: 1rem; cursor: default;
  }
  #conferences-tbody tr td { display: block; padding: 0 !important; border: none; text-align: left !important; }
  #conferences-tbody tr td:nth-child(1) { font-weight: bold; font-size: 1.1rem; }
  #conferences-tbody tr td:nth-child(2) { color: #64748b; font-size: 0.9rem; }
  #conferences-tbody tr td:nth-child(3) { font-weight: 500; color: #0f172a; }
  #conferences-tbody tr td:last-child { margin-top: 0.5rem; padding-top: 0.5rem !important; border-top: 1px solid #e2e8f0; }
}

/* =========================================
   Styles pour l'impression (Génération PDF)
   ========================================= */
@media print {
  @page { margin: 1.5cm; size: auto; }
  body > *:not(#modal-conferences) { display: none !important; }
  .no-print, .modal-header, #conferences-list-container, fieldset, dialog::backdrop { display: none !important; }
  
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; height: auto !important; min-height: 0 !important; overflow: visible !important; }
  dialog { display: block !important; position: static !important; margin: 0 !important; padding: 0 !important; border: none !important; box-shadow: none !important; width: 100% !important; max-width: 100% !important; height: auto !important; max-height: none !important; overflow: visible !important; }
  
  #print-area { display: block !important; visibility: visible !important; position: static !important; width: 100% !important; margin: 0 !important; padding: 0 !important; color: #000 !important; background: #fff !important; }
  #print-area * { visibility: visible !important; }

  .print-table { display: table !important; width: 100% !important; border-collapse: collapse !important; margin-top: 0.8rem !important; margin-bottom: 1.5rem !important; page-break-inside: auto; }
  .print-table thead { display: table-header-group !important; }
  .print-table tbody { display: table-row-group !important; }
  .print-table tr { display: table-row !important; page-break-inside: avoid; page-break-after: auto; }
  .print-table th, .print-table td { display: table-cell !important; border: 1px solid #333 !important; padding: 6px 8px !important; text-align: left !important; color: #000 !important; background: transparent !important; font-size: 13px !important; line-height: 1.2 !important; }
  .print-table th { font-weight: bold !important; background-color: #f3f4f6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  
  .print-title-date { font-size: 1.1rem !important; margin-top: 1.2rem !important; margin-bottom: 0.5rem !important; border-bottom: 1.5px solid #000 !important; color: #000 !important; padding-bottom: 3px !important; page-break-after: avoid; }
}