/**
 * ═══════════════════════════════════════════════════════════════════════════
 * styles-admin.css
 * ═══════════════════════════════════════════════════════════════════════════
 * Styles centralisés pour l'espace administrateur CFRC
 * 
 * TABLE DES MATIÈRES:
 * 0. COLOR PALETTE ................ Déclaration des couleurs du système
 * 1. HEADER ADMIN ................. Barre en-tête avec titre et boutons
 * 2. MAIN CONTENT ................. Zone principale de contenu
 * 3. DASHBOARD CARDS .............. Grille de cartes du tableau de bord
 * 4. INFO BOX ..................... Boîtes d'information stylisées
 * 5. TABLES ....................... Styles pour tableaux de données
 * 6. TOOLBAR ...................... Barres d'outils et filtres
 * 7. BIBLIOGRAPHY TOOLBAR ......... Toolbar spécifique bibliographie
 * 8. LOGS CONTAINER ............... Affichage des logs d'import
 * 9. ALERT MESSAGES ............... Messages d'alerte (erreur, succès, info)
 * 10. FORM ELEMENTS ............... Formulaires et champs de saisie
 * 11. RESPONSIVE DESIGN ........... Adaptations pour mobile/tablette
 * ═══════════════════════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 0. COLOR PALETTE */
/* ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Couleurs principales */
  --admin-primary: #007bff; /* Bleu */
  --admin-success: #28a745; /* Vert */
  --admin-warning: #fd7e14; /* Orange */
  --admin-info: #20c997; /* Teal */
  --admin-danger: #dc3545; /* Rouge */
  --admin-secondary: #6f42c1; /* Violet */
  --admin-secondary-hover: #5a6268; /* Gris foncé (hover) */
  --admin-danger-hover: #c82333; /* Rouge foncé (hover) */

  /* Couleurs neutres */
  --admin-text: #333;
  --admin-text-muted: #666;
  --admin-bg-light: #f8f9fa;
  --admin-bg-white: #fff;
  --admin-border: #dee2e6;
  --admin-border-light: #eee;

  /* Espacement et tailles */
  --admin-border-radius: 4px;
  --admin-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 1. HEADER ADMIN */
/* ═══════════════════════════════════════════════════════════════════════════ */

.admin-header {
  padding: 0.5rem;
  border-bottom: 1px solid var(--admin-border-light);
  background: var(--admin-bg-white);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.admin-header-left {
  flex: 1;
}

.admin-logo {
  height: 50px;
  width: auto;
  max-width: 100%;
  display: block;
}

.admin-header-left strong {
  font-size: 1.1rem;
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-user-info {
  font-size: 0.9rem;
  color: var(--admin-text-muted);
}

.admin-btn-logout {
  padding: 0.5rem 1rem;
  background: var(--admin-danger);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.admin-btn-logout:hover {
  background: var(--admin-danger-hover);
}

.admin-btn-return {
  padding: 0.5rem 1rem;
  background: var(--admin-secondary);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.9rem;
  display: inline-block;
}

.admin-btn-return:hover {
  background: var(--admin-secondary-hover);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 2. MAIN CONTENT */
/* ═══════════════════════════════════════════════════════════════════════════ */

.admin-main {
  padding: 2rem;
  min-height: calc(100vh - 70px);
}

.admin-main h1 {
  margin-top: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 3. DASHBOARD CARDS */
/* ═══════════════════════════════════════════════════════════════════════════ */

.admin-section-title {
  margin-top: 2rem;
  border-bottom: 2px solid var(--admin-border);
  padding-bottom: 0.5rem;
  font-size: 1.3rem;
  color: var(--admin-text);
}

.admin-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 1.5rem;
}

.admin-card {
  display: block;
  padding: 1.5rem;
  background: var(--admin-bg-light);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s;
}

.admin-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-color: var(--admin-primary);
}

.admin-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.admin-card p {
  margin: 0;
  color: var(--admin-text-muted);
  font-size: 0.95rem;
}

/* Variantes de couleurs pour les cartes */
.admin-card-blue h3 {
  color: var(--admin-primary);
}

.admin-card-green h3 {
  color: var(--admin-success);
}

.admin-card-orange h3 {
  color: var(--admin-warning);
}

.admin-card-teal h3 {
  color: var(--admin-info);
}

.admin-card-purple h3 {
  color: var(--admin-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 4. INFO BOX */
/* ═══════════════════════════════════════════════════════════════════════════ */

.admin-info-box {
  margin-top: 3rem;
  padding: 1.5rem;
  background: #e7f3ff;
  border-left: 4px solid var(--admin-primary);
  border-radius: 4px;
}

.admin-info-box h2 {
  margin-top: 0;
}

.admin-info-box pre {
  background: white;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 5. TABLES */
/* ═══════════════════════════════════════════════════════════════════════════ */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: white;
}

.admin-table thead {
  background: #f0f0f0;
}

.admin-table th,
.admin-table td {
  border: 1px solid #ccc;
  padding: 0.75rem;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th {
  font-weight: bold;
  background: #f0f0f0;
}

/* Column width classes */
.admin-table .col-id {
  width: 6%;
}

.admin-table .col-type {
  width: 8%;
}

.admin-table .col-numero {
  width: 9%;
}

.admin-table .col-date {
  width: 9%;
}

.admin-table .col-intitule {
  width: 48%;
}

.admin-table .col-actions {
  width: 20%;
}

.admin-table .col-actions a {
  display: block;
  margin-bottom: 0.5rem;
}

.admin-table .col-actions a:last-child {
  margin-bottom: 0;
}

/* Column width classes for bibliography table */
.admin-table .col-id {
  width: 5%;
}

.admin-table .col-pmid {
  width: 8%;
}

.admin-table .col-titre {
  width: 45%;
}

.admin-table .col-revue {
  width: 15%;
}

.admin-table .col-date {
  width: 10%;
}

.admin-table .col-enligne {
  width: 7%;
}

.admin-table .col-actions {
  width: 10%;
}

/* Sortable table headers */
.sortable-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  white-space: nowrap;
}

.sortable-header:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.sort-indicator {
  display: inline-block;
  width: 16px;
  text-align: center;
  font-size: 0.8em;
  color: #666;
  margin-left: 4px;
}

.admin-table tbody tr:hover {
  background: #f9f9f9;
}

.admin-table .admin-table-actions {
  text-align: center;
  white-space: nowrap;
}

.admin-table .admin-table-actions form {
  display: inline;
  margin-right: 0.5rem;
}

.admin-table .admin-table-actions button {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  color: white;
}

.admin-table .admin-btn-approve {
  background: var(--admin-success);
}

.admin-table .admin-btn-approve:hover {
  background: #218838;
}

.admin-table .admin-btn-reject {
  background: var(--admin-danger);
}

.admin-table .admin-btn-reject:hover {
  background: var(--admin-danger-hover);
}

.admin-table .admin-table-status {
  color: #999;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 6. TOOLBAR */
/* ═══════════════════════════════════════════════════════════════════════════ */

.admin-toolbar {
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 1rem;
  background: var(--admin-bg-light);
  border-radius: 4px;
  border: 1px solid var(--admin-border);
}

.admin-toolbar label {
  margin: 0;
  font-weight: 500;
}

.admin-toolbar input[type="text"],
.admin-toolbar input[type="search"] {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 250px;
}

.admin-toolbar button,
.admin-toolbar input[type="submit"] {
  padding: 0.5rem 1rem;
  background: var(--admin-primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.admin-toolbar button:hover,
.admin-toolbar input[type="submit"]:hover {
  background: #0b7dda;
}

.admin-toolbar a {
  margin-left: 1rem;
  color: var(--admin-primary);
  text-decoration: none;
}

.admin-toolbar a:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 7. BIBLIOGRAPHY TOOLBAR */
/* ═══════════════════════════════════════════════════════════════════════════ */

.admin-biblio-toolbar {
  margin-bottom: 1.5rem;
}

.admin-biblio-toolbar a {
  display: inline-block;
  margin-right: 1rem;
  padding: 0.5rem 1rem;
  background: var(--admin-primary);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.9rem;
}

.admin-biblio-toolbar a:hover {
  background: #0b7dda;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 8. LOGS CONTAINER */
/* ═══════════════════════════════════════════════════════════════════════════ */

.admin-log-container {
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 1rem;
  background: #f9f9f9;
  max-height: 70vh;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.admin-log-line {
  margin: 0;
  padding: 0.2rem 0;
}

.admin-log-line:nth-child(odd) {
  background: #ffffff;
}

.admin-log-line:nth-child(even) {
  background: #f3f3f3;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 9. ALERT MESSAGES */
/* ═══════════════════════════════════════════════════════════════════════════ */

.admin-alert {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.admin-alert-error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.admin-alert-success {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.admin-alert-info {
  background: #e2f5ff;
  border: 1px solid #b3d9ff;
  color: #004085;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 10. FORM ELEMENTS */
/* ═══════════════════════════════════════════════════════════════════════════ */

.admin-form {
  max-width: 600px;
  margin: 2rem 0;
}

.admin-form-group {
  margin-bottom: 1.5rem;
}

.admin-form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.admin-form-group input,
.admin-form-group textarea,
.admin-form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}

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

.admin-form-group input:focus,
.admin-form-group textarea:focus,
.admin-form-group select:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.admin-form-submit {
  padding: 0.75rem 1.5rem;
  background: var(--admin-primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
}

.admin-form-submit:hover {
  background: #0b7dda;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 11. RESPONSIVE DESIGN */
/* ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-header-right {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-main {
    padding: 1rem;
  }

  .admin-cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-toolbar input[type="text"],
  .admin-toolbar input[type="search"] {
    min-width: auto;
  }

  .admin-table {
    font-size: 0.8rem;
  }

  .admin-table th,
  .admin-table td {
    padding: 0.5rem;
  }
}
