/* ==========================================================================
   Base
   ========================================================================== */
body{
  background:#f7fafd;
  font-family:'Inter',Arial,sans-serif;
}

/* ==========================================================================
   Navbar
   ========================================================================== */
.navbar.lenormant-navbar{
  background:linear-gradient(90deg,#1972b8 70%,#2996e2 100%);
  box-shadow:0 2px 14px 0 #1972b820;
  border-bottom:2px solid #e6f1fb;
  min-height:56px; padding:.4rem 0;
}
.navbar.lenormant-navbar .navbar-brand img{ height:38px; margin-right:.5rem; }
.navbar.lenormant-navbar .navbar-nav .nav-link{
  color:#fff!important; font-weight:700; font-family:'Inter',Arial,sans-serif;
  font-size:1.06rem; padding:.51rem 1.1rem .51rem .9rem; border-radius:7px;
  display:flex; align-items:center; transition:color .18s,background .14s; letter-spacing:.01em;
}
.navbar.lenormant-navbar .navbar-nav .nav-link.active,
.navbar.lenormant-navbar .navbar-nav .nav-link:hover,
.navbar.lenormant-navbar .navbar-nav .nav-link:focus{
  color:#ffc107!important; background:rgba(255,255,255,.09); text-shadow:0 1px 10px #2996e230;
}
.navbar.lenormant-navbar .navbar-nav .nav-link i{ margin-right:.47em; font-size:1.1em; opacity:.93; }
.navbar.lenormant-navbar .navbar-nav .nav-item:not(:last-child){ margin-right:.3rem; }
.navbar.lenormant-navbar .site-selector{
  margin-left:1.4rem; display:flex; align-items:center; gap:.8rem;
  background:rgba(255,255,255,.09); border-radius:7px; padding:.2rem .7rem .2rem .5rem;
}
.navbar.lenormant-navbar .site-selector select{
  font-size:.98rem; border-radius:6px; border:1.2px solid #e3f0fa; background:#f8fafc; color:#225ea8;
  padding:4.5px 12px; font-weight:600; outline:none; min-width:120px;
}
.navbar.lenormant-navbar .site-loader{ margin-left:10px; }
.navbar.lenormant-navbar .site-loader i{ color:#fff; }
.navbar.lenormant-navbar .navbar-toggler{
  border-radius:8px; border:1.5px solid #1972b8; background:rgba(255,255,255,.08)!important; transition:background .18s;
}
.navbar.lenormant-navbar .navbar-toggler:focus{
  outline:none; box-shadow:0 0 0 2px #1972b850; background:#e6f1fb33!important;
}
.navbar.lenormant-navbar .navbar-toggler-icon{ background-image:none!important; color:#fff; }
.navbar.lenormant-navbar .navbar-toggler-icon:before{
  content:'\f0c9'; font-family:"Font Awesome 5 Free"; font-weight:900; font-size:1.32rem; color:#fff; display:block; line-height:1;
}
@media (max-width:991px){
  .navbar.lenormant-navbar .navbar-nav .nav-link{ padding:.48rem .82rem .48rem .7rem; }
  .navbar.lenormant-navbar .site-selector{ margin:.8rem 0 .2rem 0; padding:.18rem .45rem; }
}
@media (max-width:600px){
  .navbar.lenormant-navbar .navbar-brand img{ height:30px; }
  .navbar.lenormant-navbar .navbar-nav .nav-link{ font-size:.96rem; }
  .navbar.lenormant-navbar .site-selector select{ font-size:.91rem; }
}
.site-loader{ display:none; margin-left:10px; }

/* ==========================================================================
   Utils / Helpers
   ========================================================================== */
.same-height{ height:calc(1.5em + .5rem + 2px); resize:none; }
.hstack{ display:flex; align-items:center; flex-wrap:wrap; }
.hstack>*+*{ margin-left:.5rem; }

.btn-xs{ padding:.25rem .5rem; font-size:.8rem; line-height:1.2; border-radius:.3rem; }
.btn-compact .btn-label{ display:none; }
@media (min-width:768px){ .btn-compact .btn-label{ display:inline; } }

.bg-gradient-blue{ background:linear-gradient(135deg,#2996e2 60%,#5ebff7 100%)!important; color:#fff!important; }
.bg-gradient-deepblue{ background:linear-gradient(135deg,#1972b8 70%,#2996e2 100%)!important; color:#fff!important; }
.bg-gradient-green{ background:linear-gradient(135deg,#53e39a 80%,#2996e2 120%)!important; color:#fff!important; }

/* ==========================================================================
   Dashboard Header
   ========================================================================== */
.dashboard-header{
  background:linear-gradient(90deg,#2996e2 0%,#8fd7f7 100%);
  color:#fff; border-radius:18px; padding:1.2rem 2rem; box-shadow:0 4px 20px rgba(44,94,170,.08);
  margin-bottom:2rem; display:flex; align-items:center; gap:1.5rem;
}
.dashboard-header h1{ margin:0; font-size:2rem; font-weight:700; letter-spacing:-1px; }

/* ==========================================================================
   Stats (cartes)
   ========================================================================== */
.stats-bar{ display:flex!important; flex-direction:row!important; gap:2rem!important; justify-content:center!important; width:100%; margin:0 auto 2rem; align-items:stretch; }
.stat-card{
  display:flex; align-items:center; background:#fff; border-radius:16px; box-shadow:0 2px 20px #1972b814;
  padding:1.1rem 1.5rem; transition:box-shadow .14s, transform .14s; min-height:68px; border:none; min-width:220px; max-width:260px; margin:0 8px;
}
.stat-card:hover{ transform:translateY(-3px) scale(1.03); box-shadow:0 6px 32px #1972b828; z-index:2; }
.stat-icon{ width:42px; height:42px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:1.45rem; box-shadow:0 1px 10px #1972b820; background:#f7fafd; flex-shrink:0; }
.stat-info{ display:flex; flex-direction:column; align-items:flex-start; flex:1; }
.stat-info h3,.stat-card .stat-value{ font-size:1.19rem; font-weight:700; margin-bottom:1px; color:#1a2341; line-height:1.1; }
.stat-info p,.stat-card .stat-label{ font-size:.97rem; color:#485b7d; font-weight:500; margin:0; line-height:1.05; }
@media (max-width:1200px){ .stats-bar{ gap:1.3rem; } .stat-card{ min-width:180px; max-width:260px; padding:1rem 1.2rem; } }
@media (max-width:900px){ .stats-bar{ flex-wrap:wrap; gap:1rem; } .stat-card{ min-width:160px; max-width:96vw; padding:.88rem 1.1rem; } }
@media (max-width:700px){ .stats-bar{ flex-direction:column; gap:1.2rem; } .stat-card{ min-width:unset; max-width:100%; width:100%; } .stat-icon{ width:34px; height:34px; font-size:1.19rem; margin-right:.75rem; } }

/* Header compact (dans card .bg-secondary) */
.stats-bar-header{ display:flex; align-items:center; gap:1.1rem; }
.stat-header{
  display:flex; align-items:center; gap:.4rem; background:rgba(255,255,255,.13);
  border-radius:9px; padding:.23rem .8rem; box-shadow:0 2px 10px #1972b80a; margin:0;
}
.stat-icon-header{ display:flex; align-items:center; justify-content:center; width:26px; height:26px; border-radius:50%; font-size:1.13rem; margin-right:.18rem; }
.stat-number-header{ font-weight:700; font-size:1.09rem; color:#fff; margin-right:.08rem; }
.stat-label-header{ font-size:.97rem; color:#f5faff; opacity:.88; white-space:nowrap; }
@media (max-width:900px){ .stats-bar-header{ gap:.4rem; flex-wrap:wrap; } .stat-header{ padding:.14rem .41rem; font-size:.91rem; } }
@media (max-width:700px){ .stats-bar-header{ flex-direction:column; align-items:flex-start; gap:.6rem; margin-top:.6rem; } }

/* ==========================================================================
   Export bar
   ========================================================================== */
.export-bar{ min-width:170px; gap:.45rem!important; align-items:center; }
.export-bar .btn{ min-width:130px; font-size:.95rem; padding:.32rem .92rem; white-space:nowrap; border-radius:8px!important; }

/* ==========================================================================
   Cards (général)
   ========================================================================== */
.card{ border-radius:18px!important; border:none; box-shadow:0 2px 24px rgba(56,98,185,.08); }
.card-header{
  border-radius:18px 18px 0 0!important; font-size:1.13rem; font-weight:600;
  background:linear-gradient(90deg,#335a92,#93b9d9 120%); color:#fff!important; box-shadow:0 2px 8px rgba(44,94,170,.05);
}
.card-body{ background:#f7fbff; border-radius:0 0 18px 18px!important; }

/* ==========================================================================
   Buttons
   ========================================================================== */
/* ATTENTION : ne pas cibler .btn (pour ne pas casser les outline) */
.btn-primary,.btn-secondary,.btn-success,.btn-danger,.btn-warning{
  background:linear-gradient(90deg,#1972b8 94%,#2996e2 100%)!important;
  border:none!important; color:#fff!important; font-weight:700; box-shadow:0 2px 12px #1972b822; border-radius:8px!important;
  transition:background .17s, box-shadow .15s, transform .13s, color .15s;
}
.btn-primary:hover,.btn-secondary:hover,.btn-success:hover,.btn-danger:hover,.btn-warning:hover,
.btn-primary:focus,.btn-secondary:focus,.btn-success:focus,.btn-danger:focus,.btn-warning:focus{
  background:linear-gradient(90deg,#155191 92%,#1972b8 100%)!important; color:#fff!important; box-shadow:0 4px 20px #15519133; transform:translateY(-2px) scale(1.04);
}
.btn:active{ box-shadow:0 2px 6px #1972b877; transform:none; }
.btn-link,.btn-link:focus,.btn-link:active{ color:#1972b8!important; text-decoration:underline; background:none!important; border:none!important; font-weight:700; }
.btn-link:hover{ color:#155191!important; background:#eaf3fa!important; }
.btn-sm{ font-size:.94rem; padding:.3rem .9rem; border-radius:8px!important; font-weight:600; }

/* Bouton BL en retard */
.btn-late-bl{ --late:#b00020; color:#fff; background:var(--late); border-color:var(--late); }
.btn-late-bl:hover{ background:#8e001a; border-color:#8e001a; }
.badge-xs{ font-size:.65rem; padding:.12rem .3rem; border-radius:.35rem; }

/* ==========================================================================
   File input / Uploader
   ========================================================================== */
.custom-file-input:focus ~ .custom-file-label{ border-color:#2996e2; box-shadow:0 0 0 .2rem #2996e24a; }
.file-uploader.input-group-sm .input-group-text,
.file-uploader.input-group-sm .custom-file-input,
.file-uploader.input-group-sm .custom-file-label{ height:calc(1.5rem + 2px); padding:.25rem .5rem; font-size:.85rem; line-height:1.2; }
.file-uploader .input-group-text{ background:#fff; border-right:0; }
.file-uploader .custom-file-label{
  border-left:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;
  border-top-right-radius:0; border-bottom-right-radius:0;
}
.file-uploader .input-group-append>.btn{ border-top-left-radius:0; border-bottom-left-radius:0; }
.file-uploader.is-dragover{ outline:2px dashed #0d6efd; outline-offset:2px; }
.file-uploader.is-dragover .input-group-text{ background:#e7f1ff; }

/* ==========================================================================
   BL list – version “items” (ancienne grille compacte)
   ========================================================================== */
.bl-list{ display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:.7rem; margin-top:1.2rem; }
.bl-item{
  background:#f7fafc; border:1.2px solid #e5eaf1; border-radius:11px; padding:.4rem .7rem .35rem;
  display:flex; flex-direction:column; min-height:56px; position:relative; transition:box-shadow .18s, background .18s; cursor:pointer;
}
.bl-item:hover{ box-shadow:0 4px 12px #d8e6fa77; background:#eaf6ff; }
.bl-item.bl-selected{ background:#e2f1ff; border-color:#6ed3ff; }
.bl-item.bl-taken{ border:2px solid #22c55e!important; box-shadow:0 0 0 2px #22c55e33; }
.bl-preparation{ background:#fff6df!important; }
.bl-await{ background:#e7ffe7!important; }
.bl-old{ background:#ffeaea!important; }
.bl-toprow{ display:flex; align-items:center; justify-content:space-between; margin-bottom:.2rem; gap:.7rem; width:100%; }
.bl-name{ display:flex; align-items:center; font-weight:700; font-size:1.08rem; gap:.32rem; margin-bottom:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:140px; }
.bl-btns{ display:flex; align-items:center; gap:.48rem; flex-shrink:0; }
.bl-btns a,.bl-btns button{ font-size:1.08rem; padding:0 .07em; background:none; border:none; color:#1972b8; transition:color .16s; }
.bl-btns a:hover,.bl-btns button:hover{ color:#145285; }
.bl-customer{ font-size:.97rem; color:#555e7a; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:165px; display:block; line-height:1.12; margin:2px 0 0; }
@media (max-width:600px){
  .bl-list{ grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); }
  .bl-btns{ gap:.22rem; }
  .bl-customer{ max-width:90px; font-size:.84rem; }
  .bl-name{ font-size:.98rem; max-width:70px; }
}

/* ==========================================================================
   BL list – version “cards” (grille 4/3/2/1)
   ========================================================================== */
.bl-grid{ display:flex; flex-wrap:wrap; gap:.75rem; }
.bl-card{
  --pad-y:.55rem; --pad-x:.65rem;
  position:relative; border:1px solid #e9ecef; border-left-width:.4rem;
  border-radius:.6rem; background:#fff; padding:var(--pad-y) var(--pad-x);
  box-shadow:0 2px 6px rgba(0,0,0,.04); transition:transform .08s, box-shadow .12s, border-color .12s; cursor:pointer;
  flex:1 1 calc(25% - .75rem); max-width:calc(25% - .75rem);
}
.bl-card:hover{ transform:translateY(-1px); box-shadow:0 6px 16px rgba(0,0,0,.06); }
.bl-card.bl-taken{ background:#f8f9fa; }
.bl-card.table-success{ border-left-color:#28a745; }
.bl-card.table-warning{ border-left-color:#ffc107; }
.bl-card.table-danger{ border-left-color:#dc3545; }
.bl-card:not(.table-success):not(.table-warning):not(.table-danger){ border-left-color:#6c757d; }
.bl-header-row{ display:flex; align-items:center; gap:.5rem; }
.bl-name{ font-weight:600; line-height:1.2; max-width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
@media (min-width:420px){ .bl-name{ max-width:24ch; } }
@media (min-width:680px){ .bl-name{ max-width:32ch; } }
.bl-actions{ margin-left:auto; display:inline-flex; align-items:center; gap:.25rem; }
.bl-actions .icon-btn{ display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius:6px; border:none; background:transparent; }
.bl-actions .icon-btn:hover{ background:#eef1f4; }
.bl-meta{ display:flex; align-items:center; gap:.4rem; flex-wrap:wrap; margin-top:.25rem; }
.bl-chip{
  display:inline-flex; align-items:center; gap:.35rem; font-size:.75rem; line-height:1;
  padding:.22rem .5rem; border-radius:999px; background:#f1f3f5; color:#495057; border:1px solid #e2e6ea;
}
.bl-chip i{ opacity:.7; }
.bl-badges{ margin-left:auto; display:inline-flex; gap:.35rem; }
.badge-soft{ font-size:.72rem; line-height:1; padding:.22rem .45rem; border-radius:.4rem; border:1px solid transparent; }
.badge-soft.warn{ background:#fff3cd; color:#856404; border-color:#ffe8a1; }
.badge-soft.info{ background:#e8f4ff; color:#0b5ed7; border-color:#cfe2ff; }
.bl-check{ transform:translateY(1px); margin-right:.25rem; }
.bl-card.is-active{ outline:2px solid #0d6efd; outline-offset:2px; }
@media (max-width:1400px){ .bl-card{ flex-basis:calc(33.333% - .75rem); max-width:calc(33.333% - .75rem); } }
@media (max-width:992px){ .bl-card{ flex-basis:calc(50% - .75rem); max-width:calc(50% - .75rem); } }
@media (max-width:576px){ .bl-card{ flex-basis:100%; max-width:100%; } }
.bl-magasinier{ margin-top:.25rem; font-size:.8rem; color:#198754; font-weight:500; }

/* ==========================================================================
   BL Preview
   ========================================================================== */
#blPreviewContainer{ background:#f7fbff; border:1px solid #e3eaf3; border-radius:10px; padding:.9rem; }
#blPreview{ height:400px; border:1px solid #dee2e6; }
#blMissing{ display:none; }

/* ==========================================================================
   Table
   ========================================================================== */
.table{ border-radius:10px; overflow:hidden; background:#fbfdff; }
.table th,.table td{ vertical-align:middle; }
.table th{ color:#276fc9; font-weight:700; background:#e6f1fb; font-size:1rem; border-top:none; }
.table-striped tbody tr:nth-of-type(odd){ background:#f4f8fc; }
.table-striped tbody tr:nth-of-type(even){ background:#fff; }
.table td{ color:#495570; font-size:.97rem; }

/* ==========================================================================
   Badges
   ========================================================================== */
.badge{ font-size:1rem; font-weight:600; border-radius:7px; padding:.26em .8em; letter-spacing:.02em; }
.badge.bg-warning{ background:#ffe082!important; color:#856800!important; }
.badge.bg-info{ background:#91e3fa!important; color:#1b618d!important; }
.badge.bg-success{ background:#b8f5c7!important; color:#177a3a!important; }

/* ==========================================================================
   Carousel / Photos
   ========================================================================== */
.carousel-item{ position:relative; }
.photo-banner{
  position:absolute; bottom:0; left:0; width:100%; z-index:10;
  background:rgba(0,0,0,.6); color:#fff; font-size:.75rem; line-height:1.2; padding:2px 4px; word-break:break-word; display:flex; align-items:center;
}
.photo-delete-form{ margin-left:auto; }
.photo-delete-form button{ background:transparent; border:none; color:#fff; padding:0 4px; line-height:1; font-size:1.5rem; }

/* ==========================================================================
   Divers
   ========================================================================== */
.export-bar{ min-width:170px; gap:.45rem!important; align-items:center; }
.bl-toggle{ cursor:pointer; }
.bl-iframe{ height:100%; min-height:600px; border:1px solid #dee2e6; }
.tracking-badge{ font-size:1em; padding:7px 13px; }
.type-badge.invisible{ opacity:0; }
.parcel-header{ cursor:pointer; }
.min-w-135{ min-width:135px; }

/* ==========================================================================
   Responsive ajustements
   ========================================================================== */
@media (max-width:1200px){
  .dashboard-actionbar{ gap:1.1rem!important; }
  .stats-bar .stat-card{ min-width:60px!important; }
}
@media (max-width:991px){
  .dashboard-header{ padding:.6rem 1.1rem; font-size:1.2rem; }
  .bl-list{ grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); }
  .dashboard-actionbar,.stats-bar,.export-bar{ flex-wrap:wrap!important; }
  .dashboard-actionbar{ gap:1.5rem!important; }
  .export-bar{ flex-direction:column!important; align-items:stretch!important; }
}
@media (max-width:700px){
  .dashboard-header{ font-size:1rem; }
  .container-fluid{ padding:0 6px; }
  .card,.card-header,.card-body{ border-radius:8px!important; }
  .table th,.table td{ font-size:.89rem; }
  #blPreview{ height:180px!important; }
  .dashboard-actionbar{ flex-direction:column!important; gap:.85rem!important; }
  .stats-bar{ flex-direction:column; gap:1.2rem; min-width:unset!important; flex-wrap:wrap!important; justify-content:flex-start; }
}

/* ==========================================================================
   Sites (checkbox list)
   ========================================================================== */
.site-checkboxes-list{
  display:grid; grid-template-columns:repeat(2,1fr); gap:8px 20px; margin-bottom:1rem;
}
.site-checkboxes-list label{
  display:flex; align-items:center; font-size:1.05rem; font-weight:500; cursor:pointer; white-space:normal; line-height:1.3;
}
.site-checkboxes-list input[type="checkbox"]{ margin-right:6px; }

/* Harmonisation boutons */
.btn-sm {
  padding: .35rem .75rem;
  font-size: .9rem;
  border-radius: .4rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-weight: 600;
}

.btn i { margin-right: .25rem; }

/* BL en retard */
.btn-danger {
  background: #dc3545;
  border-color: #dc3545;
}
.btn-danger:hover {
  background: #bb2d3b;
  border-color: #bb2d3b;
}
.btn-danger .badge {
  font-size: .7rem;
  padding: .15rem .35rem;
  border-radius: .35rem;
}

/* File input plus élégant */
.file-uploader .custom-file-label {
  border-left: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.file-uploader .input-group-text {
  background: #fff;
  border-right: 0;
}

/* Uploader PDF — aligné, lisible, FR */
.pdf-uploader.input-group-sm .input-group-text,
.pdf-uploader.input-group-sm .custom-file-input,
.pdf-uploader.input-group-sm .custom-file-label{
  height: calc(1.65rem + 2px);
  padding: .28rem .55rem;
  font-size: .9rem;
  line-height: 1.2;
}
.pdf-uploader .input-group-text{
  background:#fff; border-right:0; color:#6c757d;
}
.pdf-uploader .custom-file{ flex: 1 1 auto; }
.pdf-uploader .custom-file-label{
  border-left:0;
  overflow:hidden; white-space:nowrap; text-overflow:ellipsis;
  border-top-right-radius:0; border-bottom-right-radius:0;
}
/* Force la localisation du bouton de droite (fallback si BS < 4.3) */
.pdf-uploader .custom-file-label::after{
  content: attr(data-browse);
  background:#eef4fb; color:#155191; font-weight:600;
  border-left:1px solid #dee2e6;
}
/* Focus & drag */
.pdf-uploader.is-dragover{ outline:2px dashed #0d6efd; outline-offset:2px; }
.pdf-uploader.is-dragover .input-group-text{ background:#e7f1ff; }
.custom-file-input:focus ~ .custom-file-label{
  border-color:#2996e2; box-shadow:0 0 0 .2rem #2996e235;
}

/* Toolbar d'import BL : uploader à gauche (flex:1), actions à droite */
.bl-toolbar{
  display:flex; align-items:center; flex-wrap:wrap;
  gap:.5rem; /* espace régulier entre éléments */
}
.bl-toolbar .uploader-form{
  display:flex; align-items:center; gap:.5rem;
  flex: 1 1 420px; /* prend l'espace disponible */
  min-width: 320px;
}
.bl-toolbar .uploader{ flex:1 1 auto; min-width:260px; }

/* Groupe d'actions à droite */
.bl-toolbar .actions{
  display:flex; align-items:center; gap:.5rem;
  margin-left:auto; /* pousse à droite */
  flex-wrap:wrap;
}

/* Harmonise la hauteur avec l’input-group-sm */
.bl-toolbar .btn-sm{ line-height:1.2; }
@media (max-width: 576px){
  .bl-toolbar{ gap:.4rem; }
  .bl-toolbar .uploader-form{ flex-basis:100%; min-width:0; }
  .bl-toolbar .actions{ width:100%; justify-content:flex-start; }
}
