/* =========================================================================
 * WSB Estate — admin.css
 * Contacts-modal layout (tabledrag table).
 * Admin views (lists/filters/tables) are styled in style.css under
 * .wsb-admin-view scope; do not duplicate that here.
 * jQuery UI Dialog base overrides live in style.css (global library).
 * ========================================================================= */

/* ---- Subtitle strip between titlebar and contacts list ---- */
.wsb-modal-subtitle {
  padding: 8px 24px 10px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

/* ---- Contacts table ---- */
.contacts-table {
  width: 100%;
  border-collapse: collapse;
}

.contacts-table th,
.contacts-table td {
  padding: 10px 12px;
  vertical-align: middle;
  text-align: left;
}

.contacts-table thead th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.contacts-table tbody tr {
  border-bottom: 1px solid var(--border);
}

.contacts-table tbody tr:last-child {
  border-bottom: none;
}

.contacts-table tbody tr:hover {
  background: var(--row-hover);
}

/* Tabledrag handle column — narrow */
.contacts-table td.tabledrag-handle {
  width: 28px;
  padding: 10px 4px;
}

/* ---- Permissions note ---- */
.perm-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.perm-note svg {
  width: 14px;
  height: 14px;
  fill: var(--text-subtle);
  flex: none;
}

/* ---- Modal footer (form actions) ---- */
.wsb-modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* Ensure Gin doesn't collapse button text inside dialog footer */
.wsb-modal-footer button,
.wsb-modal-footer input[type="submit"] {
  white-space: nowrap;
}

/* ---- Hide tabledrag "Show row weights" toggle in contacts modal ---- */
.ui-dialog-content .tabledrag-toggle-weight-wrapper {
  display: none;
}

/* ---- Edge padding: align table content with 24px modal side padding ---- */
.contacts-table thead th:first-child { padding-left: 20px; }
.contacts-table thead th:nth-last-child(2) { padding-right: 24px; }
.contacts-table tbody td.tabledrag-handle { padding-left: 20px; }
.contacts-table tbody td:nth-last-child(2) { padding-right: 24px; }

/* ---- Generic entity field rows (label + value) ---- */
.wsb-field {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border, #dce1e8);
  font-size: 14px;
}
.wsb-field:last-child { border-bottom: none; }
.wsb-field__label {
  font-weight: 600;
  color: var(--text-muted, #5a6474);
  font-size: 13px;
}
.wsb-field__value {
  color: var(--text, #1a1a2e);
}

/* ---- Primary local tasks (section tabs) ---- */
#block-wsb-estate-primary-local-tasks > ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--border, #dce1e8);
}

#block-wsb-estate-primary-local-tasks > ul > li {
  margin: 0 0 -1px;
  padding: 0;
}

#block-wsb-estate-primary-local-tasks > ul > li > a {
  display: block;
  min-height: 38px;
  padding: 9px 13px;
  color: var(--text, #1a1a2e);
  text-decoration: none;
  background: var(--surface-2, #f3f5f8);
  border: 1px solid var(--border, #dce1e8);
  border-bottom-color: var(--border, #dce1e8);
  border-radius: 5px 5px 0 0;
}

#block-wsb-estate-primary-local-tasks > ul > li > a:hover,
#block-wsb-estate-primary-local-tasks > ul > li > a:focus-visible {
  color: var(--link, #174e34);
  background: var(--surface, #fff);
}

#block-wsb-estate-primary-local-tasks > ul > li > a.is-active {
  color: var(--text, #1a1a2e);
  font-weight: 700;
  background: var(--surface, #fff);
  border-bottom-color: var(--surface, #fff);
}

/* The active LPR tab supplies the visible section title. Keep Drupal's H1
 * available to assistive technology without repeating it visually. */
.wsb-lpr-admin-page #block-wsb-estate-page-title {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---- LPR multi-file upload ---- */
#wsb-lpr-import-upload-form .form-managed-file {
  max-width: 560px;
}

#wsb-lpr-import-upload-form .form-managed-file .form-type-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  margin: 8px 0 0;
  padding: 9px 12px;
  background: var(--surface-2, #f3f5f8);
  border: 1px solid var(--border, #dce1e8);
  border-radius: 8px;
}

#wsb-lpr-import-upload-form .form-managed-file .form-checkbox {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand, #1f6b3a);
}

#wsb-lpr-import-upload-form .form-managed-file .form-type-checkbox label.option {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  line-height: 1.35;
}

#wsb-lpr-import-upload-form .form-managed-file [data-drupal-selector="edit-lpr-file-remove-button"] {
  display: flex;
  width: fit-content;
  margin: 10px 0 0 auto;
  color: #b42318;
  background: var(--surface, #fff);
  border-color: #fecdca;
}

#wsb-lpr-import-upload-form .form-managed-file [data-drupal-selector="edit-lpr-file-remove-button"]:hover {
  color: #912018;
  background: #fef3f2;
  border-color: #fda29b;
}
