/* =========================
   HubDB Table Module (Responsive)
   Requirements:
   - Mobile padding: 10px all sides
   - Smaller fonts on mobile so table fits
   - Dynamic scaling by screen size
========================= */

.hubdb-table-wrap {
  width: 100%;
  max-width: 1375px;
  margin: 0 auto;

  /* Desktop-ish default padding; mobile overridden below */
  padding: 30px 0;

  /* Inherit site font but control size inside module */
  font-family: inherit;

  /* Dynamic base font size: scales with viewport */
  font-size: clamp(14px, 1.2vw + 10px, 20px);
}

/* Controls (search + filters) */
.hubdb-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .hubdb-controls {
    grid-template-columns: 1.2fr 0.8fr 0.8fr;
    align-items: end;
  }
}

.hubdb-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Labels scale slightly with module font */
.hubdb-label {
  font-size: 0.8em;
  font-weight: 600;
}

.hubdb-input,
.hubdb-select {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 10px;

  /* Slightly tighter than your original; scales with module font */
  padding: 0.6em 0.75em;
  font-size: 0.9em;

  background: #fff;
}

/* Table wrapper */
.hubdb-table-responsive {
  width: 100%;
  overflow-x: auto; /* still enabled as a safety valve */
  border: 1px solid #eaecf0;
  border-radius: 14px;
}

/* Table */
.hubdb-table {
  width: 100%;
  border-collapse: collapse;

  /* IMPORTANT: remove the hard min-width so it can fit on mobile */
  min-width: 0;

  /* Helps prevent weird overflow on small screens */
  table-layout: fixed;
}

.hubdb-table thead th {
  text-align: left;
  font-weight: 700;

  /* Dynamic header font size */
  font-size: clamp(12px, 0.6vw + 10px, 15px);

  /* Dynamic padding (shrinks on mobile) */
  padding: clamp(8px, 0.8vw + 6px, 12px) clamp(8px, 1vw + 6px, 14px);

  background: #f9fafb;
  border-bottom: 1px solid #eaecf0;
  user-select: none;

  /* Helps fit headings on one screen */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hubdb-table tbody td {
  /* Dynamic body font size */
  font-size: clamp(12px, 0.7vw + 10px, 16px);

  /* Dynamic padding (shrinks on mobile) */
  padding: clamp(8px, 0.8vw + 6px, 12px) clamp(8px, 1vw + 6px, 14px);

  border-bottom: 1px solid #f2f4f7;

  /* Helps content fit; ellipsis long device names instead of forcing width */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hubdb-table tbody tr:hover td {
  background: #fcfcfd;
}

.hubdb-meta {
  margin-top: 10px;
  font-size: 0.8em;
  color: #667085;
}

/* Sorting affordance */
.hubdb-table thead th[data-sort-key] {
  cursor: pointer;
}

.hubdb-table thead th[data-sort-key]::after {
  content: " ↕";
  opacity: 0.45;
  font-weight: 700;
}

/* =========================
   MOBILE REQUIREMENTS
   - 10px padding all sides
   - Smaller fonts so it fits
========================= */

@media (max-width: 1399px) {
  .hubdb-table-wrap {
    padding: 24px;
  }
}

@media (max-width: 1199px) {
  .hubdb-table-wrap {
    padding: 12px;
  }
}

  /* Make controls more compact on mobile */
  .hubdb-controls {
    gap: 10px;
    margin-bottom: 12px;
  }

  .hubdb-input,
  .hubdb-select {
    padding: 0.55em 0.65em;
    font-size: 0.85em;
  }
}

