/* Readable tables in texts (25. 10. 2026, BACKLOG #482; Václav: "text v buňkách tabulek je slepený bez mezer mezi sloupci").
   Cause: Bootstrap 3 resets td/th padding to 0 and eletur.css only makes text tables scroll (display:block), so cells of
   tables without inline styles touched each other. This file gives every text table the look Václav approved on 29. 9. 2026
   for the styled product tables (_nastenka/vlastni-texty-394/.../styl_tabulek.py): cell padding, a dark header, light borders,
   zebra rows, full width on desktop and horizontal scrolling instead of squeezed columns on a phone.
   Scope: product description, technical info and downloads tabs (.et-content-card), category texts top and bottom, guides,
   information, FAQ and legal pages (.et-richtext) - the templates that load content-text-20260928.css load this file
   right after it (not the brand page: its tables have their own look from #398, manufacturer_info.twig). Not touched:
   Bootstrap tables (.table: Specifikace tab, reviews, cart, orders), brand intro tables (.et-brand-intro), layout tables with
   images or nested tables, empty tables without cells, tables styled by styl_tabulek.py (#d9dde1 inline on the table or on
   any cell - they stay exactly the same), rows and cells with their own style, bgcolor, align or valign (row or cell), and
   every property a text sets inline (inline styles always win). v2 25. 10. 2026 after the gate (KK/KF).
   Texts in the database are not changed. Browsers without :has() skip these rules and keep the previous look. */

:is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) {
  border-collapse: collapse;
  border-spacing: 0;
  border: 1px solid #d9dde1;
  font-size: 14px;
  line-height: 1.45;
}

:is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) :is(td, th) {
  padding: 8px 12px;
  border: 1px solid #e3e6e9;
}

:is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) :is(td, th):not([valign]):not(tr[valign] > *) {
  vertical-align: top;
}

:is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) :is(td, th):not([align]):not(tr[align] > *) {
  text-align: left; /* category texts are justified; justified cells leave gaps between words */
}

/* Column headers: thead cells and header rows made only of th (tables without thead); a cell styled in the text keeps its own look */
:is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) thead th:not([style]):not([bgcolor]):not(tr[style] > *):not(tr[bgcolor] > *),
:is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) tr:not(:has(td)):not([style]):not([bgcolor]) > th:not([style]):not([bgcolor]) {
  background: #2b3035;
  color: #fff;
  font-weight: 600;
  border-color: #2b3035;
}

/* A section row inside the body (one th across all columns) stays light, as in the styled tables */
:is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) tbody tr:not(:has(td)):not([style]):not([bgcolor]) > th[colspan]:only-child:not([style]):not([bgcolor]) {
  background: #eef0f2;
  color: #2b3035;
  font-weight: 700;
  border-color: #d9dde1;
}

/* Row headers (th next to td) */
:is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) tr:has(td) > th:not([style]) {
  font-weight: 600;
}

:is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) tbody > tr:nth-child(even):not([style]):not([bgcolor]):has(td) > :is(td, th):not([style]):not([bgcolor]) {
  background: #f6f7f8;
}

@media (min-width: 768px) {
  /* Desktop: across the full text width; long words wrap inside a cell instead of pushing the page sideways */
  :is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) {
    display: table;
    width: 100%;
  }

  :is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) :is(td, th) {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 767px) {
  /* Phone: the table keeps display:block + overflow-x:auto from eletur.css, so it scrolls sideways; tables with three or
     more columns get a minimum cell width, so the columns are not squeezed into a few letters; words are not split */
  :is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) :is(td, th) {
    overflow-wrap: normal;
    hyphens: manual;
  }

  :is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th):has(tr > :nth-child(3)) :is(td, th) {
    min-width: 140px;
  }
}

/* Shipping overview page has its own designed table (information.twig rules with an id win for padding and alignment):
   undo the rest, so it stays exactly as before */
#information-information:has(.breadcrumb a[href$="/doprava-prehled-moznosti"]) .et-richtext table {
  display: block;
  border: 0;
}

#information-information:has(.breadcrumb a[href$="/doprava-prehled-moznosti"]) .et-richtext table :is(td, th) {
  border: 0;
  background: none;
  color: inherit;
  overflow-wrap: inherit;
  hyphens: inherit;
  min-width: 0;
}

#information-information:has(.breadcrumb a[href$="/doprava-prehled-moznosti"]) .et-richtext table th {
  font-weight: bold;
}

@media print {
  /* Printers drop backgrounds: dark header text must not turn white on white paper */
  :is(.et-content-card, .et-richtext) table:not(.table):not(.et-brand-intro table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) th:not([style]) {
    background: none;
    color: #000;
  }
}
