/* Unison Systems - Contractor Onboarding shared styles */

:root {
  --accent: #5B4FDB;
  --accent-light: #E8E4FF;
  --accent-dark: #4A3FC4;
  --dark-text: #1A1A1A;
  --muted: #595959;
  --light-muted: #8a8a8a;
  --border: #E5E5E5;
  --bg: #fafafa;
  --bg-white: #ffffff;
  --error: #D14343;
  --success: #2e8b57;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Calibri, Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--dark-text);
  line-height: 1.5;
  overscroll-behavior-y: contain;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px calc(96px + env(safe-area-inset-bottom)) 20px;
}

/* Header */
.app-header {
  background: var(--bg-white);
  border-bottom: 3px solid var(--accent);
  padding: 16px 20px;
}
.app-header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.app-header img { height: 80px; width: auto; }
.app-header .title-block {
  text-align: right;
}
.app-header h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
}
.app-header .subtitle {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  margin-top: 2px;
}

/* Progress bar */
.progress {
  background: var(--bg-white);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.progress-inner {
  max-width: 720px;
  margin: 0 auto;
}
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}
.progress-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}

/* Steps / cards */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card h2 {
  margin: 0 0 8px;
  font-size: 22px;
  color: var(--dark-text);
}
.card .lede {
  margin: 0 0 24px;
  color: var(--muted);
}

/* Section header (matches the printed forms) */
.section-header {
  background: var(--accent-light);
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 6px;
  font-weight: 700;
  margin: 24px 0 16px;
  font-size: 14px;
}

/* Form fields */
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--dark-text);
}
.field .hint {
  font-size: 12px;
  color: var(--light-muted);
  margin-bottom: 6px;
  font-weight: 400;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="date"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  background: var(--bg-white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.field input.invalid,
.field select.invalid {
  border-color: var(--error);
}
.field .field-error {
  color: var(--error);
  font-size: 12px;
  margin-top: 4px;
}

.field-row {
  display: grid;
  gap: 14px;
  align-items: end;
}
.field-row.cols-2 { grid-template-columns: 1fr 1fr; }
.field-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 600px) {
  .field-row.cols-2, .field-row.cols-3 { grid-template-columns: 1fr; }
}

/* Radio cards (entity type picker) */
.radio-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 16px;
}
.radio-card {
  display: block;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: var(--bg-white);
  transition: all 0.15s;
}
.radio-card:hover {
  border-color: var(--accent);
}
.radio-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}
.radio-card input[type="radio"] {
  margin-right: 10px;
  accent-color: var(--accent);
}
.radio-card .label {
  font-weight: 600;
  font-size: 15px;
}
.radio-card .description {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  margin-left: 24px;
}
.radio-card.note {
  background: #FEF7E5;
  border-color: #E5BC4F;
  font-size: 13px;
  padding: 12px 16px;
  margin-top: 8px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled {
  background: var(--border);
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--bg-white);
  color: var(--dark-text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }
.btn-text {
  background: transparent;
  color: var(--accent);
  padding: 8px 12px;
}

.button-row {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  gap: 12px;
}

/* Checklist (welcome card) */
.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.checklist li:last-child { border-bottom: none; }
.checklist .icon {
  color: var(--accent);
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
  width: 20px;
}
.checklist .item-label {
  font-weight: 600;
  font-size: 15px;
}
.checklist .item-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* Signature pad */
.signature-pad-wrapper {
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-white);
  padding: 8px;
  margin: 12px 0;
}
.signature-pad-wrapper canvas {
  display: block;
  width: 100%;
  height: 140px;
  background: white;
  border-radius: 4px;
  cursor: crosshair;
  touch-action: none;
}
.signature-pad-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* File upload */
.file-drop {
  display: block;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 14px 20px;
  margin-bottom: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg);
}
.file-drop:hover, .file-drop.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}
.file-drop input[type="file"] { display: none; }
.file-drop .icon { font-size: 20px; color: var(--accent); margin-bottom: 2px; }
.file-drop .title { font-weight: 600; font-size: 14px; }
.file-drop .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

.uploaded-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #F0F8F0;
  border: 1px solid #C8E6C8;
  border-radius: 6px;
  margin-top: 8px;
  font-size: 14px;
}
.uploaded-file .check { color: var(--success); margin-right: 8px; }

/* Review block */
.review-section {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 12px;
}
.review-section .header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.review-section .header h3 {
  margin: 0;
  font-size: 15px;
}
.review-section .edit-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}
.review-row {
  display: flex;
  padding: 6px 0;
  border-bottom: 1px solid #f3f3f3;
  font-size: 14px;
}
.review-row:last-child { border-bottom: none; }
.review-row .label {
  color: var(--muted);
  width: 180px;
  flex-shrink: 0;
}
.review-row .value {
  flex: 1;
  word-break: break-word;
}

/* Toast / status */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--dark-text);
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 14px;
  z-index: 100;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.error-banner {
  background: #FDE7E7;
  border: 1px solid #F5B5B5;
  color: var(--error);
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}

.info-banner {
  background: var(--accent-light);
  border: 1px solid var(--accent);
  color: var(--accent-dark);
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}
