/* =====================================================================
   AFRICA EQUIPEMENT SERVICE - SARL (AES)
   Feuille de style du back-office
   Complete aes.css (variables de marque, boutons, formulaires).
   ===================================================================== */

:root {
  --adm-sidebar: 268px;
  --adm-topbar: 66px;
  --adm-bg: #F1F5F8;
  --adm-panel: #FFFFFF;
  --adm-line: #E3EAF0;
  --adm-side-bg: #061F2E;
  --adm-side-hover: rgba(255, 255, 255, .07);
}

body.aes-admin {
  background: var(--adm-bg);
  font-size: .945rem;
  overflow-x: hidden;
}

/* ------------------------------------------------------------------
   1. Barre laterale
   ------------------------------------------------------------------ */
.adm-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--adm-sidebar); z-index: 1045;
  background: var(--adm-side-bg); color: rgba(255, 255, 255, .72);
  display: flex; flex-direction: column;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}
.adm-sidebar-head {
  padding: 1.1rem 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, .09);
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex: none;
}
.adm-sidebar-head img { height: 40px; width: auto; }
.adm-sidebar-close { display: none; background: none; border: 0; color: rgba(255,255,255,.7); font-size: 1.35rem; }

.adm-nav { flex: 1 1 auto; overflow-y: auto; padding: .85rem .75rem 1.5rem; }
.adm-nav::-webkit-scrollbar { width: 6px; }
.adm-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 3px; }

.adm-nav-title {
  font-size: .68rem; letter-spacing: .15em; text-transform: uppercase;
  color: rgba(255, 255, 255, .38); font-weight: 700;
  padding: 1.1rem .8rem .45rem;
}
.adm-nav-list { list-style: none; margin: 0; padding: 0; }
.adm-nav-list a {
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .8rem; border-radius: 9px; margin-bottom: .12rem;
  color: rgba(255, 255, 255, .74); font-size: .9rem; font-weight: 550;
  transition: background .2s ease, color .2s ease;
}
.adm-nav-list a:hover { background: var(--adm-side-hover); color: #fff; }
.adm-nav-list a.active { background: var(--aes-primary); color: #fff; font-weight: 650; }
.adm-nav-list a i { font-size: 1.05rem; width: 20px; text-align: center; flex: none; }
.adm-nav-list a .badge {
  margin-left: auto; background: var(--aes-accent); color: #26170a;
  font-size: .7rem; font-weight: 700; padding: .16rem .42rem; border-radius: 999px;
}
.adm-nav-list a.active .badge { background: #fff; color: var(--aes-primary); }

.adm-sidebar-foot {
  flex: none; padding: .9rem 1.1rem; border-top: 1px solid rgba(255, 255, 255, .09);
  font-size: .78rem; color: rgba(255, 255, 255, .4);
}
.adm-sidebar-foot a { color: rgba(255, 255, 255, .62); }
.adm-sidebar-foot a:hover { color: #fff; }

/* ------------------------------------------------------------------
   2. Zone principale
   ------------------------------------------------------------------ */
.adm-main { margin-left: var(--adm-sidebar); min-height: 100vh; display: flex; flex-direction: column; }

.adm-topbar {
  position: sticky; top: 0; z-index: 1035; height: var(--adm-topbar);
  background: #fff; border-bottom: 1px solid var(--adm-line);
  display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
}
.adm-burger { display: none; background: none; border: 0; color: var(--aes-primary); font-size: 1.5rem; padding: 0; }
.adm-topbar-title { font-family: var(--aes-font-head); font-weight: 700; color: var(--aes-primary-900); font-size: 1.02rem; margin: 0; }
.adm-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.adm-icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--adm-line); background: #fff; color: var(--aes-primary);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem;
  transition: all .2s ease;
}
.adm-icon-btn:hover { background: var(--aes-light); color: var(--aes-secondary); }
.adm-icon-btn .dot {
  position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--aes-danger); color: #fff; border-radius: 999px;
  font-size: .66rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}

.adm-user {
  display: flex; align-items: center; gap: .6rem; padding: .3rem .6rem .3rem .3rem;
  border: 1px solid var(--adm-line); border-radius: 999px; background: #fff; color: var(--aes-primary-900);
}
.adm-user:hover { background: var(--aes-light); }
.adm-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--aes-primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--aes-font-head); font-weight: 700; font-size: .82rem;
}
.adm-user-name { font-size: .86rem; font-weight: 600; line-height: 1.2; }
.adm-user-role { font-size: .72rem; color: var(--aes-muted); }

.adm-content { flex: 1 1 auto; padding: 1.5rem; max-width: 100%; }

/* ------------------------------------------------------------------
   3. En-tete de page
   ------------------------------------------------------------------ */
.adm-page-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.35rem;
}
.adm-page-head h1 { font-size: 1.5rem; margin: 0 0 .3rem; }
.adm-page-head p { color: var(--aes-muted); font-size: .9rem; margin: 0; }
.adm-page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.adm-breadcrumb { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 .4rem; font-size: .8rem; color: var(--aes-muted); }
.adm-breadcrumb a { color: var(--aes-secondary); }

/* ------------------------------------------------------------------
   4. Panneaux et cartes
   ------------------------------------------------------------------ */
.adm-panel {
  background: var(--adm-panel); border: 1px solid var(--adm-line);
  border-radius: 14px; box-shadow: 0 1px 2px rgba(10, 31, 46, .04);
}
.adm-panel-head {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--adm-line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
}
.adm-panel-head h2 { font-size: 1rem; margin: 0; }
.adm-panel-body { padding: 1.25rem; }
.adm-panel-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--adm-line); background: #FAFCFD; border-radius: 0 0 14px 14px; }

/* Statistiques */
.adm-stat {
  background: #fff; border: 1px solid var(--adm-line); border-radius: 14px;
  padding: 1.15rem 1.25rem; height: 100%; display: block;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
a.adm-stat:hover { transform: translateY(-3px); box-shadow: var(--aes-shadow-sm); border-color: #C9DCE8; }
.adm-stat-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .6rem; }
.adm-stat-label { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--aes-muted); font-weight: 650; }
.adm-stat-icon {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem;
  background: rgba(46, 124, 166, .12); color: var(--aes-secondary);
}
.adm-stat-value { font-family: var(--aes-font-head); font-size: 1.85rem; font-weight: 800; color: var(--aes-primary-900); line-height: 1.1; }
.adm-stat-sub { font-size: .8rem; color: var(--aes-muted); margin-top: .25rem; }
.adm-stat--accent .adm-stat-icon { background: rgba(225, 150, 47, .16); color: var(--aes-accent-600); }
.adm-stat--success .adm-stat-icon { background: rgba(30, 142, 90, .13); color: var(--aes-success); }
.adm-stat--danger .adm-stat-icon { background: rgba(179, 38, 30, .12); color: var(--aes-danger); }

/* ------------------------------------------------------------------
   5. Tableaux
   ------------------------------------------------------------------ */
.adm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.adm-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 0; }
.adm-table th {
  text-align: left; font-family: var(--aes-font-head); font-weight: 650; font-size: .78rem;
  letter-spacing: .05em; text-transform: uppercase; color: var(--aes-muted);
  padding: .78rem 1rem; border-bottom: 1px solid var(--adm-line); white-space: nowrap; background: #FAFCFD;
}
.adm-table td { padding: .8rem 1rem; border-bottom: 1px solid var(--aes-line-soft); vertical-align: middle; }
.adm-table tbody tr:hover { background: #F8FBFD; }
.adm-table tbody tr:last-child td { border-bottom: 0; }
.adm-table .adm-primary-cell { font-weight: 620; color: var(--aes-primary-900); }
.adm-table .adm-primary-cell a { color: inherit; }
.adm-table .adm-primary-cell a:hover { color: var(--aes-secondary); }
.adm-table .adm-sub { display: block; font-size: .8rem; color: var(--aes-muted); font-weight: 400; }
.adm-thumb { width: 46px; height: 40px; border-radius: 7px; object-fit: cover; background: var(--aes-light-2); }
.adm-actions { display: flex; gap: .3rem; justify-content: flex-end; }
.adm-actions .btn { padding: .34rem .55rem; font-size: .82rem; border-radius: 7px; }
.adm-table th.adm-col-actions, .adm-table td.adm-col-actions { text-align: right; white-space: nowrap; }

/* Badges de statut */
.adm-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .22rem .6rem; border-radius: 999px; font-size: .77rem; font-weight: 650; white-space: nowrap;
}
.adm-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.adm-badge--success { background: rgba(30,142,90,.12); color: #14603C; }
.adm-badge--primary { background: rgba(46,124,166,.13); color: #10496A; }
.adm-badge--warning { background: rgba(199,122,11,.14); color: #7A4A05; }
.adm-badge--danger  { background: rgba(179,38,30,.11); color: #8C1D17; }
.adm-badge--secondary { background: #EDF3F7; color: #5B6E7B; }

/* Barre d'outils de liste */
.adm-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  padding: .9rem 1.25rem; border-bottom: 1px solid var(--adm-line);
}
.adm-toolbar .form-control, .adm-toolbar .form-select { height: 40px; font-size: .89rem; }
.adm-search { position: relative; flex: 1 1 240px; max-width: 340px; }
.adm-search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--aes-muted); font-size: .95rem; }
.adm-search .form-control { padding-left: 2.35rem; }

/* Vue mobile en cartes */
.adm-cards { display: none; }
.adm-card-row {
  background: #fff; border: 1px solid var(--adm-line); border-radius: 12px;
  padding: 1rem 1.1rem; margin-bottom: .75rem;
}
.adm-card-row dl { margin: 0; }
.adm-card-row .adm-card-line { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; font-size: .87rem; }
.adm-card-row .adm-card-line dt { color: var(--aes-muted); font-weight: 500; }
.adm-card-row .adm-card-line dd { margin: 0; font-weight: 600; text-align: right; color: var(--aes-primary-900); }

/* ------------------------------------------------------------------
   6. Formulaires d'administration
   ------------------------------------------------------------------ */
.adm-form-group-title {
  font-family: var(--aes-font-head); font-weight: 700; font-size: .78rem;
  letter-spacing: .12em; text-transform: uppercase; color: var(--aes-secondary);
  padding-bottom: .55rem; margin: 0 0 1.15rem; border-bottom: 1px solid var(--adm-line);
}
.adm-field { margin-bottom: 1.1rem; }
.adm-field .form-text { font-size: .8rem; }
.adm-media-preview {
  display: flex; align-items: center; gap: .85rem; padding: .7rem;
  background: var(--aes-light); border: 1px solid var(--adm-line); border-radius: 10px; margin-bottom: .6rem;
}
.adm-media-preview img { width: 74px; height: 60px; object-fit: cover; border-radius: 7px; background: #fff; }
.adm-media-preview .flex-grow-1 { min-width: 0; }
.adm-media-preview small { word-break: break-all; }

.adm-sticky-actions {
  position: sticky; bottom: 0; z-index: 20;
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--adm-line); padding: .9rem 1.25rem;
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  border-radius: 0 0 14px 14px;
}

/* Selecteur d'icone */
.adm-icon-preview {
  width: 44px; height: 44px; border-radius: 10px; flex: none;
  background: var(--aes-light-2); color: var(--aes-primary);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem;
}

/* Editeur simple */
.adm-editor-toolbar {
  display: flex; flex-wrap: wrap; gap: .25rem; padding: .45rem;
  border: 1.5px solid var(--aes-line); border-bottom: 0;
  border-radius: var(--aes-radius-sm) var(--aes-radius-sm) 0 0; background: #FAFCFD;
}
.adm-editor-toolbar button {
  border: 1px solid transparent; background: none; border-radius: 6px;
  width: 32px; height: 32px; color: var(--aes-primary); font-size: .92rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.adm-editor-toolbar button:hover { background: #fff; border-color: var(--aes-line); }
.adm-editor-toolbar + textarea { border-radius: 0 0 var(--aes-radius-sm) var(--aes-radius-sm); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86rem; }

/* ------------------------------------------------------------------
   7. Connexion
   ------------------------------------------------------------------ */
.adm-auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, #061F2E 0%, #0B3D59 55%, #10597F 100%);
  padding: 2rem 1.25rem; position: relative; overflow: hidden;
}
.adm-auth::before {
  content: ""; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  border: 90px solid rgba(255, 255, 255, .035); top: -230px; right: -180px;
}
.adm-auth::after {
  content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(225,150,47,.16), transparent 70%);
  bottom: -180px; left: -120px;
}
.adm-auth-card {
  position: relative; z-index: 2; width: 100%; max-width: 452px;
  background: #fff; border-radius: 20px; padding: 2.4rem 2.2rem;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .28);
}
.adm-auth-logo { display: block; height: 54px; width: auto; margin: 0 auto 1.6rem; }
.adm-auth-card h1 { font-size: 1.35rem; text-align: center; margin-bottom: .4rem; }
.adm-auth-card .adm-auth-sub { text-align: center; color: var(--aes-muted); font-size: .9rem; margin-bottom: 1.75rem; }
.adm-auth-foot { text-align: center; margin-top: 1.5rem; font-size: .85rem; }
.adm-auth-back { text-align: center; margin-top: 1.35rem; }
.adm-auth-back a { color: rgba(255, 255, 255, .78); font-size: .86rem; }
.adm-auth-back a:hover { color: #fff; }

/* ------------------------------------------------------------------
   8. Notifications et journal
   ------------------------------------------------------------------ */
.adm-notif-list { list-style: none; margin: 0; padding: 0; }
.adm-notif-list li { border-bottom: 1px solid var(--aes-line-soft); }
.adm-notif-list li:last-child { border-bottom: 0; }
.adm-notif-list a { display: flex; gap: .85rem; padding: .85rem 1.1rem; color: var(--aes-body); align-items: flex-start; }
.adm-notif-list a:hover { background: #F8FBFD; }
.adm-notif-list .adm-notif-icon {
  width: 36px; height: 36px; border-radius: 9px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(46,124,166,.12); color: var(--aes-secondary); font-size: 1rem;
}
.adm-notif-list .unread { background: #F4F9FC; }
.adm-notif-list .unread .adm-notif-title::after {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--aes-accent); margin-left: .45rem; vertical-align: middle;
}
.adm-notif-title { font-weight: 620; color: var(--aes-primary-900); font-size: .9rem; }
.adm-notif-meta { font-size: .78rem; color: var(--aes-muted); }

/* Graphique en barres (sans dependance externe) */
.adm-chart { display: flex; align-items: flex-end; gap: 5px; height: 176px; padding-top: .5rem; }
.adm-chart-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: .4rem; min-width: 0; }
.adm-chart-bar {
  width: 100%; max-width: 40px; border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, var(--aes-secondary), var(--aes-primary));
  min-height: 3px; position: relative; transition: opacity .2s ease;
}
.adm-chart-col:hover .adm-chart-bar { opacity: .82; }
.adm-chart-label { font-size: .7rem; color: var(--aes-muted); white-space: nowrap; }
.adm-chart-value { font-size: .74rem; font-weight: 700; color: var(--aes-primary-900); }

/* Journal d'audit */
.adm-log-action { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; }

/* Etat vide */
.adm-empty { text-align: center; padding: 3rem 1.5rem; }
.adm-empty i { font-size: 2.6rem; color: #C3D5E0; display: block; margin-bottom: .9rem; }
.adm-empty h3 { font-size: 1.1rem; margin-bottom: .45rem; }
.adm-empty p { color: var(--aes-muted); max-width: 460px; margin: 0 auto 1.25rem; font-size: .92rem; }

/* Fiche detail (devis, message, candidature) */
.adm-detail-table { width: 100%; font-size: .9rem; border-collapse: collapse; }
.adm-detail-table th { text-align: left; color: var(--aes-muted); font-weight: 500; padding: .55rem 1rem .55rem 0; width: 40%; vertical-align: top; }
.adm-detail-table td { padding: .55rem 0; color: var(--aes-primary-900); font-weight: 550; }
.adm-detail-table tr { border-bottom: 1px solid var(--aes-line-soft); }
.adm-detail-table tr:last-child { border-bottom: 0; }

.adm-message-body {
  background: var(--aes-light); border-left: 3px solid var(--aes-secondary);
  border-radius: 0 10px 10px 0; padding: 1.1rem 1.25rem; font-size: .93rem; line-height: 1.75;
  white-space: pre-wrap; word-break: break-word;
}

/* ------------------------------------------------------------------
   9. Responsive
   ------------------------------------------------------------------ */
@media (max-width: 1199.98px) {
  .adm-sidebar { transform: translateX(-100%); box-shadow: 0 0 60px rgba(0,0,0,.35); }
  .adm-sidebar.is-open { transform: translateX(0); }
  .adm-sidebar-close { display: inline-flex; }
  .adm-main { margin-left: 0; }
  .adm-burger { display: inline-flex; }
  .adm-backdrop {
    position: fixed; inset: 0; background: rgba(6, 31, 46, .5); z-index: 1040;
    opacity: 0; visibility: hidden; transition: opacity .25s ease;
  }
  .adm-backdrop.is-open { opacity: 1; visibility: visible; }
}

@media (max-width: 991.98px) {
  .adm-content { padding: 1.1rem; }
  .adm-topbar { padding: 0 1rem; }
  .adm-user-name, .adm-user-role { display: none; }
  .adm-user { padding: .25rem; }
}

@media (max-width: 767.98px) {
  /* Les tableaux complexes deviennent des cartes */
  .adm-table-wrap.adm-responsive { display: none; }
  .adm-cards { display: block; padding: 1rem; }
  .adm-page-head h1 { font-size: 1.25rem; }
  .adm-stat-value { font-size: 1.55rem; }
  .adm-toolbar { padding: .8rem 1rem; }
  .adm-search { max-width: none; }
}

@media print {
  .adm-sidebar, .adm-topbar, .adm-page-actions, .adm-toolbar, .adm-sticky-actions, .adm-backdrop { display: none !important; }
  .adm-main { margin-left: 0; }
  .adm-content { padding: 0; }
  .adm-panel { border: 0; box-shadow: none; }
  body.aes-admin { background: #fff; }
}
