/* ==========================================================================
   Thème « Université de Kara » sur Tabler (Bootstrap 5)
   Chargé APRÈS tabler.min.css. N'est jamais chargé sur la vitrine.
   ========================================================================== */

@font-face {
  font-family: 'Inter Var';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../vendor/inter/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter Var';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../vendor/inter/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Marque UK : vert sombre (action), marine (structure), or (accent) */
  --tblr-primary: #15603A;
  --tblr-primary-rgb: 21, 96, 58;
  --tblr-primary-darken: #0E4429;
  --tblr-primary-fg: #ffffff;
  --tblr-primary-lt: #E5F1EA;
  --tblr-primary-lt-rgb: 229, 241, 234;
  --tblr-link-color: #15603A;
  --tblr-link-color-rgb: 21, 96, 58;
  --tblr-link-hover-color: #0E4429;
  --tblr-link-hover-color-rgb: 14, 68, 41;

  --tblr-body-bg: #F4F3EE;
  --tblr-body-color: #1A2433;
  --tblr-border-color: #E3DFD3;
  --tblr-border-radius: 10px;
  --tblr-border-radius-lg: 12px;
  --tblr-card-border-radius: 14px;

  /* Variables historiques utilisées par le CSS des pages existantes */
  --font-display: 'Inter Var', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter Var', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 12px;
  --topbar-height: 0px;

  --uk-navy: #0F2340;
  --uk-navy-dark: #0A1830;
  --uk-gold: #D9A21B;
}

body {
  font-feature-settings: 'cv03', 'cv04', 'cv11';
  background: var(--tblr-body-bg);
}

h1, h2, h3, h4, h5, h6 { letter-spacing: -0.01em; }

/* ---------- Cartes ---------- */
.card {
  border-color: var(--tblr-border-color);
  box-shadow: 0 1px 2px rgba(15, 35, 64, 0.04);
}
.card-header { background: transparent; }
.table thead th { white-space: nowrap; }
a.card:hover { box-shadow: 0 6px 18px rgba(15, 35, 64, 0.10); transform: translateY(-1px); }
a.card { transition: box-shadow .15s, transform .15s; }

/* ---------- Boutons : rendu Tabler, couleurs UK ---------- */
.btn-primary {
  --tblr-btn-bg: #15603A;
  --tblr-btn-border-color: #15603A;
  --tblr-btn-hover-bg: #0E4429;
  --tblr-btn-hover-border-color: #0E4429;
  --tblr-btn-active-bg: #0A3320;
  --tblr-btn-active-border-color: #0A3320;
  --tblr-btn-color: #fff;
  --tblr-btn-hover-color: #fff;
  --tblr-btn-active-color: #fff;
  --tblr-btn-disabled-bg: #15603A;
  --tblr-btn-disabled-border-color: #15603A;
}
.btn-accent {
  --tblr-btn-bg: #D9A21B;
  --tblr-btn-border-color: #D9A21B;
  --tblr-btn-color: #0F2340;
  --tblr-btn-hover-bg: #C28F12;
  --tblr-btn-hover-border-color: #C28F12;
  --tblr-btn-hover-color: #0F2340;
}
.btn-outline-primary {
  --tblr-btn-color: #15603A;
  --tblr-btn-border-color: #15603A;
  --tblr-btn-hover-bg: #15603A;
  --tblr-btn-hover-border-color: #15603A;
  --tblr-btn-hover-color: #fff;
  --tblr-btn-active-bg: #0E4429;
  --tblr-btn-active-color: #fff;
}
.btn-outline-dark { background: #fff; }
.form-control:focus, .form-select:focus {
  border-color: #2A7D55;
  box-shadow: 0 0 0 .25rem rgba(21, 96, 58, .16);
}
.form-check-input:checked { background-color: #15603A; border-color: #15603A; }

/* ---------- Anciennes alertes du projet (alert-error) ---------- */
.alert-error { color: #9C2A3A; background: #FBE9EC; border-color: #F0C8CD; }

/* ==========================================================================
   Sidebar (navbar verticale Tabler, fond marine)
   ========================================================================== */
.uk-sidebar {
  --tblr-navbar-bg: #0F2340;
  --tblr-navbar-color: rgba(221, 228, 238, 0.78);
  --tblr-navbar-hover-color: #ffffff;
  --tblr-navbar-active-color: #ffffff;
  --tblr-navbar-border-color: transparent;
  background-color: #0F2340;
  color: rgba(221, 228, 238, 0.78);
}
@media (min-width: 992px) {
  .uk-sidebar.navbar-vertical {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 1030;
    overflow: hidden !important;
  }
  .uk-sidebar .container-fluid {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
  }
  .uk-sidebar #sidebar-menu.navbar-collapse {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  .uk-sidebar .uk-sidebar__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: clip;
    overflow-anchor: none;
    overscroll-behavior: contain;
    scroll-behavior: auto;
    padding: 0 1rem 0.35rem 0.35rem;
    box-sizing: border-box;
  }
  .uk-sidebar .nav-item.active {
    overflow-anchor: none;
  }
  .uk-sidebar .nav-link {
    scroll-margin-block: 0;
  }
  .uk-sidebar #app-sidebar-scroll .navbar-nav,
  .uk-sidebar .uk-sidebar__scroll > .navbar-nav {
    max-height: none !important;
    overflow: visible !important;
    height: auto !important;
  }
  .uk-sidebar__footer {
    flex-shrink: 0;
  }
}
@media (max-width: 991.98px) {
  .uk-sidebar #sidebar-menu.navbar-collapse.show,
  .uk-sidebar #sidebar-menu.navbar-collapse.collapsing {
    max-height: calc(100dvh - 4.5rem);
    overflow: hidden;
    display: flex !important;
    flex-direction: column;
  }
  .uk-sidebar .uk-sidebar__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: clip;
    overflow-anchor: none;
    overscroll-behavior: contain;
    scroll-behavior: auto;
    padding: 0 1rem 0.35rem 0.35rem;
    box-sizing: border-box;
  }
  .uk-sidebar #app-sidebar-scroll .navbar-nav,
  .uk-sidebar .uk-sidebar__scroll > .navbar-nav {
    max-height: none !important;
    overflow: visible !important;
  }
}
.uk-sidebar .navbar-toggler { border-color: rgba(255,255,255,.25); }

.uk-sidebar .uk-sidebar__brand { padding: .6rem .75rem !important; margin: 0 !important; }
@media (max-width: 991.98px) { .uk-sidebar .uk-sidebar__tag { display: none !important; } .uk-sidebar .uk-sidebar__brand { padding: .25rem 0 !important; } }
.uk-sidebar .navbar-toggler { background: rgba(255,255,255,.08); }
.uk-sidebar .navbar-toggler-icon { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); }
.uk-sidebar__logo {
  display: inline-flex;
  align-items: center;
  background: #FAF9F6;
  border-radius: 10px;
  padding: .4rem .55rem;
  box-shadow: inset 0 0 0 1px rgba(217, 162, 27, .35);
}
.uk-sidebar__logo img { display: block; height: 34px; width: auto; max-width: 150px; object-fit: contain; }
.uk-sidebar__tag {
  display: block;
  margin-top: .55rem;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--uk-gold);
  text-align: left;
}

.uk-sidebar .nav-section-title {
  display: block;
  padding: .25rem .75rem;
  margin: .9rem 0 .2rem;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(221, 228, 238, 0.45);
}
.uk-sidebar .navbar-nav {
  width: 100%;
  padding-right: 0.15rem;
  box-sizing: border-box;
}
.uk-sidebar .navbar-nav .nav-item {
  width: 100%;
  max-width: 100%;
}
.uk-sidebar .navbar-nav .nav-link {
  display: flex;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  color: rgba(221, 228, 238, 0.82);
  border-radius: 8px;
  padding: .42rem .65rem .42rem .75rem;
  gap: .45rem;
  align-items: center;
  font-weight: 500;
  position: relative;
  overflow: visible;
}
.uk-sidebar .nav-link-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.uk-sidebar .navbar-nav .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.uk-sidebar .nav-item.active > .nav-link,
.uk-sidebar .nav-link.active {
  color: #fff;
  background: rgba(217, 162, 27, .16);
}
.uk-sidebar .nav-item.active > .nav-link::before {
  content: '';
  position: absolute;
  left: -.75rem;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--uk-gold);
}
.uk-sidebar .nav-link-icon { display: inline-flex; width: 1.25rem; justify-content: center; opacity: .85; }
.uk-sidebar .nav-link-icon svg { width: 18px; height: 18px; }
.uk-sidebar .nav-item.active .nav-link-icon { opacity: 1; color: var(--uk-gold); }
.uk-sidebar .nav-link .badge {
  flex: 0 0 auto;
  margin-left: auto;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: var(--uk-gold) !important;
  color: #0F2340 !important;
  border: 2px solid rgba(15, 35, 64, 0.55);
  box-shadow: none;
}

.uk-sidebar__footer {
  margin-top: auto;
  padding-top: .75rem;
  border-top: 1px solid rgba(255, 255, 255, .10);
}
.uk-sidebar__user {
  margin: 0 0 .1rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .6rem;
  border-radius: 10px;
  color: #fff;
  text-decoration: none;
}
.uk-sidebar__user:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.uk-sidebar__user.is-active { background: rgba(217, 162, 27, .16); }
.uk-avatar {
  width: 2.25rem; height: 2.25rem; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--uk-gold); color: #0F2340;
  font-weight: 700; font-size: .95rem;
}
.uk-sidebar__user strong { display: block; font-size: .875rem; line-height: 1.2; }
.uk-sidebar__user small { color: rgba(221, 228, 238, .6); font-size: .75rem; }
.uk-sidebar__link {
  display: flex; align-items: center; gap: .6rem;
  padding: .4rem .6rem; border-radius: 8px;
  color: rgba(221, 228, 238, .75); text-decoration: none; font-size: .875rem;
}
.uk-sidebar__link:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.uk-sidebar__link--logout:hover { color: #ffb4be; background: rgba(156, 42, 58, .25); }
.uk-sidebar__link svg { width: 18px; height: 18px; }

/* ---------- Barre supérieure ---------- */
.uk-topbar {
  background: #fff;
  border-bottom: 1px solid var(--tblr-border-color);
  min-height: 3.5rem;
}
.uk-topbar__kicker {
  margin: 0;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #15603A;
}
.uk-topbar__crumb { display: flex; align-items: center; gap: .6rem; }
.uk-topbar__crumb .uk-topbar__title::before { content: '/'; margin-right: .6rem; color: #B9B2A1; font-weight: 400; }
.uk-topbar__title { margin: 0; font-size: .95rem; font-weight: 600; color: var(--uk-navy); }
.uk-topbar__date { font-size: .85rem; color: #5F6672; margin-left: .5rem; padding-left: .75rem; border-left: 1px solid var(--tblr-border-color); }
.uk-topbar .dropdown-menu { min-width: 14rem; }
.uk-topbar__account {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-left: .75rem;
  padding-left: .75rem;
  border-left: 1px solid var(--tblr-border-color);
}
.uk-topbar__profile {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
  color: var(--uk-navy);
  border-radius: 8px;
  padding: .2rem .35rem;
  max-width: min(220px, 42vw);
}
.uk-topbar__profile:hover { background: rgba(15, 35, 64, .06); color: var(--uk-navy); }
.uk-topbar__profile.is-active { background: rgba(21, 96, 58, .1); }
.uk-topbar__profile-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.uk-topbar__profile-text strong { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uk-topbar__profile-text small { font-size: .72rem; color: #5F6672; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uk-avatar--sm { width: 1.85rem; height: 1.85rem; font-size: .8rem; }
.uk-topbar__logout {
  font-size: .82rem;
  font-weight: 600;
  color: #15603A;
  text-decoration: none;
  white-space: nowrap;
  padding: .35rem .5rem;
  border-radius: 8px;
}
.uk-topbar__logout:hover { color: #0E4429; background: rgba(21, 96, 58, .08); }
@media (max-width: 767.98px) {
  .uk-topbar__profile-text { display: none; }
  .uk-topbar__date { display: none !important; }
  .uk-topbar__account { margin-left: auto; padding-left: 0; border-left: 0; }
}

/* ---------- En-tête de page & cartes statistiques ---------- */
.uk-page-head { margin: 0 0 1.5rem !important; }
.uk-page-head__title { font-size: 1.5rem; font-weight: 700; color: var(--uk-navy); margin: 0; }
.uk-page-head__desc { margin: .2rem 0 0; color: #5F6672; }

.stats-icon, .uk-stat__icon {
  width: 2.75rem; height: 2.75rem; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; font-size: 1.25rem;
}
.uk-stat__icon svg { width: 22px; height: 22px; }
.uk-stat__icon--primary { background: #E5F1EA; color: #15603A; }
.uk-stat__icon--success { background: #E5F1EA; color: #15603A; }
.uk-stat__icon--warning { background: #FBF3DA; color: #7F5A06; }
.uk-stat__icon--info { background: #E0F2F0; color: #0F766E; }
.uk-stat__icon--danger { background: #FBE9EC; color: #9C2A3A; }
.uk-stat__icon--secondary { background: #ECE8DF; color: #5F6672; }
.uk-stat__value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; color: var(--uk-navy); }

/* Contenu pleine largeur pour les écrans de travail */
.page { min-width: 0; }
.page-wrapper { max-width: 100%; min-width: 0; overflow-x: hidden; }
.page-body { min-width: 0; }
.page-body > .container-xl {
  max-width: min(1400px, 100%);
  min-width: 0;
  width: 100%;
}
body.page-app .table-responsive { max-width: 100%; }
body.page-app .table { width: 100%; }
body.page-app .table td { overflow-wrap: anywhere; word-break: break-word; }
body.page-app .table-actions-inline,
body.admin-body .table-actions-inline {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  white-space: nowrap;
}
body.page-app td:has(> .table-actions-inline),
body.admin-body td:has(> .table-actions-inline) {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  width: 1%;
}
@media print { .uk-sidebar, .uk-topbar { display: none !important; } .page-wrapper { margin-left: 0 !important; } }

/* ---------- Échelle typographique (Tabler est plus compact que Bootstrap) ---------- */
h1, .h1 { font-size: 1.75rem; font-weight: 700; }
h2, .h2 { font-size: 1.4rem; font-weight: 700; }
h3, .h3 { font-size: 1.2rem; font-weight: 600; }
h4, .h4 { font-size: 1.05rem; font-weight: 600; }
h5, .h5 { font-size: 1rem; font-weight: 600; }
h6, .h6 { font-size: .9rem; font-weight: 600; }
.card-title { font-size: 1rem; font-weight: 600; color: var(--uk-navy); }
.card-header .card-title { margin: 0; }
.uk-topbar__title { font-size: .95rem !important; }
.uk-page-head__title { font-size: 1.6rem !important; }
.badge.text-bg-secondary { background: #ECE8DF !important; color: #3F4755 !important; font-weight: 600; }
.analysis-import-panel > .card-header { display: block; padding: 1.1rem 1.25rem; }
.analysis-import-panel > .card-header h2 { font-size: 1.15rem; margin: .1rem 0 .35rem; }
.card-header.save-block__head { display: block; padding: 1.1rem 1.25rem; }
.save-block__head h2, .save-block__head h3 { font-size: 1.1rem; margin: .1rem 0 .3rem; }
.save-block__step { margin: 0; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #15603A; }
body.page-app .form-group input, body.page-app .form-group select, body.page-app .form-group textarea { background: #fff; border-color: var(--tblr-border-color); }
body.page-app .form-group input:focus, body.page-app .form-group select:focus, body.page-app .form-group textarea:focus { background: #fff; }
.card-header { flex-wrap: wrap; }
.card-header > p { flex-basis: 100%; }
.card-table td code { white-space: nowrap; }
