/* Catalyst Client Portal — front-end */
@font-face {
  font-family: "CCP Signature";
  src: url("../fonts/signature.ttf") format("truetype");
  font-display: swap;
}

.ccp-dashboard, .ccp-document-view { font-family: var(--awb-typography4-font-family, inherit); color: #101a2b; }
.ccp-dashboard h2, .ccp-document-view h2, .ccp-document-view h3 { font-family: var(--awb-typography1-font-family, inherit); }

/* ---- shell: every portal screen (dashboard, ticket, document, login) sits
 *  inside this so the plugin's own markup reads as one deliberate app
 *  rather than loose fragments dropped into the page. Left-aligned (not
 *  centered) at a real working width — this is a dashboard, not a poster —
 *  but never so narrow that it strands in a sea of empty page. ---- */
.ccp-shell { max-width: 900px; margin: 0; }

/* ---- persistent contact sidebar, wrapped around every authenticated
 *  portal view (dashboard/ticket/document) in class-shortcode.php's
 *  render() — so a client always has a real person to reach, one click
 *  away, without hunting for it. ---- */
.ccp-withsidebar { display: flex; gap: 24px; max-width: 1180px; margin: 0; align-items: stretch; }
.ccp-withsidebar-main { flex: 1 1 auto; min-width: 0; }
/* .ccp-sidebar stretches to the main column's full height (align-items:
 * stretch above) purely so its sticky child has room to travel — the card
 * itself stays its natural compact height and never shows empty padding.
 * Sticky lives on the CARD, not this wrapper, so it sticks at top:20 and
 * comes to rest exactly flush with the bottom of whatever height the main
 * column ends up being, instead of detaching early against a container
 * that was only ever as tall as the card's own content. */
.ccp-sidebar { flex: 0 0 240px; }
.ccp-sidebar-card { background: #101a2b; color: #d3dbe6; border-radius: 12px; padding: 22px 20px; position: sticky; top: 20px; }
.ccp-sidebar-mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg,#c4622b,#8f3f18); color: #fff; display: grid; place-items: center; font-weight: 700; margin-bottom: 12px; }
.ccp-sidebar-card h3 { margin: 0 0 4px; font-size: 16px; color: #fff !important; font-family: var(--awb-typography1-font-family, inherit) !important; }
.ccp-sidebar-sub { margin: 0 0 14px; font-size: 12.5px; color: #8593a6; }
.ccp-sidebar-name { margin: 0 0 6px; font-weight: 600; color: #fff; font-size: 13.5px; }
.ccp-sidebar-link { display: block; margin: 0 0 6px; font-size: 13.5px; color: #e0a774 !important; text-decoration: none !important; }
.ccp-sidebar-link:hover { text-decoration: underline !important; }
.ccp-sidebar-ext { color: #8593a6; font-size: 11px; }
.ccp-sidebar-note { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid #223354; font-size: 11.5px; color: #6b7890; }

@media (max-width: 760px) {
  .ccp-withsidebar { flex-direction: column; }
  .ccp-sidebar { flex: 0 0 auto; width: 100%; }
  .ccp-sidebar-card { position: static; }
}
.ccp-portal-head { margin: 0 0 28px; }
.ccp-portal-head h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.15; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ccp-portal-sub { margin: 0; font-size: 15px; color: #5b6b7a; max-width: 56ch; }

.ccp-summary-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 28px; }
.ccp-summary-stat { flex: 1 1 140px; background: #fff; border: 1px solid #dce1e0; border-radius: 10px; padding: 14px 16px; }
.ccp-summary-stat b { display: block; font-size: 24px; font-weight: 700; line-height: 1.2; }
.ccp-summary-stat span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #5b6b7a; }

.ccp-card { background: #fff; border: 1px solid #dce1e0; border-radius: 12px; padding: 24px 26px 26px; margin: 0 0 20px; }
.ccp-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 4px; }
.ccp-card-head h2 { margin: 0; font-size: 18px; font-weight: 700; font-family: var(--awb-typography4-font-family, inherit) !important; }
.ccp-card-empty { color: #5b6b7a; font-size: 14px; padding: 6px 0 2px; }

/* ---- dashboard table ---- */
.ccp-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.ccp-table th, .ccp-table td { text-align: left; padding: 14px 12px; border-bottom: 1px solid #eef1f0; font-size: 14px; }
.ccp-table th { font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #5b6b7a; padding-top: 0; }
.ccp-table tr:last-child td { border-bottom: none; }
.ccp-table td .ccp-btn { padding: 8px 16px; font-size: 13px; }

/* ---- contact-info card on the dashboard ---- */
.ccp-kv { width: 100%; border-collapse: collapse; }
.ccp-kv td { padding: 7px 2px; border-bottom: 1px solid #eef1f0; font-size: 14px; text-align: left; vertical-align: top; }
.ccp-kv tr:last-child td { border-bottom: 0; }
.ccp-kv td:first-child { font-weight: 600; width: 110px; color: #5b6b7a; }
.ccp-muted { color: #9aa0a6; }

/* ---- staff-only preview section: same card, a quiet blue accent so it
 *  reads as "this bit is for us", not part of the client-facing content. ---- */
.ccp-admin-metrics { border-color: #2e6fb0; border-width: 1px 1px 1px 4px; }

/* ---- "Updates from your team" — notes a staff member marked visible to
 *  this client, on their Client record's Notes card. ---- */
.ccp-updates { list-style: none; margin: 0; padding: 0; }
.ccp-updates li { padding: 12px 0; border-bottom: 1px solid #eef1f0; }
.ccp-updates li:last-child { border-bottom: 0; }
.ccp-update-body { margin: 0 0 4px; font-size: 14px; line-height: 1.5; }
.ccp-update-date { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #9aa0a6; }

.ccp-status { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.ccp-status-pending { background: rgba(196,98,43,.14); color: #a94f21; }
.ccp-status-signed { background: rgba(63,143,109,.16); color: #2c6b50; }
.ccp-status-open, .ccp-status-in-progress { background: rgba(196,98,43,.14); color: #a94f21; }
.ccp-status-waiting-on-client, .ccp-status-waiting-on-vendor { background: rgba(37,99,196,.14); color: #1d4fa9; }
.ccp-status-resolved, .ccp-status-closed { background: rgba(63,143,109,.16); color: #2c6b50; }

/* ---- support tickets ---- */
.ccp-new-ticket { margin-top: 20px; border-top: 1px solid #eef1f0; padding-top: 18px; }
.ccp-new-ticket summary {
  cursor: pointer; font-weight: 600; color: #101a2b; font-size: 14px; list-style: none;
  display: flex; align-items: center; gap: 8px;
}
.ccp-new-ticket summary::-webkit-details-marker { display: none; }
.ccp-new-ticket summary::before { content: "+"; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 999px; background: #c4622b; color: #fff; font-size: 14px; line-height: 1; flex: none; }
.ccp-new-ticket[open] summary::before { content: "–"; }
.ccp-new-ticket form { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.ccp-new-ticket label, .ccp-ticket-reply label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; color: #46556a; }
.ccp-new-ticket input[type="text"], .ccp-new-ticket select, .ccp-new-ticket textarea, .ccp-ticket-reply textarea {
  font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid #c9d0cf; border-radius: 6px; background: #fbfcfc; color: #101a2b;
}
.ccp-new-ticket input:focus, .ccp-new-ticket select:focus, .ccp-new-ticket textarea:focus, .ccp-ticket-reply textarea:focus {
  outline: 2px solid #c4622b; outline-offset: 1px; border-color: #c4622b; background: #fff;
}
.ccp-new-ticket input[type="file"] { font-size: 13px; }
.ccp-new-ticket button, .ccp-ticket-reply button { align-self: flex-start; }

.ccp-ticket h2 { display: flex; align-items: center; gap: 10px; }
.ccp-ticket-meta-row { color: #5b6b7a; font-size: 13px; margin: -4px 0 18px; }
.ccp-ticket-thread { margin: 16px 0; display: flex; flex-direction: column; gap: 10px; }
.ccp-ticket-msg { background: #f4f6f5; border-radius: 8px; padding: 14px 16px; }
.ccp-ticket-msg.is-staff { background: rgba(37,99,196,.07); }
.ccp-ticket-meta { margin: 8px 0 0; font-size: 12px; color: #5b6b7a; }
.cgt-attachments { margin: 8px 0 0; }
.cgt-attachment { display: inline-block; margin: 2px 8px 2px 0; font-size: 12px; color: #1d4fa9; text-decoration: none; }
.cgt-attachment:hover { text-decoration: underline; }
.ccp-ticket-reply { display: flex; flex-direction: column; gap: 12px; max-width: 560px; margin-top: 18px; padding-top: 18px; border-top: 1px solid #eef1f0; }

/* ---- buttons ---- */
.ccp-btn {
  display: inline-block; font-family: var(--awb-typography2-font-family, inherit); font-weight: 600;
  font-size: 14px; line-height: 1.2; padding: 11px 22px; border: 1px solid #c4622b;
  background: #c4622b; color: #fff !important; text-decoration: none !important; border-radius: 6px; cursor: pointer;
}
.ccp-btn:hover { background: #a94f21; border-color: #a94f21; }
.ccp-btn:disabled { background: #d9c3b6; border-color: #d9c3b6; cursor: not-allowed; }
.ccp-btn-secondary { background: #fff; color: #101a2b !important; border-color: #c9d0cf; }
.ccp-btn-secondary:hover { background: #f4f6f5; border-color: #101a2b; }

.ccp-document-view > p a, .ccp-dashboard a:not(.ccp-btn) { color: #c4622b; }

.ccp-pdf-frame { width: 100%; height: 68vh; min-height: 460px; border: 1px solid #dce1e0; border-radius: 8px; margin: 14px 0 20px; }

.ccp-signed-notice { padding: 14px 16px; background: rgba(63,143,109,.12); color: #2c6b50; border-radius: 8px; font-size: 14px; }

/* ---- sign panel ---- */
.ccp-sign-panel {
  border: 1px solid #dce1e0; border-radius: 12px; background: #fff;
  padding: 22px 22px 20px; max-width: 640px;
}
.ccp-sign-panel h3 { margin: 0 0 14px; font-size: 18px; }

.ccp-sign-tabs { display: inline-flex; background: #eceeed; border-radius: 8px; padding: 3px; margin-bottom: 16px; }
.ccp-sign-tab {
  border: 0; background: none; cursor: pointer; font-family: var(--awb-typography2-font-family, inherit);
  font-weight: 600; font-size: 13px; color: #5b6b7a; padding: 8px 16px; border-radius: 6px;
}
.ccp-sign-tab.is-active { background: #fff; color: #101a2b; box-shadow: 0 1px 3px rgba(16,26,43,.12); }

.ccp-sign-body label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
#ccp-typed-name {
  width: 100%; max-width: 380px; font-size: 16px; padding: 11px 14px;
  border: 1px solid #c9d0cf; border-radius: 8px; color: #101a2b; background: #f4f6f5;
}
#ccp-typed-name:focus { outline: 2px solid #c4622b; outline-offset: 1px; border-color: #c4622b; }
.ccp-typed-preview {
  margin-top: 12px; min-height: 78px; display: flex; align-items: center;
  padding: 6px 18px; border: 1px solid #dce1e0; border-bottom: 2px solid #101a2b;
  border-radius: 8px 8px 0 0; background: #fff;
  font-family: "CCP Signature", "Segoe Script", "Bradley Hand", cursive;
  font-size: 40px; line-height: 1; color: #101a2b; overflow: hidden; white-space: nowrap;
}
.ccp-typed-preview:empty::after { content: "Your signature"; color: #b8c0bf; font-size: 34px; }
.ccp-sign-hint { font-size: 12px; color: #5b6b7a; margin: 8px 0 0; }

#ccp-signature-pad { border: 1px solid #c9d0cf; border-radius: 8px; touch-action: none; background: #fff; max-width: 100%; }

.ccp-sign-extra { margin-top: 16px; padding-top: 14px; border-top: 1px solid #eceeed; }
#ccp-initials {
  width: 140px; font-size: 16px; padding: 10px 12px; letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid #c9d0cf; border-radius: 8px; color: #101a2b; background: #f4f6f5;
}
#ccp-initials:focus { outline: 2px solid #c4622b; outline-offset: 1px; border-color: #c4622b; }

.ccp-agree { display: flex; align-items: flex-start; gap: 9px; margin: 16px 0; font-size: 13.5px; color: #46556a; line-height: 1.45; }
.ccp-agree input { margin-top: 2px; width: 16px; height: 16px; accent-color: #c4622b; flex: none; }

#ccp-sign-status { font-size: 13px; color: #5b6b7a; margin: 6px 0 0; }

/* ---- portal login ---- */
.ccp-login-shell { max-width: 940px; margin: 0; min-height: 60vh; display: flex; align-items: center; }
.ccp-login-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; width: 100%; border: 1px solid #dce1e0; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 12px 32px rgba(16,26,43,.06); }
@media (max-width: 780px) { .ccp-login-grid { grid-template-columns: 1fr; } }
.ccp-login-pitch { background: #101a2b; color: #fff; padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; }
.ccp-login-pitch .ccp-mark { width: 44px; height: 44px; border-radius: 10px; background: #c4622b; color: #fff !important; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; margin-bottom: 22px; }
.ccp-login-pitch h2 { color: #fff !important; margin: 0 0 12px; font-size: 24px; line-height: 1.25; font-family: var(--awb-typography4-font-family, inherit) !important; }
.ccp-login-pitch p { color: #b7c0cf !important; font-size: 14.5px; line-height: 1.6; margin: 0 0 22px; }
.ccp-login-pitch ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ccp-login-pitch li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: #dfe4ea !important; }
.ccp-login-pitch li::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: #c4622b; flex: none; }
@media (max-width: 780px) { .ccp-login-pitch { padding: 34px 28px; } }

.ccp-login-form-side { padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 780px) { .ccp-login-form-side { padding: 36px 28px; } }
.ccp-login-form-side h2 { margin: 0 0 6px; font-size: 20px; }
.ccp-login-form-side .ccp-login-hint { margin: 0 0 24px; font-size: 13.5px; color: #5b6b7a; }

.ccp-login { max-width: 400px; margin-top: 4px; }
.ccp-login label { display: block; font-weight: 600; font-size: 13px; color: #46556a; margin: 0 0 14px; }
.ccp-login input[type="text"], .ccp-login input[type="password"] {
  display: block; width: 100%; margin-top: 5px; font-size: 16px; padding: 12px 14px;
  border: 1px solid #c9d0cf; border-radius: 8px; background: #f4f6f5; color: #101a2b;
}
.ccp-login input:focus { outline: 2px solid #c4622b; outline-offset: 1px; border-color: #c4622b; }
.ccp-login__remember { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.ccp-login__remember input { width: 16px; height: 16px; accent-color: #c4622b; flex: none; }
.ccp-login__btn { font-size: 16px; padding: 15px 44px; border-radius: 999px; width: 100%; text-align: center; }
.ccp-login__err {
  background: rgba(179,45,46,.10); color: #a12b2c; border: 1px solid rgba(179,45,46,.28);
  border-radius: 8px; padding: 11px 14px; font-size: 14px; margin: 0 0 16px;
}
.ccp-login__lost { margin: 14px 0 0; font-size: 13px; }
.ccp-login__lost a { color: #c4622b; }
.ccp-login.is-failed .ccp-login__btn { animation: ccp-shake .5s cubic-bezier(.36,.07,.19,.97); }
@keyframes ccp-shake {
  10%,90% { transform: translateX(-2px); }
  20%,80% { transform: translateX(4px); }
  30%,50%,70% { transform: translateX(-9px); }
  40%,60% { transform: translateX(9px); }
}
@media (prefers-reduced-motion: reduce) { .ccp-login.is-failed .ccp-login__btn { animation: none; } }
