/**
 * View: [opm-table]. Table-specific only — shared bits (legend, feat, status,
 * price, heart, compare, promo-label) live in base.css.
 */

.opm-table-wrap { width: 100%; max-width: var(--opm-content-max); margin: 0 auto; }

.opm-table { width: 100%; border-collapse: collapse; }

.opm-table__th {
  text-align: left;
  font-size: var(--opm-fs-2xs);
  font-weight: var(--opm-fw-black);
  text-transform: uppercase;
  color: var(--opm-color-ink);
  padding: 10px 10px 20px;
  border-bottom: 1px solid #AFAFAF;
  white-space: nowrap;
  vertical-align: bottom;
}
.opm-table__th--actions { text-align: right; }

.opm-table__sort {
  font: inherit; font-weight: var(--opm-fw-black); text-transform: uppercase;
  background: none; border: 0; padding: 0; cursor: pointer; color: inherit;
  display: inline-flex; align-items: center; gap: var(--opm-space-1);
}
/* Arrow shows only on the active (sorted) column and flips by direction.
   aria-sort lives on the <th>, so target from there — not the button. */
.opm-table__sort-arrow {
  font-weight: var(--opm-fw-regular);
  opacity: 0;
  transition: transform var(--opm-duration) var(--opm-ease), opacity var(--opm-duration) var(--opm-ease);
}
.opm-table__th[aria-sort] .opm-table__sort-arrow { opacity: 1; }
.opm-table__th[aria-sort="ascending"] .opm-table__sort-arrow { transform: rotate(180deg); }

.opm-table__row { border-bottom: 1px solid #AFAFAF; }

.opm-table__cell {
  padding: var(--opm-space-3);
  font-size: var(--opm-fs-xs);
  vertical-align: middle;
}
.opm-table__cell sup { font-size: .65em; }
.opm-table__value {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}
.opm-table__value sup {
  line-height: 0;
}

.opm-table__cell--name {
  font-weight: var(--opm-fw-bold);
  font-size: var(--opm-fs-md);
  text-transform: uppercase;
  white-space: nowrap;
}
.opm-table__mobile-status { display: none; }

.opm-table__cell--price .opm-price { font-size: var(--opm-fs-sm); }
.opm-table__cell--price .opm-price__old { color: var(--opm-color-ink-muted); font-weight: var(--opm-fw-regular); }
.opm-table__cell--price .opm-promo-label {
  margin-bottom: var(--opm-space-1);
  background: var(--opm-color-accent, var(--opm-color-default));
  color: var(--opm-color-on-accent);
}

.opm-table__cell--status .opm-status__dot { width: var(--opm-status-dot); height: var(--opm-status-dot); }

.opm-table__cell--actions {
  position: relative;
  display: table-cell;
  text-align: right;
  white-space: nowrap;
  border-left: 0;
  padding-left: 28px;
}
.opm-table__cell--actions::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 0;
  width: 1px;
  background: #AFAFAF;
  pointer-events: none;
}
.opm-table__see {
  appearance: none;
  -webkit-appearance: none;
  min-width: 90px;
  height: 38px;
  padding: 0 16px;
  margin-right: var(--opm-space-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #000;
  border: 1px solid #000;
  border-radius: 0;
  box-shadow: none;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  transition:
    background var(--opm-duration) var(--opm-ease),
    color var(--opm-duration) var(--opm-ease),
    border-color var(--opm-duration) var(--opm-ease);
}
.opm-table__see:hover,
.opm-table__see:focus-visible {
  background: #000;
  color: #fff;
  border-color: #000;
  outline: none;
  box-shadow: none;
}
.opm-table__see:focus,
.opm-table__see:active {
  outline: none;
  box-shadow: none;
}
.opm-table__cell--actions .opm-iconbtn,
.opm-table__cell--actions .opm-compare {
  vertical-align: middle;
}
.opm-table__cell--actions .opm-iconbtn {
  margin-right: 18px;
}
.opm-table__cell--actions .opm-compare {
  display: inline-flex;
  align-items: center;
  border-left: 0;
  margin-left: 0;
}

.opm-table__empty { padding: var(--opm-space-8); text-align: center; color: var(--opm-color-ink-muted); }

/* ----- Footer ----- */
.opm-table__footer {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--opm-space-3); margin-top: var(--opm-space-6);
}
.opm-table__more { min-width: 126px; }
.opm-table__udev {
  display: inline-flex; align-items: center; gap: var(--opm-space-2);
  border: 1px solid var(--opm-color-border);
  padding: var(--opm-space-2) var(--opm-space-4);
  font-size: var(--opm-fs-2xs); cursor: pointer;
}

/* ----- Responsive: collapse to cards ----- */
@media (max-width: 768px) {
  .opm-table, .opm-table thead, .opm-table tbody, .opm-table tr, .opm-table td, .opm-table th {  }
  .opm-table thead { display: none; }
  .opm-table tr.opm-table__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
    row-gap: 8px;
    padding: var(--opm-space-3) 0;
  }
  .opm-table__cell {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    padding: var(--opm-space-1) 0;
    border: 0;
  }
  .opm-table__cell::before {
    content: attr(data-opm-label);
    font-weight: var(--opm-fw-black);
    font-size: var(--opm-fs-2xs);
    text-transform: uppercase;
    color: #000;
  }
  .opm-table__cell--area,
  .opm-table__cell[data-opm="price-m2"] {
    white-space: nowrap;
  }
  .opm-table__cell--name {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    grid-column: 1 / -1;
  }
  .opm-table__cell--features,
  .opm-table__cell--price,
  .opm-table__cell--actions {
    grid-column: 1 / -1;
  }
  .opm-table__cell--area-usable,
  .opm-table__cell--area-internal {
    grid-column: auto;
  }
  .opm-table__cell--name::before,
  .opm-table__cell--features::before,
  .opm-table__cell--actions::before {
    content: none;
  }
  .opm-table__mobile-status {
    display: inline-flex;
    align-items: center;
    margin-top: 0;
    margin-left: 0;
  }
  .opm-table__mobile-status .opm-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
  }
  .opm-table__cell--status {
    display: none;
  }
  .opm-table__cell--actions { justify-content: flex-end; border-left: 0; padding-left: 0; }
  .opm-table__cell--actions::before { display: none; }
  .opm-table__cell--actions .opm-compare { border-left: 0; }
}

/* Row click opens the modal → make the whole row read as interactive. */
.opm-table__row { cursor: pointer; }
.opm-table__row:hover { background: #f6f6f6; }
