/**
 * CPN Real Estate v1.6.40 — Stable desktop workspace + premium history table.
 * Author: CProjects Network — https://www.cprojectsnetwork.com
 * Only My Property Hub is affected; no other front-end shortcodes are restyled.
 */

/* The two photo actions are true horizontal icon-and-label buttons, not
 * vertically stacked icon blocks inherited from the active WP theme. */
body.cpn-re-portal-app-page .cpn-re-client-portal .cpn-re-client-photo-actions {
  display:flex;
  flex-wrap:wrap;
  align-items:stretch;
  gap:10px;
}
body.cpn-re-portal-app-page .cpn-re-client-portal .cpn-re-client-photo-actions >
:is(.cpn-re-client-photo-choose,.cpn-re-client-photo-remove) {
  display:inline-flex!important;
  flex-direction:row!important;
  align-items:center!important;
  justify-content:center!important;
  gap:9px!important;
  width:154px!important;
  min-width:154px!important;
  height:46px!important;
  min-height:46px!important;
  padding:0 13px!important;
  line-height:1.15!important;
  text-align:center!important;
  white-space:nowrap;
}
body.cpn-re-portal-app-page .cpn-re-client-portal .cpn-re-client-photo-actions >
:is(.cpn-re-client-photo-choose,.cpn-re-client-photo-remove) > i.bi {
  display:inline-block!important;
  position:static!important;
  flex:0 0 auto;
  width:auto!important;
  height:auto!important;
  font-size:15px!important;
  line-height:1!important;
  vertical-align:middle!important;
  margin:0!important;
  padding:0!important;
  transform:none!important;
}
body.cpn-re-portal-app-page .cpn-re-client-portal .cpn-re-client-photo-actions >
.cpn-re-client-photo-remove[hidden] {display:none!important}

/* Compact mode switch is consistent with the existing premium toolbar. */
body.cpn-re-portal-app-page .cpn-re-history-controls {
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  gap:12px;
  margin:0 0 14px;
}
body.cpn-re-portal-app-page .cpn-re-history-controls p {
  margin:0!important;
  color:#647891!important;
  font-size:12px!important;
  font-weight:600;
}
body.cpn-re-portal-app-page .cpn-re-history-modes {
  display:inline-flex;
  gap:3px;
  padding:4px;
  border:1px solid #dbe5f5;
  background:#eef3fc;
  border-radius:14px;
}
body.cpn-re-portal-app-page .cpn-re-history-modes button {
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:7px;
  min-width:86px;
  min-height:37px;
  padding:7px 12px!important;
  margin:0!important;
  border:0!important;
  border-radius:11px!important;
  background:transparent!important;
  box-shadow:none!important;
  color:#62758e!important;
  font-size:12px!important;
  font-weight:750!important;
  cursor:pointer;
}
body.cpn-re-portal-app-page .cpn-re-history-modes button.is-active {
  background:#fff!important;
  color:#245eee!important;
  box-shadow:0 3px 12px rgba(37,99,235,.1)!important;
}
body.cpn-re-portal-app-page .cpn-re-history-modes button:focus-visible {
  outline:2px solid #2563eb!important;
  outline-offset:2px;
}
body.cpn-re-portal-app-page [data-cpn-history-grid][hidden],
body.cpn-re-portal-app-page [data-cpn-history-table][hidden] {display:none!important}

/* Table data is already permission-filtered by the portal's server-side
 * published-property checks. The scroll container prevents viewport overflow. */
body.cpn-re-portal-app-page .cpn-re-client-history-table-wrap {
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overflow-y:visible;
  border:1px solid #e0e8f5;
  border-radius:16px;
  background:#fff;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
}
body.cpn-re-portal-app-page .cpn-re-client-history-table {
  width:100%;
  min-width:780px;
  border-collapse:separate;
  border-spacing:0;
  font-size:12px;
  color:#203454;
  text-align:left;
}
body.cpn-re-portal-app-page .cpn-re-client-history-table th {
  position:sticky;
  top:0;
  z-index:1;
  padding:14px 13px;
  border-bottom:1px solid #dbe6f4;
  background:#eff5ff;
  color:#385372;
  font-size:11px;
  font-weight:800;
  white-space:nowrap;
}
body.cpn-re-portal-app-page .cpn-re-client-history-table td {
  padding:11px 13px;
  border-bottom:1px solid #e8eff8;
  vertical-align:middle;
  background:#fff;
  white-space:nowrap;
  font-weight:650;
}
body.cpn-re-portal-app-page .cpn-re-client-history-table tbody tr:nth-child(even) td {background:#f8fbff}
body.cpn-re-portal-app-page .cpn-re-client-history-table tbody tr:last-child td {border-bottom:0}
body.cpn-re-portal-app-page .cpn-re-client-history-table tbody tr:hover td {background:#f0f6ff}
body.cpn-re-portal-app-page .cpn-re-history-title {
  display:flex;
  align-items:center;
  gap:11px;
  width:min(270px,30vw);
  min-width:190px;
  text-decoration:none!important;
  color:#172a47!important;
  line-height:1.35;
  white-space:normal;
  font-weight:750;
}
body.cpn-re-portal-app-page .cpn-re-history-title img {
  width:57px;
  height:47px;
  border-radius:10px;
  object-fit:cover;
  flex:0 0 57px;
}
body.cpn-re-portal-app-page .cpn-re-history-price {color:#173358;font-weight:800!important}
body.cpn-re-portal-app-page .cpn-re-history-actions {display:inline-flex;align-items:center;gap:5px}
body.cpn-re-portal-app-page .cpn-re-history-open {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:37px;
  height:37px;
  border:1px solid #dfe9f7;
  border-radius:10px;
  background:#f0f5ff;
  color:#2563eb!important;
  text-decoration:none!important;
  cursor:pointer;
  padding:0!important;
  margin:0!important;
  box-shadow:none!important;
}
body.cpn-re-portal-app-page .cpn-re-history-open[aria-pressed="true"] {color:#df3971!important;background:#ffe7ef!important}
body.cpn-re-portal-app-page .cpn-re-history-open:focus-visible,
body.cpn-re-portal-app-page .cpn-re-history-title:focus-visible {outline:2px solid #2563eb;outline-offset:2px}

/* In full desktop mode, reserve the available viewport *for the portal*, not
 * for the document. All long forms/tables stay inside the internal scroller.
 * This removes the clipping of the whole profile card on shorter monitors. */
@media (min-width:1024px) {
  body.cpn-re-portal-app-page.logged-in .cpn-re-portal-main {
    height:100vh!important;
    height:100dvh!important;
    min-height:0!important;
    max-height:100dvh!important;
    padding:clamp(14px,2.3vh,28px) clamp(18px,3vw,52px)!important;
    overflow:hidden!important;
    justify-content:center!important;
  }
  body.cpn-re-portal-app-page.logged-in .cpn-re-portal-main .cpn-re-client-portal:not(.cpn-re-auth-page) {
    display:flex!important;
    flex-direction:column!important;
    flex:1 1 auto;
    width:100%!important;
    height:100%!important;
    max-height:100%!important;
    min-height:0!important;
    margin:0 auto!important;
    overflow:hidden!important;
  }
  body.cpn-re-portal-app-page .cpn-re-client-portal:not(.cpn-re-auth-page) >
  :is(.cpn-re-client-header,.cpn-re-client-welcome,.cpn-re-client-tabs) {
    flex:0 0 auto!important;
  }
  body.cpn-re-portal-app-page .cpn-re-client-portal:not(.cpn-re-auth-page) > .cpn-re-client-content {
    flex:1 1 0!important;
    height:0!important;
    min-height:0!important;
    max-height:none!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior:contain;
    scrollbar-width:thin;
    -webkit-overflow-scrolling:touch;
  }
  body.cpn-re-portal-app-page .cpn-re-client-portal:not(.cpn-re-auth-page) > .cpn-re-client-content > * {
    max-width:100%;
  }
}
@media (max-width:600px) {
  body.cpn-re-portal-app-page .cpn-re-client-portal .cpn-re-client-photo-actions {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%;
  }
  body.cpn-re-portal-app-page .cpn-re-client-portal .cpn-re-client-photo-actions >
  :is(.cpn-re-client-photo-choose,.cpn-re-client-photo-remove) {
    width:100%!important;
    min-width:0!important;
  }
  body.cpn-re-portal-app-page .cpn-re-history-controls {gap:10px}
  body.cpn-re-portal-app-page .cpn-re-history-modes {margin-left:auto}
}
@media (prefers-reduced-motion:reduce) {
  body.cpn-re-portal-app-page .cpn-re-history-modes button {transition:none!important}
}
@media (max-width:360px) {
  body.cpn-re-portal-app-page .cpn-re-client-portal .cpn-re-client-photo-actions {
    grid-template-columns:minmax(0,1fr);
  }
}
