/* ==========================================================================
   Extension directory styling
   Shared by the public directory (public/index.php) and the admin extension
   tables (admin/includes/extensions_table.php). Sits on top of DashForge.
   ========================================================================== */

:root {
  --dir-primary: #0168fa;
  --dir-primary-soft: #e8f1ff;
  --dir-ink: #001737;
  --dir-text: #1b2e4b;
  --dir-muted: #8392a5;
  --dir-border: rgba(72, 94, 144, 0.16);
  --dir-bg: #f4f6fa;
  --dir-card: #ffffff;
  --dir-radius: 10px;
  --dir-shadow: 0 1px 2px rgba(28, 39, 60, 0.04), 0 6px 24px -12px rgba(28, 39, 60, 0.18);

  /* Site (category) colours */
  --site-avenues: #0168fa;
  --site-avenues-bg: #e8f1ff;
  --site-st-clements: #0f9d78;
  --site-st-clements-bg: #e3f7f0;
  --site-lab: #7d3ff2;
  --site-lab-bg: #f0e9ff;
}

/* --------------------------------------------------------------------------
   Shared table treatment (public + admin)
   -------------------------------------------------------------------------- */
.ext-table {
  width: 100%;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--dir-text);
}
.ext-table thead th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dir-muted);
  background: #f8f9fc;
  border-top: 0;
  border-bottom: 1px solid var(--dir-border);
  white-space: nowrap;
}
.ext-table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  border-top: 1px solid var(--dir-border);
  font-size: 14px;
}
.ext-table tbody tr:first-child td { border-top: 0; }
.ext-table.table-hover tbody tr:hover,
.ext-table tbody tr:hover { background-color: #f7f9fd; }

.ext-table .ext-col-number { width: 1%; white-space: nowrap; }
.ext-table .ext-col-actions { width: 1%; white-space: nowrap; text-align: right; }
.ext-table td.ext-cell-actions { text-align: right; }

.ext-name {
  font-weight: 600;
  color: var(--dir-ink);
}
.ext-dept { color: var(--dir-text); }

/* Extension number chip */
.ext-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--dir-primary-soft);
  color: var(--dir-primary);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Site / category badge */
.site-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--dir-text);
  background: #eef1f6;
}
.site-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.site-badge.site-avenues     { color: var(--site-avenues);     background: var(--site-avenues-bg); }
.site-badge.site-st_clements { color: var(--site-st-clements); background: var(--site-st-clements-bg); }
.site-badge.site-lab         { color: var(--site-lab);         background: var(--site-lab-bg); }

/* Row action buttons (admin) */
.ext-actions {
  display: inline-flex;
  gap: 6px;
}
.ext-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--dir-border);
  background: #fff;
  color: var(--dir-muted);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.ext-action svg { width: 15px; height: 15px; }
.ext-action:hover, .ext-action:focus {
  outline: none;
  text-decoration: none;
}
.ext-action-edit:hover, .ext-action-edit:focus {
  color: var(--dir-primary);
  border-color: var(--dir-primary);
  background: var(--dir-primary-soft);
}
.ext-action-delete:hover, .ext-action-delete:focus {
  color: #dc3545;
  border-color: #dc3545;
  background: #fdecee;
}

/* DataTables sort indicators inside the shared table (replaces the DashForge/Ionicons glyphs) */
table.ext-table.dataTable thead .sorting,
table.ext-table.dataTable thead .sorting_asc,
table.ext-table.dataTable thead .sorting_desc {
  background-image: none;
  background-color: #f8f9fc;
  padding-right: 28px;
  position: relative;
  cursor: pointer;
}
table.ext-table.dataTable thead .sorting::before,
table.ext-table.dataTable thead .sorting_asc::before,
table.ext-table.dataTable thead .sorting_desc::before { display: none; }
table.ext-table.dataTable thead .sorting::after,
table.ext-table.dataTable thead .sorting_asc::after,
table.ext-table.dataTable thead .sorting_desc::after {
  content: "";
  font-family: inherit;
  position: absolute;
  right: 14px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.35;
  line-height: 1;
}
table.ext-table.dataTable thead .sorting_asc::after  { opacity: 1; color: var(--dir-primary); transform: rotate(-135deg); margin-top: -1px; }
table.ext-table.dataTable thead .sorting_desc::after { opacity: 1; color: var(--dir-primary); }
table.ext-table.dataTable thead .sorting_disabled { cursor: default; }
table.ext-table.dataTable thead .sorting_disabled::after,
table.ext-table.dataTable thead .sorting_disabled::before { display: none; }
table.ext-table.dataTable tbody td.sorting_1 { background-color: transparent; }
table.ext-table.dataTable.no-footer { border-bottom: 0; }

/* Responsive child-row toggle from DataTables */
table.ext-table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before {
  top: 50%;
  margin-top: -8px;
  background-color: var(--dir-primary);
  color: #fff;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Public directory layout
   -------------------------------------------------------------------------- */
.dir-body {
  background: var(--dir-bg);
  color: var(--dir-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Full-width page container with comfortable gutters */
.dir-container {
  width: 100%;
  padding-left: 32px;
  padding-right: 32px;
}
@media (max-width: 991.98px) {
  .dir-container { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 575.98px) {
  .dir-container { padding-left: 16px; padding-right: 16px; }
}

.dir-header {
  background: #fff;
  border-bottom: 1px solid var(--dir-border);
}
.dir-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}
.dir-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--dir-ink);
  text-decoration: none;
}
.dir-brand:hover { color: var(--dir-ink); text-decoration: none; }
.dir-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0168fa 0%, #0c4fbf 100%);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(1, 104, 250, 0.6);
  flex: 0 0 auto;
}
.dir-brand-mark svg { width: 20px; height: 20px; }
.dir-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.dir-brand-text strong { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.dir-brand-text span { font-size: 12px; color: var(--dir-muted); }

.dir-header-actions { display: flex; align-items: center; gap: 8px; }
.dir-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--dir-border);
  background: #fff;
  color: var(--dir-text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.dir-btn svg { width: 15px; height: 15px; }
.dir-btn:hover, .dir-btn:focus {
  background: #f4f6fa;
  border-color: #c5cfdf;
  color: var(--dir-ink);
  text-decoration: none;
  outline: none;
}
.dir-btn-primary {
  background: var(--dir-primary);
  border-color: var(--dir-primary);
  color: #fff;
}
.dir-btn-primary:hover, .dir-btn-primary:focus {
  background: #0157d3;
  border-color: #0157d3;
  color: #fff;
}
@media (max-width: 575.98px) {
  .dir-btn-label { display: none; }
  .dir-btn { padding: 8px 10px; }
}

.dir-main {
  flex: 1 0 auto;
  padding-top: 32px;
  padding-bottom: 48px;
}

/* Hero + search (centred) */
.dir-hero {
  margin: 8px auto 28px;
  max-width: 760px;
  text-align: center;
}
.dir-hero h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--dir-ink);
  margin: 0 0 6px;
}
.dir-hero p {
  margin: 0 auto 20px;
  color: var(--dir-muted);
  font-size: 14px;
  max-width: 560px;
}

.dir-search {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
}
.dir-search > svg {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  color: var(--dir-muted);
  pointer-events: none;
}
.dir-search input {
  width: 100%;
  height: 50px;
  padding: 0 88px 0 46px;
  border: 1px solid var(--dir-border);
  border-radius: var(--dir-radius);
  background: #fff;
  color: var(--dir-ink);
  font-size: 15px;
  box-shadow: var(--dir-shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.dir-search input::placeholder { color: #a5b0c2; }
.dir-search input:focus {
  outline: none;
  border-color: var(--dir-primary);
  box-shadow: 0 0 0 3px rgba(1, 104, 250, 0.15);
}
.dir-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.dir-search-clear {
  position: absolute;
  right: 48px;
  top: 50%;
  margin-top: -14px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--dir-muted);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.dir-search-clear svg { width: 15px; height: 15px; }
.dir-search-clear:hover { background: #eef1f6; color: var(--dir-ink); }
.dir-search.has-value .dir-search-clear { display: inline-flex; }
.dir-search kbd {
  position: absolute;
  right: 14px;
  top: 50%;
  margin-top: -11px;
  height: 22px;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid var(--dir-border);
  background: #f4f6fa;
  color: var(--dir-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
@media (max-width: 575.98px) {
  .dir-search kbd { display: none; }
  .dir-search input { padding-right: 46px; }
  .dir-search-clear { right: 10px; }
}

/* Category filter pills */
.dir-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.dir-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--dir-border);
  background: #fff;
  color: var(--dir-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.dir-filter:hover { border-color: #c5cfdf; background: #fbfcfe; }
.dir-filter:focus { outline: none; box-shadow: 0 0 0 3px rgba(1, 104, 250, 0.15); }
.dir-filter .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dir-muted);
  flex: 0 0 auto;
}
.dir-filter .dot.site-avenues     { background: var(--site-avenues); }
.dir-filter .dot.site-st_clements { background: var(--site-st-clements); }
.dir-filter .dot.site-lab         { background: var(--site-lab); }
.dir-filter .count {
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef1f6;
  color: var(--dir-muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.dir-filter.active {
  background: var(--dir-ink);
  border-color: var(--dir-ink);
  color: #fff;
}
.dir-filter.active .count { background: rgba(255, 255, 255, 0.18); color: #fff; }
.dir-filter.active .dot { background: #fff; }

/* Results card */
.dir-card {
  background: var(--dir-card);
  border: 1px solid var(--dir-border);
  border-radius: var(--dir-radius);
  box-shadow: var(--dir-shadow);
  overflow: hidden;
}
.dir-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--dir-border);
}
.dir-card-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--dir-ink);
}
.dir-card-header .dataTables_info {
  margin: 0;
  padding: 0;
  float: none;
  font-size: 13px;
  color: var(--dir-muted);
  white-space: nowrap;
}
.dir-card .dataTables_wrapper { padding: 0; }
.dir-card .ext-table thead th:first-child,
.dir-card .ext-table tbody td:first-child { padding-left: 20px; }
.dir-card .ext-table thead th:last-child,
.dir-card .ext-table tbody td:last-child { padding-right: 20px; }

@media (max-width: 575.98px) {
  .dir-card .ext-table thead th, .dir-card .ext-table tbody td { padding: 10px 12px; }
  .dir-card .ext-table thead th:first-child, .dir-card .ext-table tbody td:first-child { padding-left: 12px; }
  .dir-card .ext-table thead th:last-child, .dir-card .ext-table tbody td:last-child { padding-right: 12px; }
  .dir-card-header { padding: 12px 16px; }
  .dir-card-footer { padding: 10px 12px; justify-content: center; }
}

/* Empty state */
.dir-card .ext-table td.dataTables_empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--dir-muted);
  font-size: 14px;
}

/* Footer with pagination */
.dir-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--dir-border);
  background: #fbfcfe;
}
.dir-card-footer:empty { display: none; }
.dir-card-footer .dataTables_info {
  float: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
  color: var(--dir-muted);
}
.dir-card-footer .dataTables_paginate {
  float: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 4px;
}
.dir-card-footer .dataTables_paginate .paginate_button {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  margin: 0 !important;
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--dir-text) !important;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.dir-card-footer .dataTables_paginate .paginate_button:hover {
  background: #eef1f6 !important;
  color: var(--dir-ink) !important;
}
.dir-card-footer .dataTables_paginate .paginate_button.current {
  background: var(--dir-primary) !important;
  color: #fff !important;
  font-weight: 600;
}
.dir-card-footer .dataTables_paginate .paginate_button.disabled,
.dir-card-footer .dataTables_paginate .paginate_button.disabled:hover {
  background: transparent !important;
  color: #c0c8d6 !important;
  cursor: default;
}
.dir-card-footer .dataTables_paginate .ellipsis {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  color: var(--dir-muted);
}

/* Page footer */
.dir-footer {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: 12px;
  color: var(--dir-muted);
}
.dir-footer a { color: var(--dir-muted); text-decoration: underline; }
.dir-footer a:hover { color: var(--dir-primary); }

/* Search-term highlighting */
.ext-table mark {
  padding: 0 1px;
  border-radius: 2px;
  background: #fff3bf;
  color: inherit;
}

/* --------------------------------------------------------------------------
   Admin: extension tables inside the DashForge portal
   -------------------------------------------------------------------------- */
.ext-admin-table {
  background: #fff;
  border: 1px solid var(--dir-border);
  border-radius: var(--dir-radius);
  box-shadow: var(--dir-shadow);
  padding: 16px 20px 12px;
}
.ext-admin-table .dataTables_wrapper::after { content: ""; display: table; clear: both; }
.ext-admin-table .dataTables_filter label { margin-bottom: 12px; }
.ext-admin-table .dataTables_filter input {
  height: 38px;
  min-width: 260px;
  padding: 6px 12px 6px 36px;
  border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238392a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 12px center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ext-admin-table .dataTables_filter input:focus {
  outline: none;
  border-color: var(--dir-primary);
  box-shadow: 0 0 0 3px rgba(1, 104, 250, 0.15);
}
.ext-admin-table .dataTables_length label { margin-bottom: 12px; color: var(--dir-muted); font-size: 13px; }
.ext-admin-table .dataTables_length .select2-container--default .select2-selection--single { height: 38px; border-radius: 8px; }
.ext-admin-table .dataTables_length .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 36px; }
.ext-admin-table .dataTables_length .select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }
.ext-admin-table table.ext-table {
  margin: 4px -20px 0;
  width: calc(100% + 40px) !important;
}
.ext-admin-table table.ext-table thead th:first-child,
.ext-admin-table table.ext-table tbody td:first-child { padding-left: 20px; }
.ext-admin-table table.ext-table thead th:last-child,
.ext-admin-table table.ext-table tbody td:last-child { padding-right: 20px; }
.ext-admin-table table.ext-table tbody tr:last-child td { border-bottom: 1px solid var(--dir-border); }
.ext-admin-table .dataTables_info { margin-top: 14px; padding: 6px 0; font-size: 13px; color: var(--dir-muted); }
.ext-admin-table .dataTables_paginate { margin-top: 14px; display: flex; gap: 4px; }
.ext-admin-table .dataTables_paginate .paginate_button {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  margin: 0 !important;
  border-radius: 6px;
  background: transparent;
  color: var(--dir-text) !important;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ext-admin-table .dataTables_paginate .paginate_button:hover { background: #eef1f6; }
.ext-admin-table .dataTables_paginate .paginate_button.current,
.ext-admin-table .dataTables_paginate .paginate_button.current:hover { background: var(--dir-primary); color: #fff !important; font-weight: 600; }
.ext-admin-table .dataTables_paginate .paginate_button.disabled,
.ext-admin-table .dataTables_paginate .paginate_button.disabled:hover { background: transparent; color: #c0c8d6 !important; }

.ext-modal .modal-content { border: 0; border-radius: 12px; box-shadow: 0 24px 64px -24px rgba(28, 39, 60, 0.45); }
.ext-modal .modal-header { align-items: flex-start; padding: 18px 24px 14px; }
.ext-modal .modal-title { font-size: 16px; font-weight: 600; color: var(--dir-ink); }
.ext-modal-subtitle { margin: 6px 0 0; font-size: 13px; color: var(--dir-muted); display: flex; align-items: center; gap: 8px; }
.ext-modal-subtitle .ext-number { min-width: 0; padding: 1px 8px; font-size: 12px; }
.ext-modal .modal-body { padding: 20px 24px 8px; }
.ext-modal .modal-body label { font-size: 12px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--dir-muted); margin-bottom: 6px; }
.ext-modal .form-control, .ext-modal .custom-select { height: 40px; border-radius: 8px; }
.ext-modal .form-control:focus, .ext-modal .custom-select:focus { border-color: var(--dir-primary); box-shadow: 0 0 0 3px rgba(1, 104, 250, 0.15); }
.ext-modal .modal-footer { padding: 14px 24px 20px; border-top: 0; }
.ext-modal .modal-footer .btn { border-radius: 8px; padding: 8px 16px; }

/* --------------------------------------------------------------------------
   Print: clean list of every extension
   -------------------------------------------------------------------------- */
@media print {
  .dir-body { background: #fff; }
  .dir-header-actions,
  .dir-search,
  .dir-filters,
  .dir-hero p,
  .dir-card-footer,
  .dir-footer { display: none !important; }
  .dir-main { padding-top: 12px; }
  .dir-hero h1 { font-size: 18px; }
  .dir-card { border: 0; box-shadow: none; border-radius: 0; }
  .ext-table thead th, .ext-table tbody td { padding: 6px 8px; font-size: 12px; }
  .ext-number { background: none; padding: 0; color: #000; }
  .site-badge { background: none; padding: 0; color: #000; }
  .site-badge::before { display: none; }
}
