/**
 * Landlords Listing Page — landlords-page.css
 * CSS prefix: pd-lo-*
 * Design: matches contracts-page + units-page visual identity
 * Color: #2e8b57 green, #0f3460 dark blue, #dc2626 red risk
 */

/* ── Wrap ──────────────────────────────────────────────────────────────────── */
.pd-lo-wrap { font-family: inherit; }

/* ── Sub-header ────────────────────────────────────────────────────────────── */
.pd-lo-subhdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0 12px; flex-wrap: wrap; gap: 8px;
}
.pd-lo-subhdr__meta { font-size: 13px; color: #6b7280; }
.pd-lo-subhdr__actions { display: flex; gap: 8px; align-items: center; }

/* ── Export buttons — matching units-page pattern ──────────────────────────── */
.pd-lo-btn-csv {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; background: #f0faf4; color: #166534 !important;
  border: 1px solid #bbf7d0; border-radius: 5px; font-size: 12px; font-weight: 500;
  text-decoration: none !important; white-space: nowrap; transition: background .15s;
}
.pd-lo-btn-csv:hover { background: #dcfce7; border-color: #86efac; }
.pd-lo-btn-pdf {
  display: inline-flex; align-items: center; gap: 6px;
  background: #2e8b57; color: #fff !important;
  padding: 7px 16px; border-radius: 6px; font-size: 13px; font-weight: 500;
  text-decoration: none !important; white-space: nowrap; transition: background .15s;
}
.pd-lo-btn-pdf:hover { background: #267a4c; color: #fff !important; }
/* Portal Access — a NAVIGATION link, not an export. Neutral border + brand
   text keeps it quiet next to the green export family, and stops three solid
   buttons from flattening the hierarchy. */
.pd-lo-btn-portal {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; background: #fff; color: #1a5c38 !important;
  border: 1px solid #d1d5db; border-radius: 5px; font-size: 12px; font-weight: 600;
  text-decoration: none !important; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.pd-lo-btn-portal:hover { background: #f0faf4; border-color: #86efac; }

/* ── KPI strip ─────────────────────────────────────────────────────────────── */
.pd-lo-kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 900px) { .pd-lo-kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .pd-lo-kpi-row { grid-template-columns: 1fr; } }

.pd-lo-kpi-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 14px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.pd-lo-kpi-label { font-size: 10px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 6px; }
.pd-lo-kpi-value { font-size: 26px; font-weight: 800; color: #0f172a; line-height: 1; margin-bottom: 4px; }
.pd-lo-kpi-sub   { font-size: 11px; color: #9ca3af; }

/* ── Intelligence row ──────────────────────────────────────────────────────── */
.pd-lo-intel {
  display: grid; grid-template-columns: 3fr 2fr; gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 768px) { .pd-lo-intel { grid-template-columns: 1fr; } }

.pd-lo-intel__panel {
  background: #fff; border: 1px solid #dee2e6; border-radius: 8px;
  padding: 14px 16px; min-height: 160px;
}
.pd-lo-panel-hdr {
  font-size: 13px; font-weight: 700; color: #0f172a;
  margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid #f1f5f9; padding-bottom: 8px;
}
.pd-lo-panel-hdr__icon { font-size: 14px; }
.pd-lo-panel-hdr__sub  { font-size: 11px; font-weight: 400; color: #9ca3af; margin-left: 2px; }

/* At-risk list */
.pd-lo-risk-list { list-style: none; margin: 0; padding: 0; }
.pd-lo-risk-item {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 6px 0; border-bottom: 1px solid #f1f5f9; font-size: 12px;
}
.pd-lo-risk-item:last-child { border-bottom: none; }
.pd-lo-risk-icon { font-size: 12px; flex-shrink: 0; }
.pd-lo-risk-name { font-size: 12px; font-weight: 700; color: #0f3460; text-decoration: none; }
.pd-lo-risk-name:hover { text-decoration: underline; }
.pd-lo-risk-sep  { font-size: 11px; color: #d1d5db; flex-shrink: 0; }
.pd-lo-risk-meta { font-size: 11px; font-weight: 600; color: #dc2626; }

.pd-lo-pulse-empty { font-size: 12px; color: #6b7280; padding: 16px 0; font-style: italic; }
.pd-lo-panel-footer { margin-top: 10px; padding-top: 8px; border-top: 1px solid #f1f5f9; }
.pd-lo-view-all { font-size: 12px; color: #2e8b57; text-decoration: none; font-weight: 600; }
.pd-lo-view-all:hover { text-decoration: underline; }

/* Portfolio health grid */
.pd-lo-health-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 4px;
}
.pd-lo-health-stat {
  background: #f8fafc; border-radius: 6px; padding: 10px 12px;
  border: 1px solid #e5e7eb;
}
.pd-lo-health-val   { font-size: 22px; font-weight: 800; color: #0f172a; line-height: 1; margin-bottom: 2px; }
.pd-lo-health-label { font-size: 10px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .06em; }
.pd-lo-health-sub   { font-size: 10px; color: #9ca3af; margin-top: 2px; }

/* ── Main panel ────────────────────────────────────────────────────────────── */
.pd-lo-main {
  background: #fff; border: 1px solid #dee2e6; border-radius: 6px; overflow: hidden;
}

/* ── Filter bar ────────────────────────────────────────────────────────────── */
.pd-lo-filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 12px 14px; background: #f8fafc; border-bottom: 1px solid #e5e7eb;
}
.pd-lo-fg { display: flex; flex-direction: column; gap: 3px; }
.pd-lo-filter-label { font-size: 11px; color: #6b7280; font-weight: 500; }
.pd-lo-fg--reset { justify-content: flex-end; }

.pd-lo-search-wrap { position: relative; }
.pd-lo-search {
  padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 5px;
  font-size: 13px; width: 220px; outline: none; background: #fff;
  transition: border-color .15s;
}
.pd-lo-search:focus { border-color: #2e8b57; box-shadow: 0 0 0 2px rgba(46,139,87,.12); }

.pd-lo-fsel {
  padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 5px;
  font-size: 13px; background: #fff; outline: none; cursor: pointer;
  transition: border-color .15s; min-width: 130px;
}
.pd-lo-fsel:focus { border-color: #2e8b57; }

.pd-lo-reset-btn {
  padding: 7px 14px; border-radius: 5px; font-size: 13px;
  font-weight: 500; cursor: pointer; border: 1px solid #d1d5db;
  background: #fff; color: #374151; white-space: nowrap; align-self: flex-end;
  transition: background .15s;
}
.pd-lo-reset-btn:hover { background: #f3f4f6; }

/* ── Autocomplete ──────────────────────────────────────────────────────────── */
.pd-lo-ac-list {
  position: absolute; top: calc(100% + 2px); left: 0; width: 100%;
  background: #fff; border: 1px solid #d1d5db; border-radius: 5px;
  list-style: none; margin: 0; padding: 4px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.1); z-index: 200;
  display: none; max-height: 220px; overflow-y: auto;
}
.pd-lo-ac-list.pd-lo-ac-open { display: block; }
.pd-lo-ac-item {
  padding: 7px 12px; font-size: 13px; cursor: pointer; color: #374151;
}
.pd-lo-ac-item:hover { background: #f0f9f3; color: #2e8b57; }

/* ── Filter chips ──────────────────────────────────────────────────────────── */
.pd-lo-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px 14px; min-height: 0;
}
.pd-lo-chips:empty { padding: 0; }
.pd-lo-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #f0f9f3; border: 1px solid #a7f3d0; border-radius: 20px;
  padding: 3px 10px; font-size: 12px; color: #166534;
}
.pd-lo-chip-remove {
  background: none; border: none; cursor: pointer;
  color: #166534; font-size: 13px; padding: 0 0 0 2px; line-height: 1;
}
.pd-lo-chip-remove:hover { color: #dc2626; }

/* ── Table ─────────────────────────────────────────────────────────────────── */
.pd-lo-tbl-wrap { overflow-x: auto; position: relative; }
.pd-lo-tbl-wrap.pd-lo-loading::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%232e8b57' stroke-width='3' fill='none' stroke-dasharray='31.4' stroke-dashoffset='10'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='.8s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E") center no-repeat;
  z-index: 10; border-radius: 0 0 6px 6px;
}

.pd-lo-tbl { width: 100%; border-collapse: collapse; }

.pd-lo-th {
  padding: 9px 12px; font-size: 11px; font-weight: 700; color: #fff;
  background: #2e8b57; text-transform: uppercase; letter-spacing: .05em;
  text-align: left; white-space: nowrap; cursor: pointer; user-select: none;
  border-right: 1px solid rgba(255,255,255,.15);
}
.pd-lo-th:last-child { border-right: none; cursor: default; }
.pd-lo-sort-arrow { opacity: .4; margin-left: 4px; font-size: 10px; }
.pd-lo-th--asc  .pd-lo-sort-arrow::before { content: '↑'; }
.pd-lo-th--desc .pd-lo-sort-arrow::before { content: '↓'; }
.pd-lo-th--asc  .pd-lo-sort-arrow,
.pd-lo-th--desc .pd-lo-sort-arrow { opacity: 1; }

/* Zebra rows */
.pd-lo-tbl tbody tr:nth-child(odd)  td { background: #ffffff !important; }
.pd-lo-tbl tbody tr:nth-child(even) td { background: #f0f9f3 !important; }

/* Row left-border risk overlay */
.pd-lo-tr { cursor: pointer; transition: background .1s; }
.pd-lo-tr:hover td { background: #e6f7ed !important; }
.pd-lo-tr--high   td:first-child { border-left: 3px solid #dc2626; }
.pd-lo-tr--medium td:first-child { border-left: 3px solid #f59e0b; }
.pd-lo-tr--healthy td:first-child { border-left: 3px solid #86efac; }

.pd-lo-td {
  padding: 9px 12px; font-size: 13px; color: #374151;
  border-bottom: 1px solid #e2e8f0; vertical-align: middle;
}
.pd-lo-td--num { text-align: left; font-variant-numeric: tabular-nums; }

.pd-lo-name-link { color: #0f3460; font-weight: 600; text-decoration: none; }
.pd-lo-name-link:hover { text-decoration: underline; }

/* Status pill */
.pd-lo-pill {
  display: inline-block; padding: 2px 9px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.pd-lo-pill--active   { background: #dcfce7; color: #166534; }
.pd-lo-pill--inactive { background: #f3f4f6; color: #6b7280; }

/* Risk badge */
.pd-lo-risk { font-size: 11px; font-weight: 600; white-space: nowrap; }
.pd-lo-risk--high    { color: #dc2626; }
.pd-lo-risk--medium  { color: #d97706; }
.pd-lo-risk--healthy { color: #2e8b57; }

/* Vacant badge */
.pd-lo-vacant-badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  background: #fee2e2; color: #991b1b; border-radius: 8px; padding: 1px 6px;
  margin-left: 4px;
}

/* Problem cheque count */
.pd-lo-problem-chq {
  display: inline-block; font-size: 12px; font-weight: 700;
  color: #dc2626; background: #fee2e2; border-radius: 8px; padding: 1px 8px;
}
.pd-lo-none { color: #9ca3af; font-size: 12px; }

/* Empty state */
.pd-lo-empty {
  text-align: center; padding: 32px; color: #9ca3af;
  font-style: italic; font-size: 13px;
}

/* ── Pager ─────────────────────────────────────────────────────────────────── */
.pd-lo-pager {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 10px 12px; border-top: 1px solid #e5e7eb;
}
.pd-lo-pg-btn {
  padding: 5px 10px; border: 1px solid #d1d5db; border-radius: 4px;
  background: #fff; color: #374151; font-size: 12px; cursor: pointer;
  transition: background .12s, color .12s;
}
.pd-lo-pg-btn:hover:not(:disabled) { background: #2e8b57; color: #fff; border-color: #2e8b57; }
.pd-lo-pg-btn:disabled { opacity: .4; cursor: default; }
.pd-lo-pg-btn--active { background: #2e8b57 !important; color: #fff !important; border-color: #2e8b57 !important; font-weight: 700; }
.pd-lo-pager-info { font-size: 11px; color: #9ca3af; margin-left: 8px; }

/* ── Count line ────────────────────────────────────────────────────────────── */
.pd-lo-count { font-size: 12px; color: #94a3b8; padding: 6px 14px 10px; text-align: right; }

/* ── Hide Views output on /landlords ───────────────────────────────────────── */
.path--landlords .view-id-landlors_view { display: none !important; }
.path--landlords .view-id-landlords_view { display: none !important; }
