/* Catalyst client portal — scoped under .client-portal to avoid collisions
   with Frappe's other portal pages (/me, /login, /404). All selectors are
   prefixed so this stylesheet is safe to ship via web_include_css. */

.client-portal {
  max-width: 760px;
  margin: 40px auto;
  padding: 0 16px;
  font-family: var(--font-stack, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  color: var(--text-color, #1f2937);
}

.client-portal-header h1,
.client-portal-detail-header h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 8px;
}

.client-portal-subtitle {
  color: var(--text-muted, #6b7280);
  margin: 0 0 32px;
}

.client-portal-back {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--text-muted, #6b7280);
  text-decoration: none;
  font-size: 14px;
}

.client-portal-back:hover {
  color: var(--text-color, #1f2937);
  text-decoration: underline;
}

/* ── List cards ─────────────────────────────────────────────────────── */

.client-portal-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
}

.client-portal-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.client-portal-card:hover {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.client-portal-card-link {
  display: block;
  padding: 20px;
  text-decoration: none;
  color: inherit;
}

.client-portal-card-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text-color, #1f2937);
}

.client-portal-card-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 0 0 12px;
  font-size: 14px;
}

.client-portal-card-meta dt {
  color: var(--text-muted, #6b7280);
  font-weight: 500;
}

.client-portal-card-meta dd {
  margin: 0;
  color: var(--text-color, #1f2937);
}

.client-portal-card-cta {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  color: var(--primary, #2563eb);
}

/* ── Empty state ────────────────────────────────────────────────────── */

.client-portal-empty {
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--border-color, #e5e7eb);
  border-radius: 8px;
  background: var(--card-bg, #fff);
}

.client-portal-empty p {
  margin: 0;
}

.client-portal-empty p + p {
  margin-top: 8px;
}

.client-portal-empty-detail {
  color: var(--text-muted, #6b7280);
  font-size: 14px;
}

/* ── Detail page ────────────────────────────────────────────────────── */

.client-portal-section {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

.client-portal-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.client-portal-fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 12px 24px;
  margin: 0;
}

.client-portal-fields dt {
  color: var(--text-muted, #6b7280);
  font-weight: 500;
  font-size: 14px;
  padding-top: 2px;
}

.client-portal-fields dd {
  margin: 0;
  color: var(--text-color, #1f2937);
  font-size: 15px;
  line-height: 1.5;
}

/* ── Feedback callout ───────────────────────────────────────────────── */

.client-portal-feedback-callout {
  background: #fff7ed;
  border-left: 4px solid #f97316;
  padding: 16px 20px;
  border-radius: 4px;
  margin-bottom: 24px;
}

.client-portal-feedback-callout strong {
  display: block;
  margin-bottom: 8px;
  color: #9a3412;
  font-size: 14px;
}

.client-portal-feedback-callout p {
  margin: 0;
  color: #7c2d12;
  font-size: 15px;
}

/* ── Actions ────────────────────────────────────────────────────────── */

.client-portal-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color, #e5e7eb);
}

.client-portal-btn {
  border: 0;
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.client-portal-btn:disabled,
.client-portal-btn.is-loading {
  opacity: 0.6;
  cursor: wait;
}

.client-portal-btn-primary {
  background: var(--primary, #2563eb);
  color: #fff;
}

.client-portal-btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.client-portal-btn-secondary {
  background: #f3f4f6;
  color: var(--text-color, #1f2937);
}

.client-portal-btn-secondary:hover:not(:disabled) {
  background: #e5e7eb;
}

/* ── Request Changes modal ──────────────────────────────────────────── */

.client-portal-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.client-portal-modal {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  margin: 16px;
}

.client-portal-modal h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px;
}

.client-portal-modal-help {
  color: var(--text-muted, #6b7280);
  font-size: 14px;
  margin: 0 0 16px;
}

.client-portal-modal textarea {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  resize: vertical;
  font-family: inherit;
}

.client-portal-modal textarea:focus {
  outline: 0;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.client-portal-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ── Tab nav ────────────────────────────────────────────────────────── */

.client-portal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.client-portal-tab {
  display: inline-block;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text-muted, #6b7280);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.client-portal-tab:hover {
  color: var(--text-color, #1f2937);
}

.client-portal-tab.is-active {
  color: var(--primary, #2563eb);
  border-bottom-color: var(--primary, #2563eb);
}

/* ── List page with CTA in header (Project Requests) ─────────────── */

.client-portal-header-with-cta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 32px;
}

.client-portal-header-with-cta h1 {
  margin-bottom: 4px;
}

.client-portal-header-with-cta .client-portal-subtitle {
  margin: 0;
}

.client-portal-header-with-cta a.client-portal-btn {
  text-decoration: none;
  white-space: nowrap;
}

/* ── Pills (status, request workflow) ───────────────────────────────── */

.client-portal-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  background: #f3f4f6;
  color: #374151;
}

.client-portal-pill-blue   { background: #dbeafe; color: #1e40af; }
.client-portal-pill-green  { background: #d1fae5; color: #065f46; }
.client-portal-pill-orange { background: #fed7aa; color: #9a3412; }
.client-portal-pill-red    { background: #fee2e2; color: #991b1b; }
.client-portal-pill-yellow { background: #fef3c7; color: #854d0e; }
.client-portal-pill-purple { background: #e9d5ff; color: #6b21a8; }
.client-portal-pill-gray   { background: #f3f4f6; color: #4b5563; }

/* Request status pills (mapped from status name via | lower | replace) */
.client-portal-pill-new                 { background: #dbeafe; color: #1e40af; }
.client-portal-pill-under-review        { background: #fef3c7; color: #854d0e; }
.client-portal-pill-more-info-needed    { background: #fed7aa; color: #9a3412; }
.client-portal-pill-approved            { background: #d1fae5; color: #065f46; }
.client-portal-pill-rejected            { background: #fee2e2; color: #991b1b; }
.client-portal-pill-converted           { background: #e9d5ff; color: #6b21a8; }

/* ── Form (New Project Request) ─────────────────────────────────────── */

.client-portal-form {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  padding: 24px;
}

.client-portal-form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-color, #1f2937);
  margin: 0 0 6px;
}

.client-portal-form-label:not(:first-of-type) {
  margin-top: 16px;
}

.client-portal-required {
  color: #dc2626;
}

.client-portal-form input[type="text"],
.client-portal-form input[type="email"],
.client-portal-form input[type="tel"],
.client-portal-form input[type="date"],
.client-portal-form textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  font-family: inherit;
  box-sizing: border-box;
}

.client-portal-form input[type="text"]:focus,
.client-portal-form input[type="email"]:focus,
.client-portal-form input[type="tel"]:focus,
.client-portal-form input[type="date"]:focus,
.client-portal-form textarea:focus {
  outline: 0;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.client-portal-form textarea {
  resize: vertical;
}

.client-portal-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

/* ── Rich text wrapper (description) ────────────────────────────────── */

.client-portal-rich-text {
  font-size: 15px;
  line-height: 1.6;
}

.client-portal-rich-text p {
  margin: 0 0 12px;
}

.client-portal-rich-text p:last-child {
  margin-bottom: 0;
}

/* ── Success feedback callout variant ───────────────────────────────── */

.client-portal-feedback-callout-success {
  background: #ecfdf5;
  border-left-color: #10b981;
}

.client-portal-feedback-callout-success strong {
  color: #065f46;
}

.client-portal-feedback-callout-success p {
  color: #047857;
}

/* ── Intake form (long, sectioned) ──────────────────────────────────── */

.client-portal-form-section {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 32px 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.client-portal-form-section:first-of-type {
  margin-top: 0;
}

.client-portal-form-field {
  margin-bottom: 16px;
}

.client-portal-form-field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-color, #1f2937);
  margin-bottom: 6px;
}

.client-portal-form-field input[type="text"],
.client-portal-form-field input[type="email"],
.client-portal-form-field input[type="tel"],
.client-portal-form-field input[type="date"],
.client-portal-form-field input[type="file"],
.client-portal-form-field select,
.client-portal-form-field textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  font-family: inherit;
  box-sizing: border-box;
  background: #fff;
}

.client-portal-form-field input:focus,
.client-portal-form-field select:focus,
.client-portal-form-field textarea:focus {
  outline: 0;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.client-portal-form-field textarea {
  resize: vertical;
}

.client-portal-form-help {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  margin: 4px 0 0;
}

/* ── Conditional field reveal (Yes → details textarea) ───────────────── */

.cp-conditional {
  margin-top: 8px;
}

/* ── Checkbox groups (multi-select fields) ──────────────────────────── */

.cp-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 12px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  background: #fff;
}

.cp-checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  margin: 0;
  font-size: 14px;
  cursor: pointer;
}

.cp-checkbox-item input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.cp-other-input {
  margin-top: 8px;
}

/* ── Progress indicator on form submit ──────────────────────────────── */

.client-portal-progress {
  margin-top: 16px;
  padding: 12px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  color: #1e40af;
  font-size: 14px;
}

/* ── Detail-view multi-value pills + helpers ────────────────────────── */

.cp-pill-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cp-pill-list .client-portal-pill {
  font-weight: 500;
}

.cp-other-line {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--text-muted, #6b7280);
}

.cp-empty {
  color: var(--text-muted, #9ca3af);
  font-style: italic;
}

.cp-attachment-group-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 16px 0 4px;
}

.cp-attachment-group-label:first-of-type {
  margin-top: 0;
}

.cp-attachment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cp-attachment-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.cp-attachment-list li:last-child {
  border-bottom: 0;
}

.cp-attachment-list a {
  color: var(--primary, #2563eb);
  text-decoration: none;
  font-size: 14px;
}

.cp-attachment-list a:hover {
  text-decoration: underline;
}

/* ── More Info exchange (portal client-response form) ───────────────── */

.client-portal-more-info {
  border-left: 4px solid #f97316;
}

.client-portal-more-info h2 {
  color: #9a3412;
}

.cp-more-info-meta {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  margin: -8px 0 12px;
}

.client-portal-more-info-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color, #e5e7eb);
}
