/* ==========================================================================
   1. ALGEMENE STYLING & DESKTOP WEERGAVE
   ========================================================================== */

html, body {
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

.default_table {
  width: 100%;
  border-collapse: collapse;
}

.default_table th,
.default_table td {
  padding: 10px;
  vertical-align: middle;
  border-bottom: 1px solid #f4f4f4;
}

/* Vertel de tabelcel dat hij niet mag krimpen of afbreken */
.default_table td.actions {
  white-space: nowrap;
}

/* De actieknoppen waterdicht naast elkaar op álle schermen */
.action-knoppen {
  display: flex !important;
  flex-direction: row !important; /* Forceer altijd netjes naast elkaar */
  flex-wrap: nowrap !important;   /* Verbied om onder elkaar te vallen */
  justify-content: flex-end;      /* Duwt ze op desktop strak naar rechts */
  align-items: center;
  gap: 10px;
}


/* ==========================================================================
   2. MOBIELE WEERGAVE (Uitgeklede platte lijst) - STRENGE VERSIE
   ========================================================================== */

@media screen and (max-width: 992px) {

  .default_table,
  .default_table tbody {
    display: block !important;
    width: 100% !important;
  }

  .default_table tr.dataTableHeadingRow {
    display: none !important;
  }

  .default_table tr.dataTableRow {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    padding: 12px 10px !important;
    border-bottom: 1px solid #ddd !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* ----------------------------------------------------------------------
     DE BOTTE BIJL: Verberg keihard ALLE cellen op mobiel
     ---------------------------------------------------------------------- */
  .default_table td {
    display: none !important;
    padding: 0 !important;
    border: none !important;
  }

  /* Laat de Actieknoppen altijd zien (en duw ze naar rechts) */
  .default_table td.actions {
    display: flex !important;
    align-items: center !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
    min-width: max-content !important;
    padding-left: 15px !important;
  }

  /* ----------------------------------------------------------------------
     SPECIFIEK VOOR DE CATEGORIE TABEL (#cat)
     ---------------------------------------------------------------------- */

  /* Forceer cel 2 (Type mapje) en cel 3 (Naam) om zichtbaar te zijn */
  #cat td:nth-child(2),
  #cat td:nth-child(3) {
    display: block !important;
  }

  #cat td:nth-child(2) {
    margin-right: 15px !important;
    flex-shrink: 0 !important;
  }

  #cat td:nth-child(3) {
    flex: 1 1 0% !important;
    min-width: 0 !important;
  }

  /* ----------------------------------------------------------------------
     SPECIFIEK VOOR DE PRODUCT TABEL (#prod)
     ---------------------------------------------------------------------- */

  /* Forceer cel 2 (Type), cel 3 (Code) en cel 4 (Naam) om zichtbaar te zijn */
  #prod td:nth-child(2),
  #prod td:nth-child(3),
  #prod td:nth-child(4) {
    display: block !important;
  }

  #prod td:nth-child(2) {
    margin-right: 15px !important;
    flex-shrink: 0 !important;
  }

  #prod td:nth-child(3) {
    margin-right: 10px !important;
    flex-shrink: 0 !important;
  }

  #prod td:nth-child(3) a {
    color: #888 !important;
    font-size: 13px !important;
  }

  #prod td:nth-child(4) {
    flex: 1 1 0% !important;
    min-width: 0 !important;
  }

  /* ----------------------------------------------------------------------
     LETTERTYPES EN TEKSTAFBREEK
     ---------------------------------------------------------------------- */

  #cat td:nth-child(3) a,
  #prod td:nth-child(4) a {
    text-decoration: none !important;
    color: #333 !important;
    font-weight: 500 !important;
    display: block !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
  }
}

@media screen and (max-width: 992px) {
  /* De cellen zelf mogen de overgebleven ruimte invullen */
  #cat td:nth-child(3),
  #prod td:nth-child(4) {
    flex: 1 1 0% !important;
    min-width: 0 !important;
  }

  /* DE OPLOSSING VOOR VERTICALE TEKST */
  #cat td:nth-child(3) a,
  #prod td:nth-child(4) a {
    display: block !important;
    font-size: 14px !important;
    text-decoration: none !important;
    color: #333 !important;
    font-weight: 500 !important;

    /* Deze 3 regels lossen het op: */
    white-space: nowrap !important;       /* Dwingt de tekst om strak op 1 horizontale regel te blijven */
    overflow: hidden !important;          /* Verbergt de letters die buiten het scherm/de doos vallen */
    text-overflow: ellipsis !important;   /* Zet automatisch "..." aan het einde als het niet past */
  }
}
