/*
 * HMO Manager Pro – Digital Signature Field Styles
 */

/* ── Wrapper ────────────────────────────────────────────────────────────────── */
.hmo-signature-wrapper {
  margin-bottom: 20px;
}

/* ── Label ──────────────────────────────────────────────────────────────────── */
.hmo-signature-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #2d3436;
  margin-bottom: 8px;
}

.hmo-signature-label abbr {
  color: #e74c3c;
  text-decoration: none;
  margin-left: 2px;
}

/* ── Canvas Container ───────────────────────────────────────────────────────── */
.hmo-signature-canvas-wrap {
  position: relative;
  border: 2px solid #dfe6e9;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  cursor: crosshair;
  transition: border-color 0.2s;
  touch-action: none; /* Critical for mobile drawing */
  width: 100%;
  max-width: 600px;
}

.hmo-signature-canvas-wrap:hover,
.hmo-signature-canvas-wrap.active {
  border-color: #2c3e50;
  box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.hmo-signature-canvas-wrap.has-signature {
  border-color: #27ae60;
  box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.08);
}

.hmo-signature-canvas-wrap.invalid {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* ── Canvas element ──────────────────────────────────────────────────────────── */
.hmo-signature-canvas {
  display: block;
  width: 100%;
  height: 160px;
  background: transparent;
}

/* ── Placeholder overlay ────────────────────────────────────────────────────── */
.hmo-sig-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  color: #b2bec3;
  font-size: 13px;
  transition: opacity 0.2s;
}

.hmo-sig-overlay svg {
  opacity: 0.35;
  flex-shrink: 0;
}

.hmo-signature-canvas-wrap.has-signature .hmo-sig-overlay {
  opacity: 0;
}

/* ── Actions row ─────────────────────────────────────────────────────────────── */
.hmo-sig-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.hmo-sig-clear-btn,
.hmo-sig-clear {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: #f8fafb;
  border: 1.5px solid #dfe6e9;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #636e72;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.hmo-sig-clear-btn:hover,
.hmo-sig-clear:hover {
  border-color: #e74c3c;
  color: #e74c3c;
  background: #fdecea;
}

.hmo-sig-hint {
  font-size: 12px;
  color: #b2bec3;
}

.hmo-sig-status {
  font-size: 12px;
  font-weight: 600;
}

.hmo-sig-status.signed {
  color: #27ae60;
}

/* ── Validation error ────────────────────────────────────────────────────────── */
.hmo-sig-error-msg {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #e74c3c;
}

/* ── Signature preview (for review step / PDF) ──────────────────────────────── */
.hmo-sig-preview {
  max-width: 200px;
  max-height: 80px;
  border: 1px solid #dfe6e9;
  border-radius: 4px;
  padding: 4px;
  background: #fff;
}

/* ── Mobile optimisations ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hmo-signature-canvas {
    height: 130px;
  }

  .hmo-signature-canvas-wrap {
    max-width: 100%;
  }
}

/* ── Dark mode support ───────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  .hmo-signature-canvas-wrap {
    background: #1e272e;
    border-color: #4a5568;
  }

  .hmo-sig-clear-btn {
    background: #2d3748;
    border-color: #4a5568;
    color: #a0aec0;
  }

  .hmo-sig-overlay {
    color: #4a5568;
  }
}
