/* ================== FromApp – Rapports – Traçabilité ================== */

/* ---------------- Layout general ---------------- */
body {
  background: #f5f6fb;
}

/* ---------------- Header ---------------- */
/* Alineado con la card principal (.fa-main) */
.fa-header {
  display: flex;
  justify-content: space-between;
  align-items: center;          /* centrado vertical bonito */
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto 0.5rem;        /* centrado + pequeño espacio debajo */
  padding: 1.25rem 1.5rem 0.75rem;
  border-bottom: 2px solid #e2e8f0;
}

.fa-header-left h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  color: #0f172a;
}

.fa-header-sub {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: #6b7280;
}

/* ----- Header Right Buttons (Print + Menu principal) ----- */
.fa-header-right {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-left: auto;          /* Empuja los botones a la derecha */
}

/* Estilo específico para los botones del header
   (no tocamos HTML, usamos los IDs existentes) */
#btnPrint,
#btnBackMenu {
  background: #2563eb;
  color: #ffffff;
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
  transition: background-color .12s ease, transform .08s ease;
}

#btnPrint:hover,
#btnBackMenu:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

/* ---------------- Botones genéricos ---------------- */

.btn-primary,
.btn-secondary,
.btn-small,
.btn-pill {
  border-radius: 999px;
  border: none;
  font-size: 0.875rem;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  white-space: nowrap;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.12s ease;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: #e5e7eb;
  color: #111827;
}
.btn-secondary:hover {
  background: #d1d5db;
  transform: translateY(-1px);
}

.btn-small {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  background: #fee2e2;
  color: #b91c1c;
}
.btn-small:hover {
  background: #fecaca;
  transform: translateY(-1px);
}

.btn-pill {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 500;
  padding-inline: 0.85rem;
}
.btn-pill:hover {
  background: #dbeafe;
  transform: translateY(-1px);
}

/* ---------------- Main & filtros ---------------- */

.fa-main {
  padding: 0 1.5rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.fa-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  padding: 0.75rem 0;
}

.fa-filters label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #4b5563;
  display: block;
  margin-bottom: 0.15rem;
}

.fa-filters input,
.fa-filters select {
  width: 100%;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  outline: none;
  background: #ffffff;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.fa-filters input:focus,
.fa-filters select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

/* ---------------- Card principal ---------------- */

.fa-card {
  background: #ffffff;
  border-radius: 0.9rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.fa-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem 0.25rem;
  border-bottom: 1px solid #e5e7eb;
}

.fa-card-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}

.fa-step-badge {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.fa-card-body {
  padding: 0.75rem 1rem 1rem;
}

/* ---------------- Tabla principal ---------------- */

#tableLots {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

#tableLots thead th {
  background: #eceff5 !important;
  color: #1e293b !important;
  font-weight: 600;
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid #d1d5db;
  white-space: nowrap;
}

#tableLots tbody td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

#tableLots tbody tr:hover {
  background: #f1f5f9;
}

/* Celdas editables */

.cell-editable {
  cursor: pointer;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  display: inline-flex;
  min-width: 2.5rem;
}

.cell-editable.editing {
  background: #eef2ff;
}

.cell-input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 0.8rem;
  background: transparent;
  padding: 0.05rem 0;
}

/* Números */
.cell-poids,
.cell-poids-vendu {
  font-variant-numeric: tabular-nums;
}

/* Botón VOIR */
.btn-clients {
  font-size: 0.78rem;
}

/* ---------------- Colores por columna (clases oficiales) ---------------- */

td.cell-col-emballe   { background: #eff6ff; }  /* azul suave */
td.cell-col-demoule   { background: #fefce8; }  /* amarillo suave */
td.cell-col-rape      { background: #f0fdf4; }  /* verde suave */
td.cell-col-vendu     { background: #fff1f2; }  /* rosado suave */

td.cell-col-emballe:hover,
td.cell-col-demoule:hover,
td.cell-col-rape:hover,
td.cell-col-vendu:hover {
  opacity: .92;
}

/* ---------------- Ocultar Search interno de DataTables ---------------- */

.dataTables_filter {
  display: none !important;
}

/* ---------------- Modales ---------------- */

.fa-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 999;
}

.fa-modal[hidden] {
  display: none;
}

.fa-modal-dialog {
  background: #ffffff;
  border-radius: 0.9rem;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}

.fa-modal-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fa-modal-header h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: #111827;
}

.fa-modal-close {
  border: none;
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
  color: #6b7280;
}
.fa-modal-close:hover {
  color: #111827;
}

.fa-modal-body {
  padding: 0.85rem 1rem;
  overflow: auto;
  font-size: 0.85rem;
  color: #111827;
}

.fa-modal-footer {
  padding: 0.6rem 1rem 0.75rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Pantallas anchas */
@media (min-width: 900px) {
  #modalClients .fa-modal-dialog {
    max-width: 820px;
  }
}

/* ---------------- Formularios dentro de modales ---------------- */

.fa-form-row {
  margin-bottom: 0.7rem;
}

.fa-form-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.15rem;
}

.fa-form-row input {
  width: 100%;
  border-radius: 0.6rem;
  border: 1px solid #e5e7eb;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  outline: none;
  background: #f9fafb;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.fa-form-row input:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.18);
}

/* ---------------- Tablas dentro del modal Clients ---------------- */

.fa-table-clients,
.fa-table-clients-readonly {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.fa-table-clients thead th,
.fa-table-clients-readonly thead th {
  text-align: left;
  padding: 0.35rem 0.4rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  color: #4b5563;
  font-weight: 600;
}

.fa-table-clients tbody td,
.fa-table-clients-readonly tbody td {
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.fa-table-clients-readonly tbody tr:nth-child(odd) {
  background: #f9fafb;
}

.fa-table-clients input[type="text"],
.fa-table-clients input[type="number"] {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  padding: 0.25rem 0.45rem;
  font-size: 0.78rem;
  outline: none;
  background: #f9fafb;
}

.fa-table-clients input:focus {
  background: #ffffff;
  border-color: #2563eb;
}

.fa-table-clients .row-empty td {
  text-align: center;
  color: #9ca3af;
  font-style: italic;
}

/* ---------------- Toast ---------------- */

.fa-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 360px;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.25);
  color: #111827;
  background: #f9fafb;
  z-index: 1000;
  text-align: center;
}

.fa-toast-ok {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.fa-toast-warn {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fed7aa;
}
.fa-toast-err {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* ---------------- Responsivo ---------------- */

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

  .fa-header-right {
    align-self: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .fa-card-body {
    padding-inline: 0.5rem;
  }

  #tableLots thead th,
  #tableLots tbody td {
    padding-inline: 0.3rem;
  }

  .fa-modal-dialog {
    max-width: 100%;
  }
}

/* ---------------- Print Mode ---------------- */

@media print {

  body {
    background: white !important;
  }

  header, #filters, #btnBackMenu, .fa-toast, .fa-client-menu {
    display: none !important;
  }

  table.dataTable {
    border-collapse: collapse !important;
    font-size: 13px !important;
  }

  table.dataTable th,
  table.dataTable td {
    border: 1px solid #d1d5db !important;
    padding: 4px 6px !important;
  }

  table.dataTable thead th {
    background: #f0f0f0 !important;
    color: #000 !important;
  }

  button,
  .btn-pill,
  .btn-small {
    display: none !important;
  }

  /* Si quieres desactivar colores en impresión, descomenta:
  td.cell-col-emballe,
  td.cell-col-demoule,
  td.cell-col-rape,
  td.cell-col-vendu {
    background: #ffffff !important;
  }
  */
}
/* Bloque arriba del detalle con botón "Ouvrir dans Emballage / Démoulage / Rapés" */
.fa-modal-jump {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed #e5e7eb;
}
